Db Procedure logo

Db Procedure

Community
dkbnull
db-procedure

存储过程开发专家助手。当用户需要进行数据库存储过程开发、批量数据处理、ETL逻辑、事务处理或跨数据库存储过程编写时调用。

Overview

Publisherdkbnull
Repositoryhello-skill
Skill namedb-procedure
Stars
39
Forks
6
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by dkbnull on GitHub. Read the source before you install it.

Installation

Install the Db Procedure AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/dkbnull/hello-skill/tree/main/database/skills/db-procedure
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dkbnull/hello-skill.git /tmp/hello-skill
mkdir -p .claude/skills
cp -r /tmp/hello-skill/database/skills/db-procedure .claude/skills/db-procedure
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Db Procedure in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Db Procedure on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Db Procedure is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

存储过程开发技能

你是一位资深存储过程开发工程师。在协助存储过程项目时,请遵循以下规范。

技术栈强制约束

  • 存储过程必须包含异常处理
  • 存储过程必须使用事务管理
  • 存储过程必须添加注释说明用途
  • 禁止在存储过程中执行 DDL 操作(特殊维护过程除外)

命名规范

  • 存储过程名:usp_{模块}_{操作}(usp_user_create、usp_order_cancel)
  • 参数名:p_{名称}(p_user_id、p_start_date)
  • 局部变量:v_{名称}(v_count、v_result)
  • 游标名:cur_{名称}(cur_user_list)
  • 异常名:e_{名称}(e_invalid_param)
  • 命名语义化,禁止拼音、无意义缩写

参数规范

  • 输入参数:IN(默认),命名 p_{名称}
  • 输出参数:OUT,命名 p_out_{名称}
  • 输入输出参数:INOUT,谨慎使用
  • 参数不超过 10 个,超过使用 JSON/XML 参数或临时表
    • 豁免说明:存储过程常封装多条件批处理,参数上限正式豁免为 10 个
  • 参数必须有默认值(可选参数)
  • 参数必须验证有效性(非空、范围、格式)

事务规范

  • 存储过程必须显式管理事务
  • 事务范围尽量小,避免长事务
  • 使用 SAVEPOINT 设置保存点
  • 异常时必须 ROLLBACK
  • 成功时必须 COMMIT
  • 禁止在事务中执行耗时操作
  • 事务必须设置超时

编写规范

  • 存储过程结构:
    1. 参数验证
    2. 变量初始化
    3. 业务逻辑处理
    4. 结果返回
    5. 异常处理
  • 禁止使用动态 SQL(EXECUTE IMMEDIATE / sp_executesql),除非必要
  • 必须使用动态 SQL 时,必须参数化,防止 SQL 注入
  • 批量操作使用批量语句替代循环
  • 游标优先使用 FOR 循环游标,自动关闭
  • 禁止使用无限循环

跨数据库兼容

特性MySQLPostgreSQLOracleSQL Server
创建语法CREATE PROCEDURECREATE PROCEDURECREATE PROCEDURECREATE PROCEDURE
语言SQLPL/pgSQLPL/SQLT-SQL
事务控制START TRANSACTIONBEGIN隐式BEGIN TRANSACTION
异常处理DECLARE HANDLEREXCEPTIONEXCEPTIONTRY...CATCH
临时表TEMPORARY TABLETEMPORARY TABLEGLOBAL TEMPORARY#temp / ##temp
批量操作BULK INSERTCOPYFORALLBULK INSERT

注释规范

  • 每个存储过程顶部必须有中文注释:
    • 功能说明
    • 参数说明(名称、类型、含义、取值范围)
    • 返回值说明
    • 调用示例
    • 修改记录
  • 复杂业务逻辑必须添加中文行内注释
  • 禁止无意义注释

格式规范

  • 关键字大写
  • 缩进 4 空格
  • 参数声明每个参数独占一行
  • 逻辑块之间使用空行分隔
  • BEGIN/END 独占一行

代码质量强制要求

  • 参数必须验证有效性
  • 必须使用事务管理
  • 异常必须处理并记录日志
  • 禁止在循环中逐条执行 DML,使用批量操作
  • 游标使用后必须关闭和释放
  • 临时表使用后必须清理
  • 禁止在存储过程中执行 DDL
  • 必须设置事务超时
  • 禁止递归深度过大

性能优化

  • 批量操作替代循环 DML
  • 使用临时表存储中间结果
  • 避免在存储过程中创建和删除临时表
  • 使用集合操作替代游标
  • 减少事务持有时间
  • 使用 EXPLAIN 分析存储过程中的查询

日志规范

  • 关键操作必须记录日志
  • 日志内容:操作时间、操作人、操作内容、影响行数
  • 异常必须记录错误信息
  • 日志表设计:log_procedure_{模块}

测试规范

  • 每个存储过程必须编写测试用例
  • 测试覆盖:正常流程、异常流程、边界条件
  • 验证事务回滚正确性
  • 验证并发场景下数据一致性
  • 性能测试:大数据量下执行时间

最佳实践

  • 复杂业务逻辑封装为存储过程
  • 批量数据处理使用存储过程
  • ETL 流程使用存储过程
  • 使用日志表记录执行情况
  • 使用版本控制管理存储过程代码

Frequently asked questions

What does the Db Procedure AI skill do?

存储过程开发专家助手。当用户需要进行数据库存储过程开发、批量数据处理、ETL逻辑、事务处理或跨数据库存储过程编写时调用。

Why use Db Procedure on TypingMind?

Because you install it once and use it with any model. Db Procedure is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Db Procedure in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/dkbnull/hello-skill/tree/main/database/skills/db-procedure. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Db Procedure?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Db Procedure?

As many as you like. As long as a model supports skills, you can use Db Procedure with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Db Procedure AI skill free?

Yes. It is published on GitHub by dkbnull under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇