Use when reviewing a PR that touches the Prisma schema or migrations, running migrations in staging or production, or auditing schema changes for safety.
72
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Forge's backend-api uses Prisma with SQLite in development and PostgreSQL in production. All schema changes must go through Prisma migrations — never use prisma db push outside of development.
prisma/schema.prismaprisma/migrations/Before approving or merging any PR that changes the schema, verify all of the following:
Zero-downtime deploys require that existing rows satisfy the new schema immediately.
Safe:
emailVerified Boolean @default(false)
displayName String?Unsafe — will fail on existing rows in production:
requiredField String // no default, not nullableEvery @relation field (foreign key) must have a @@index. Fields used in hot where clauses should also be indexed. Check prisma/schema.prisma for any @relation without a matching @@index.
Run prisma migrate dev --name <description> locally, then read the generated SQL:
cat prisma/migrations/*/migration.sql | tail -40Red flags:
DROP TABLE or DROP COLUMN on tables/columns still referenced in src/ALTER TABLE ... ADD COLUMN without DEFAULT or NOT NULL (with default)IF NOT EXISTS on index creation# 1. Snapshot the database before migrating — coordinate with ops
# 2. Deploy application binary first, then run migration
npx prisma migrate deploy
# 3. Confirm status
npx prisma migrate status
# Expected: "All migrations have been applied."Never use prisma db push outside of dev — it can silently drop data.
Prisma does not auto-rollback. If a migration causes an incident:
npx prisma migrate statusnpx prisma migrate deployOnly remove a column or table after all three conditions are met:
src/ references it (verify with grep -r "columnName" src/)# 1. Confirm no references
grep -r "oldColumn" src/
# 2. Remove from schema.prisma, then create migration
npx prisma migrate dev --name remove_deprecated_old_column
# 3. Inspect the SQL — should be a single DROP COLUMN line
cat prisma/migrations/$(ls -t prisma/migrations | head -1)/migration.sqlDATABASE_URL=file:./dev.db (.env)DATABASE_URL=file:./test.db (set automatically in tests/setup.ts)forge/db/bf5b15a
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.