Claude Code: save it as .claude/skills/database-implementation/SKILL.md
Cursor: save it as .cursor/rules/database-implementation.md
Codex: save it as .agents/skills/database-implementation/SKILL.md
ChatGPT, Gemini and other assistants: paste it into custom or project instructions
Skill file
Database Implementation
When to use
Setting up a new data access layer and choosing an ORM or query builder
Writing migrations for schema changes
Implementing transactions across multiple tables or services
Configuring connection pooling for production
Adding read replica routing for query scaling
Optimizing slow queries (N+1, missing indexes, full scans)
Writing database integration tests with Testcontainers
Setting up factories or seed data
Core principles
ORM is a tool, SQL is the truth — know what queries your ORM generates; use EXPLAIN ANALYZE
Migrations are immutable contracts — never modify a migration applied to any shared environment
Pooling is not optional — one connection per request = death in production
Transactions stay short — locks held across network calls cause cascading timeouts
Test against the real database — in-memory SQLite mocks hide Postgres-specific bugs
Reference Files
references/orm-selection.md — comparison tables for all ORMs and query builders across Node.js, Python, Go, Rust, JVM, Ruby, Elixir, and .NET; pick before writing any data layer code
references/polyglot-orm-patterns.md — production patterns for SQLAlchemy 2.0 async, GORM with hooks and Gen, Diesel compile-time queries, EF Core 8 with interceptors, Ecto changesets and Multi, and Exposed DSL
references/migrations-pooling-replicas.md — migration rules (zero-downtime patterns, idempotency), connection pool sizing per stack, read replica routing, query optimization checklist, and transaction isolation guidelines
references/testing-seeding.md — Testcontainers setup for Node.js/Python/Go, pg_tmp for fast local tests, fishery/factory_boy database factories, and seed script best practices
Use this skill with your AI agent:Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.