Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add chaunsin/agent-skills --skill database-designgit clone --depth 1 https://github.com/chaunsin/agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/chaunsin/agent-skills/database-design)<a href="https://agentmods.dev/skills/chaunsin/agent-skills/database-design"><img src="https://agentmods.dev/badge/skills/chaunsin/agent-skills/database-design/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/chaunsin/agent-skills/database-design"><img src="https://agentmods.dev/badge/skills/chaunsin/agent-skills/database-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00111 | $0.02085 |
| Opus 5.5 | $0.00044 | $0.00834 |
| Sonnet 5.5 | $0.00022 | $0.00417 |
| Haiku 4.5 | $0.00011 | $0.00209 |
Grade A, and why
database-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 23d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.
关系型数据库建模与建表
一、技能目标与职责
本技能负责将业务需求转化为可维护、数据完整、性能合理的关系型数据库模型和物理表结构。工作范围包括需求分析、领域建模、表与字段设计、主键与约束、索引、事务并发、特殊业务数据、架构扩展、数据库兼容及迁移。
适用于 MySQL、PostgreSQL 等关系型数据库。逻辑模型尽量保持数据库无关;物理 DDL 必须依据目标数据库产品、版本及存储引擎适配。
二、核心设计原则
- 业务正确优先:模型必须准确表达业务实体、关系、状态和生命周期,不得自行编造业务规则。
- 默认规范化:逻辑设计默认以第三范式(3NF)为基线,避免重复事实和不必要冗余;有明确业务或性能依据时才反规范化,并说明数据来源、更新机制及一致性保障。
- 数据完整性:优先使用主键、唯一、非空、检查约束及适当的外键表达可由数据库保证的规则。禁用物理外键时,必须说明应用层校验、事务、补偿或巡检方案。
- 职责清晰:不得为了减少表数量,把职责、生命周期或访问模式明显不同的数据强行合并。
- 命名统一:标识符默认使用小写
snake_case,仅使用 ASCII 字母、数字和下划线;避免保留字、模糊命名和同义字段多套命名。 - 类型准确:字段类型、长度、精度、NULL 和默认值必须符合业务语义及数据范围。金额不得使用浮点类型进行精确记账。
- 索引由查询驱动:根据真实查询条件、排序、关联、数据分布和执行计划设计索引,不设置固定索引数量上限。
- 避免过度设计:不得无依据地引入冗余字段、位图、多态关联、分区、分库分表、读写分离或复杂缓存。
- 显式处理假设:关键信息缺失时提出待确认事项;非关键缺失可采用合理假设,但必须标注,不得将假设伪装成已知业务事实。
三、执行流程
按照以下顺序完成设计,不要在未理解业务关系前直接生成复杂 DDL。
- 确认上下文:识别数据库产品、版本、存储引擎、现有命名规范、部署形态及迁移工具。若未知,明确标注,并避免使用未经确认的专有语法。
- 分析需求:识别业务实体、数据归属、实体关系、唯一性、状态流转、读写模式、并发、数据保留及安全要求。
- 建立逻辑模型:划分领域和实体,明确 1:1、1:N、N:N 或多态关系,确定数据权威来源及生命周期。
- 设计物理结构:确定表、字段、主键、类型、NULL、默认值、注释、约束和关联策略。
- 选择 ID 策略:常规单库默认采用数值型自增主键;分布式生成或多写入节点场景按需评估 Snowflake、UUIDv7 等有序 ID。详细规则见 references/id-strategy.md。
- 设计索引与访问路径:使用实际或预期 SQL 推导索引;重要查询应说明索引服务的查询模式。
- 评估特殊要求:仅在业务需要时设计软删除、乐观锁、账务流水、多租户、分区、分库分表、读写分离及高可用。
- 生成并审查 DDL:按目标数据库版本生成表、索引、约束及注释;检查兼容性、数据完整性、并发风险和迁移影响。
- 验证并交付:能够连接目标数据库时执行验证;不能执行时,只能说明静态审查结果,不得声称已实际验证。
四、渐进式披露:按需读取参考文件
不要默认读取全部参考文件。 先根据当前任务判断需要的知识,再只读取相关文件;一个任务涉及多个主题时才组合读取。
| 当前任务 | 按需读取 |
|---|---|
| 业务领域、范式、表/字段、关系、NULL、软删除、约束 | references/modeling-and-schema.md |
| 主键、自增、Snowflake、UUIDv7、分布式 ID、分片键 | references/id-strategy.md |
| MySQL 类型、DDL、InnoDB、时间、索引和版本差异 | references/mysql.md |
| PostgreSQL 类型、DDL、Identity、UUID、索引和版本差异 | references/postgresql.md |
| 索引、联合索引、执行计划、分页、IN/EXISTS | references/indexing-and-query.md |
| 事务、锁、并发、UPSERT、幂等 | references/transactions-and-concurrency.md |
| 金额、资产、账务、库存、积分、发放与状态机 | references/business-data.md |
| 触发器使用、编写、数据库差异、测试与迁移 | references/triggers.md |
| 多租户、服务边界、分区、分库分表、集群、在线迁移 | references/architecture-and-migration.md |
What ships with it
9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/architecture-and-migration.md 4.2 KB
- references/business-data.md 2.2 KB
- references/id-strategy.md 6.9 KB
- references/indexing-and-query.md 3.7 KB
- references/modeling-and-schema.md 7.8 KB
- references/mysql.md 4.4 KB
- references/postgresql.md 4.5 KB
- references/transactions-and-concurrency.md 3.8 KB
- references/triggers.md 2.5 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 23d ago Changed · +2 lines · +15 tokens per session ecfa7afe9be9
- 25d ago First seen · 88 lines · 96 tokens per session scan A 7814f65b92cb
database-design is a skill published in the GitHub repository chaunsin/agent-skills (2 stars, last pushed 12d ago), licensed Apache-2.0. It adds 111 tokens to every session and 2,085 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-07.
database-design compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| database-designchaunsin/agent-skills | Skill | 2 | 12d ago | Apache-2.0 | A | 111 | Claude Code, Codex |
| mongodbmongodb/agent-skills | Skill | 211 | today | Apache-2.0 | A | 218 | Claude Code, Codex |
| yida-data-managementopenyida/openyida | Skill | 234 | today | MIT | A | 91 | Claude Code, Codex |
| yida-aggregate-tableopenyida/openyida | Skill | 234 | today | MIT | A | 71 | Claude Code, Codex |
| yida-db-seq-fixopenyida/openyida | Skill | 234 | today | MIT | A | 73 | Claude Code, Codex |
| mongodb-qe-size-estimationmongodb/agent-skills | Skill | 211 | today | Apache-2.0 | A | 52 | Claude Code |
| doris-repo-reviewapache/doris-skills | Skill | 52 | 6d ago | Apache-2.0 | A | 200 | Claude Code, Codex |