/everything-backend:backend-migratefrom everything-backend
Writes and applies safe database schema migrations: expand/contract, concurrent indexes, batched backfills, rollback gates. Covers Prisma, Alembic, Django, Rails, Flyway and more.
Ships in everything-backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Evolves a live database schema without downtime or data loss. This is the only skill that writes migration files, and the only skill that applies them from an agent session. backend-deploy wires approved migrations into the pipeline as a gated step; it never authors them.
Not for: code or framework migrations, strangler-fig rewrites (backend-refactor); greenfield schema design (backend-db-design); running the deploy itself (backend-deploy); backup and DR setup (backend-ops).
_shared/ inside this skill's folder (bundled installs), then ../_shared/ next to it; other fallbacks are in <shared>/context-loading.md -> Resolving _shared/ Files. A missing shared doc is a warning, not a stop.<shared>/tool-rules.md (mode=auto contract, Production Targets, Command Time Budgets, checkpoints) and <shared>/host-tools.md if the action names below don't match your host's tools. Read the Database section of <shared>/principles.md.<shared>/context-loading.md, with db-schema.md, tech-stack.md and decisions.md as high priority, plus the ## Migration Phases section of deployment.md if it exists. Missing memory is fine: create the file you need when you first append to it (format in <shared>/memory-schema.md).<shared>/stacks/, read it. For PostgreSQL read <shared>/stacks/postgres.md.These are non-negotiable. Details and examples live in the references.
CHECK ... NOT VALID, VALIDATE CONSTRAINT in a separate transaction, SET NOT NULL (PG 12+), drop the CHECK. FK and CHECK constraints use NOT VALID then VALIDATE; UNIQUE uses a concurrent unique index.SET lock_timeout (short) and statement_timeout; check for long transactions first; retry with backoff from an approved script. MySQL: lock_wait_timeout and an explicit ALGORITHM. See references/zero-downtime.md.CONCURRENTLY, one statement per migration file, with the tool's no-transaction opt-out. Never "fix" the error by dropping CONCURRENTLY. Clean up INVALID indexes before retrying.DROP, type changes and table rewrites before it is applied.<shared>/sql-safety.md (rules 1, 2 and 8): values are bound (USING, driver placeholders), dynamic identifiers come from a fixed list or the catalog and are quoted with format('%I') or the driver's identifier function, DDL literals use format('%L'). Values read from the database count as untrusted. Migrations run with a separate migration role, never the app role (rule 11; references/tools.md -> Migration Role). Run the sql-safety Verification over every migration and backfill file before reporting done.Follows <shared>/tool-rules.md -> mode=auto Contract; that contract wins on any conflict.
EXPLAIN). A provably local database this run did not start (a developer's dev database) is not disposable: applying there is still Ask First. Never run a DB-resetting or data-losing command against a shared database, even when asked in passing: name the command and ask.<shared>/tool-rules.md -> Production Targets). Read the connection string the tool will actually use (DATABASE_URL, alembic.ini, settings.py, appsettings*.json, flyway.conf, ...). A name containing dev, staging or test is not proof.EXPLAIN ANALYZE on DML outside a local database: it executes the statement.<shared>/tool-rules.md -> Command Time Budgets). If an apply fails or runs long, report it as "did not complete", record the state in the phase plan, and stop. Do not retry destructive steps or roll back on your own.db-schema.md. Use the plan from backend-db-design or backend-implement when one was handed over. Output: the before and after schema, in a few lines.## Migration Phases entry in deployment.md, a decisions.md entry, and docs/runbooks/migration-<slug>.md with order of releases, commands, timeouts, parity checks, backup gate and rollback path.db-schema.md, mark columns pending contract as deprecated there, and close the checkpoint.Done when: migrations, down migrations and any backfill are written and labeled; local verification ran (or each skipped check is reported with the reason); the phase plan entry, decisions entry and runbook exist; any approved apply is recorded with migration IDs; db-schema.md is updated; and the checkpoint is closed.
backend-deploy reads the phase plan, not this skill's prose. Each migration must carry:
expand (old and new code both work), contract (only new code works) or backfill.pre-deploy (expand: runs as one gated step before the app rollout, from a single runner holding the migration lock, never from every replica at startup), post-deploy (contract: only after every instance runs the new code, in a later release, after the Contract Gate passes), or job (long backfills, after dual-write is live).Track the change across releases in the ## Migration Phases entry (status: planned, expand-applied, dual-write-live, backfilled, reads-switched, old-writes-stopped, contract-ready, contracted, abandoned) and keep the decisions.md entry's status in step. Every later run reads this first and resumes at the next phase.
| Output | Path |
|---|---|
| Migration and down files | the project's migrations directory, tool naming convention |
| Backfill script or job | project convention, else scripts/backfills/<slug>.<ext> |
| Runbook | docs/runbooks/migration-<slug>.md |
| Phase plan | .opencode/everything-backend-memory/deployment.md -> ## Migration Phases |
| Decision record | .opencode/everything-backend-memory/decisions.md |
| Updated schema | .opencode/everything-backend-memory/db-schema.md |
The memory folder path is the same on every host.
Start a checkpoint before the first edit:
node <shared>/scripts/checkpoint.js start --skill backend-migrate --feature <slug>
Record each file you create or edit (checkpoint.js record --skill backend-migrate --feature <slug> --created a,b --modified c,d, plus --memory <file> for memory updates and --done <step> per finished step), run checkpoint.js snapshot after each step, and checkpoint.js close when done. If start exits with code 3, an open checkpoint exists: offer to resume it or restart with --restart. If Node is unavailable, follow <shared>/tool-rules.md -> Concurrent & Partial Work by hand.
Close the checkpoint as completed only after the rollback path is verified: the down migration passed the up, down, up check (Workflow step 6), or, for a one-way step, the forward-fix or restore path is written in the runbook. If the down check could not run (no disposable database), mark the phase plan entry "rollback path unverified" and say so in the report before closing; never close as if the rollback were proven.
File rollback (checkpoint.js rollback) only reverts files. It does not undo a migration already applied to a database. For an applied migration, propose its down migration or a forward-fix migration (Always Ask First), using the migration IDs recorded in the phase plan, and only then offer to revert the files.
EXECUTE, loops over partitions or tenant schemas, raw SQL in a migration hook).<shared>/sql-safety.md: read before writing any migration, backfill or trigger that contains SQL beyond constant DDL.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub codeworksid/everything-backend --plugin everything-backend16 skills in this plugin
/backend-api-designDesigns API contracts before code is written: resources, endpoints, request and response schemas, error format, pagination, versioning and per-endpoint authorization rules. Writes the contract to an OpenAPI spec (docs/api/openapi.yaml by default, or the existing spec) and records conventions in api-patterns.md memory. REST is fully covered; GraphQL schemas and gRPC .proto contracts get basic guidance. Use when the user says 'design the API', 'what endpoints do I need', 'plan routes', 'write an OpenAPI spec', 'Swagger', 'define the API contract', 'design a GraphQL schema', 'write a proto file', 'add an endpoint to the spec', or 'version or deprecate an endpoint'. Not for writing handler code (backend-implement), choosing the login mechanism or auth endpoints (backend-auth), or reviewing API security (backend-security)./backend-architectDesigns backend architecture for new and existing systems, including architecture pattern (monolith, modular monolith, microservices, serverless), tech stack, module boundaries, consistency rules and non-functional targets, then records the result as docs/architecture/overview.md, numbered ADR files in docs/adr/ and project memory. Use when the user says "design the architecture", "plan the backend", "how should I structure this", "what tech stack should I use", "should we split into microservices", "write an ADR", "redesign this system", or is starting a new project or a major feature. Hands diagrams to backend-visualize and detailed schema and API work to backend-db-design and backend-api-design.Other plugins' skills for the same job