db-schema-designer
Skill1 starsChanged 2 months agoMITView on GitHub
数据库 schema 设计、ORM 建模与迁移安全。当需要设计数据库表结构、写 ORM schema(Prisma/Drizzle/TypeORM/Sequelize)、数据库迁移、索引优化、关系设计(1-1/1-N/N-N)、PostgreSQL/MySQL/SQLite/MongoDB 选型、数据库规范化、反范式设计、查询性能优化时使用。
4 other projects use a version of this.
Adopted by
Most recently taken up by
- go-sphere/skillstheir own version, first seen Oct 20, 2026
- mike22890/opencode-skills-enword for word, first seen Oct 15, 2026
- Laffey-82/cn-agent-skillstheir own version, first seen Aug 29, 2026
- Dokkabei97/forged-claude-codetheir own version, first seen Mar 1, 2026
Other versions4 projects use a version of this.
Word for word · 1
- mike22890/opencode-skills-en★ 1100% same
Edited · 0
None found.
Wrote their own version · 3
- Dokkabei97/forged-claude-code★ 2same name
- go-sphere/skills★ 1same name
- Laffey-82/cn-agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- aestheticsSkill
- applying-ui-design-systemSkill
- avoid-ai-writingSkill
- clonedepsSkill
- codemapSkill
- code-masterySkill
- code-refactor-astSkill
- copywritingSkill
- croSkill
- frontend-designSkill
- github-workflowSkill
- git-workflowSkill
- humanize-fictionSkill
- human-voiceSkill
- life-planningSkill
- literary-craftSkill
- long-taskSkill
- marketing-psychologySkill
- masterpiece-writingSkill
- mcp-builderSkill
- mermaid-diagram-generatorSkill
- orchestrating-adversarial-reviewsSkill
- pandocSkill
- persuasion-craftSkill
- pptxSkill
- pricingSkill
- privacy-guardSkill
- product-strategySkill
- property-based-testingSkill
- psychology-masterySkill
- research-masterySkill
- self-editSkill
- shopping-advisorSkill
- simplifySkill
- skill-creatorSkill
- story-endingsSkill
- system-designSkill
- thinking-craftSkill
- wealth-masterySkill
- wisdom-philosophySkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Always define foreign keys with explicit ON DELETE behavior (CASCADE, SET NULL, or RESTRICT).
- Distinctive: line 30
ALWAYS index foreign key columns to prevent table locks and slow joins.
- Distinctive: line 49
When modifying production schemas:
- Distinctive: line 51
Add the new column (nullable or with default).
- Distinctive: line 55
Remove old column references from code.
- Very specific: line 58
Use CREATE INDEX CONCURRENTLY to avoid taking an exclusive table lock.
- Very specific: line 60
Add column as NULL, backfill defaults, add check constraint NOT VALID, then VALIDATE CONSTRAINT.
- Very specific: line 62
Always set SET lock_timeout = '2s'.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Database Schema & Migration Engineering Guide
This skill provides expert design patterns for relational data modeling, indexing strategies, and zero-downtime migrations.
何时触发
关键词命中即触发:数据库、建表、表结构、schema、ORM、Prisma、Drizzle、迁移、索引、关系、外键、PostgreSQL、MySQL、MongoDB、SQL、查询优化、性能、规范化。
1. Schema Design Standards
Primary Keys
- Distributed / Microservices: Prefer
UUIDv7(time-ordered, index-friendly) orULID. - Single-instance SQL:
BIGINT GENERATED ALWAYS AS IDENTITY(PostgreSQL) orAUTO_INCREMENT(MySQL).
Timestamps & Audit Fields
- Always include:
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMPupdated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMPdeleted_at TIMESTAMPTZ NULL(if soft deletes are required)
Foreign Keys & Integrity
- Always define foreign keys with explicit
ON DELETEbehavior (CASCADE,SET NULL, orRESTRICT). - ALWAYS index foreign key columns to prevent table locks and slow joins.
2. Indexing Strategy & Optimization
- Composite Index Column Order (Equality First, Range Last):
- Rule: Place columns filtered by exact equality (
=) first, followed by columns used in ranges (>,<,BETWEEN) orORDER BY.
- Rule: Place columns filtered by exact equality (
- Covering Indexes (Index-Only Scans):
- Include frequently selected columns in
INCLUDE (...)clause to avoid heap fetches.
- Include frequently selected columns in
- Partial / Filtered Indexes:
- For soft-deleted tables:
CREATE INDEX idx_active_users ON users (email) WHERE deleted_at IS NULL;
- For soft-deleted tables:
- Avoid Over-Indexing:
- Each index adds write overhead (INSERT/UPDATE/DELETE). Prune redundant or prefix-overlapping indexes.
3. Zero-Downtime Migration Safety Checklist
When modifying production schemas:
- Never rename or drop a column in one step:
- Add the new column (nullable or with default).
- Dual-write in application code (write to both old and new columns).
- Backfill existing historical rows.
- Switch reads to the new column.
- Remove old column references from code.
- Drop the old column in a later release.
- PostgreSQL Concurrent Indexes:
- Use
CREATE INDEX CONCURRENTLYto avoid taking an exclusive table lock.
- Use
- Adding NOT NULL constraints:
- Add column as
NULL, backfill defaults, add check constraintNOT VALID, thenVALIDATE CONSTRAINT.
- Add column as
- Set lock timeouts:
- Always set
SET lock_timeout = '2s';before running risky DDL.
- Always set
加载 reference
| 用户说 | 加载 |
| 数据库设计 / 建表 / 表结构 / 命名规范 / 数据类型 / 规范化/ 范式 | reference/design.md |
| 索引 / 复合索引 / EXPLAIN / 查询优化 / 慢查询/ 性能调优/ 覆盖索引 | reference/indexing.md |
| 迁移 / 零停机 / 回滚 / 大表/ 生产环境/ 安全变更/ 在线迁移 | reference/migrations.md |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

