database-patterns — Claude Code skill for schemas and migrations
Hands your agent a fixed set of database rules: column types, UUID keys, soft deletes and migration templates. Useful when it writes tables or repositories.
npx skills add c0x12c/ai-toolkit --skill database-patterns -a claude-codeWhat database-patterns does
The skill feeds the agent a short rulebook for schemas and migrations. The hard rules are blunt: TEXT columns instead of VARCHAR, UUID primary keys instead of SERIAL or BIGINT, soft deletes through a deleted_at TIMESTAMP column rather than DELETE FROM, and foreign keys validated in application code instead of REFERENCES with ON DELETE CASCADE. Every table carries id, created_at, updated_at and deleted_at.
Templates cover the rest. There is a SQL migration with a table, a trigger and partial indexes for soft deletes, an Exposed table object extending UUIDTable, an entity data class implementing Entity<Instant>, and a repository laid out as an interface plus a Default* implementation. Reads go to db.replica, writes to db.primary, and a convert() method maps ResultRow to the entity. A checklist walks through the seven steps of adding a table, from the migration file to repository tests.
A gotchas section catches the usual mistakes. .value applies to id alone — row[Table.projectId] already returns a UUID, so adding .value elsewhere breaks compilation. If your entity extends SoftDeleteTable, redeclaring createdAt, updatedAt or deletedAt triggers a duplicate column error. Flyway rules are strict too: never fill a gap in a deployed migration sequence, and never rename a migration that has already shipped.
What it helps with
- pick one rule for column and key types
- write a SQL migration with a trigger and partial indexes
- build a repository that reads replicas and writes the primary
- add a table through the seven-step checklist
- separate soft deletes from hard
DELETEstatements
Example prompts for the agent
- Create the projects table following database-patterns
- Write a migration for a new table with soft delete
- Build a repository for this entity reading from
db.replica
How to install database-patterns
1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill database-patterns -a claude-code2Manually: put the files in place
~/.claude/skills/database-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/database-patterns/
1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill database-patterns -a codex2Manually: put the files in place
.agents/skills/database-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill database-patterns -a cursor2Manually: put the files in place
.cursor/skills/database-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install c0x12c/ai-toolkit database-patterns2Manually: put the files in place
.github/skills/database-patterns/SKILL.md1Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill database-patterns -a gemini-cli2Platform CLI
gemini skills install https://github.com/c0x12c/ai-toolkit --path toolkit/skills/database-patternsManually: put the files in place
.devin/skills/database-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add c0x12c/ai-toolkit --skill database-patterns -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about database-patterns
How do I install database-patterns in Claude Code?
Run npx skills add c0x12c/ai-toolkit --skill database-patterns -a claude-code. The skill file lands at ~/.claude/skills/database-patterns/SKILL.md.
What does database-patterns do?
It gives the agent rules for schemas, migrations and repositories: column types, UUID keys, soft deletes, Exposed templates and a table-creation checklist.
Which tools can the skill use?
Read, Write, Edit, Glob and Grep are allowed, so the agent can inspect existing migrations and edit repository files.