Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add c0x12c/ai-toolkit --skill database-patterns -a claude-code
Open on GitHub

What 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 DELETE statements

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-code

2Manually: put the files in place

~/.claude/skills/database-patterns/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/database-patterns/

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.

Similar skills

All skills for Data and databases →

From the same set11

startup-pipeline Moves a startup idea through four stages: brainstorm, validation, market research and pitch materials. Gates between stages stop weak ideas early. CX Codex +1 ★ 109repo stars python-testing-strategies A skill that tells your coding agent how to test FastAPI apps: pytest-asyncio, httpx AsyncClient, data factories and the checks every endpoint needs. CX Codex +1 ★ 109repo stars ops-oncall-log Pulls alerts from your monitoring platform and writes a structured on-call log to the team wiki. Useful at the end of a shift or during a review. CX Codex +1 ★ 109repo stars kotlin-best-practices A skill that pins down Kotlin conventions: null safety, Either instead of thrown exceptions, coroutines, and Exposed ORM patterns. Useful while writing or reviewing Kotlin. CX Codex +1 ★ 109repo stars investor-materials A skill for producing investor-facing documents: a pitch deck, one-pager, memo and financial model. Useful when the numbers and the story have to line up across every file. CX Codex +1 ★ 109repo stars design-intelligence Bootstraps a design system from scratch: palette, type scale, spacing, radii and a component inventory in three formats. CX Codex +1 ★ 109repo stars ci-cd-patterns A skill with GitHub Actions templates, PR checks and deployment steps. Handy when CI breaks or you are wiring it up from scratch. CX Codex +1 ★ 109repo stars backend-api-design Tells the agent how to shape RPC-style APIs: a thin controller, a manager holding business logic, a repository for data access. Useful when adding endpoints or auditing existing ones. CX Codex +1 ★ 109repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor