com um clique
sync-db-schema-from-code
// Apply schema changes from repo SSOT (prisma/schema.prisma) to a target DB via Prisma migrations, with diff preview + approval gate; then refresh LLM context (docs/context/db/schema.json).
// Apply schema changes from repo SSOT (prisma/schema.prisma) to a target DB via Prisma migrations, with diff preview + approval gate; then refresh LLM context (docs/context/db/schema.json).
Treat convex/schema.ts as the database Single Source of Truth, initialize Convex scaffolding, regenerate docs/context/db/schema.json and docs/context/convex/functions.json, and verify the repository stays aligned with Convex mode.
Mirror schema changes from a real database (SSOT) into repo artifacts (prisma/schema.prisma + db/schema/tables.json) and refresh LLM context (docs/context/db/schema.json).
Enable and operate the Deployment feature (ops/deploy conventions + deploy scripts) for multi-environment delivery.
Plan/apply/verify cloud environment config and secret references using env contract + policy/inventory routing; detect drift, rotate secrets, and decommission environments with approval gates. Use for staging/prod deployments and maintenance.
Maintain env contract SSOT (env/contract.yaml), validate env/values + env/secrets refs coverage, and generate env/.env.example + docs/context/env/*. Use when adding/renaming/deprecating config keys.
Bootstrap, diagnose (doctor), and reconcile local dev environment from env contract/values/secret refs; generate .env.local and redacted docs/context/env/effective-*. Use when local env is broken or needs syncing.
| name | sync-db-schema-from-code |
| description | Apply schema changes from repo SSOT (prisma/schema.prisma) to a target DB via Prisma migrations, with diff preview + approval gate; then refresh LLM context (docs/context/db/schema.json). |
Treat prisma/schema.prisma as the schema Single Source of Truth (SSOT) and safely apply schema changes to a target database with:
docs/context/db/schema.jsonThis skill is intentionally written for a development workflow (developers manage DB changes via Prisma), not a DBA-centric workflow.
This skill MUST be used only when the project DB SSOT is repo-prisma:
prisma/schema.prismaIf the project uses database-as-SSOT, use sync-code-schema-from-db instead.
To check the mode, read:
docs/project/db-ssot.jsonUse when the user asks to:
schema.prisma and the actual DBAvoid when:
prisma db pull) (use sync-code-schema-from-db)prisma/schema.prisma.docs/context/db/schema.json (generated; do not hand-edit).See ./reference/prisma-ssot-mechanism.md for the end-to-end pattern (domain vs persistence vs DTO).
dev / staging / prod (must be explicit)DATABASE_URL via environment; never paste secrets into chat)prisma migrate)prisma db push only if explicitly chosen (and justified)Choose one evidence location (no secrets):
dev-docs/AGENTS.md Decision Gate (recommended for staging/prod):
dev-docs/active/<task-slug>/artifacts/db/.ai/.tmp/db-sync/<run-id>/Evidence files:
00-connection-check.md01-schema-diff-preview.md02-migration-plan.md03-execution-log.md04-post-verify.mdrepo-prisma (docs/project/db-ssot.json).
sync-code-schema-from-db.Apply the schema change in prisma/schema.prisma (SSOT).
Run local validation (read-only against schema):
npx prisma formatnpx prisma validateProduce a diff preview (no DB writes):
npx prisma migrate dev --create-only --name <slug> (dev)prisma/migrations/*/migration.sql.Write 01-schema-diff-preview.md and 02-migration-plan.md:
03-execution-log.md:npx prisma migrate deploynpx prisma migrate devnpx prisma db pushnpx prisma migrate statusRecord evidence in 04-post-verify.md.
node .ai/scripts/ctl-db-ssot.mjs sync-to-context(If context-awareness is enabled, the command also runs ctl-context touch best-effort.)
repo-prismadocs/context/db/schema.json refreshed via ctl-db-ssotnode .ai/tests/run.mjs --suite databaseprisma migrate)