db-integration-test
Installation
SKILL.md
DB Integration Test Skill
Discovery
Before writing tests, extract:
- DB engine — Postgres, MySQL, SQLite, MongoDB, etc. (affects transaction syntax, constraint behavior, JSON support)
- Access layer — raw SQL, query builder (Knex, Drizzle), ORM (Prisma, TypeORM, Sequelize)
- Schema — tables, columns, constraints (NOT NULL, UNIQUE, FK, CHECK), indexes
- Test DB strategy — is there an existing test DB, Docker Compose setup, or in-process option (SQLite,
pg-mem)? - Seeding approach — fixtures, factories, or raw inserts? Already established or needs creating?
Test DB Setup — Non-Obvious Decisions
1. Isolate tests with transactions, not table truncation
Transaction rollback is faster and cleaner than truncating between tests: