Agent skill
ops-db-ops
Database migrations, reverts, schema generation, and GraphQL codegen for Expo + serverless backend projects. Operates on the backend (TypeORM) and frontend (GraphQL code generation).
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ops-db-ops
SKILL.md
Ops: Database Operations
Manage database migrations, schema generation, and GraphQL code generation.
Argument: $ARGUMENTS — operation (migrate, revert, generate, schema, codegen) and optional environment (default: dev)
Path Convention
- Frontend: Current project directory (
.) - Backend:
${BACKEND_DIR:-../backend-v2}— setBACKEND_DIRin.claude/settings.local.jsonif your backend is elsewhere
Safety
CRITICAL: Never run migrations or reverts against production without explicit human confirmation.
Discovery
Read the backend package.json to discover available migration and schema scripts:
migration:run:*— run pending migrationsmigration:revert:*— revert last migrationmigration:generate:*— generate new migration from entity changesmigration:create— create empty migrationgenerate:sql-schema*— regenerate SQL schema for MCPaws:signin:*— AWS credential scripts
Read the frontend package.json to discover codegen scripts:
fetch:graphql:schema:*— fetch GraphQL schemagenerate:types:*— generate TypeScript types
AWS Prerequisite
All database operations (except codegen) require AWS credentials. Run the backend's AWS signin script first:
cd "${BACKEND_DIR:-../backend-v2}"
bun run aws:signin:{env}
Operations
migrate (run pending migrations)
Local database:
cd "${BACKEND_DIR:-../backend-v2}"
STAGE={env} bun run migration:run:local
Remote database:
cd "${BACKEND_DIR:-../backend-v2}"
STAGE={env} bun run migration:run:remote:local
revert (undo last migration)
Local database:
cd "${BACKEND_DIR:-../backend-v2}"
STAGE={env} bun run migration:revert:local
Remote database:
cd "${BACKEND_DIR:-../backend-v2}"
STAGE={env} bun run migration:revert:remote:local
generate (create new migration from entity changes)
cd "${BACKEND_DIR:-../backend-v2}"
NAME={migration_name} bun run migration:generate:{env}
create (create empty migration)
cd "${BACKEND_DIR:-../backend-v2}"
NAME={migration_name} bun run migration:create
schema (regenerate SQL schema for MCP)
cd "${BACKEND_DIR:-../backend-v2}"
STAGE={env} bun run generate:sql-schema
codegen (regenerate GraphQL types in frontend)
-
Fetch schema:
bashbun run fetch:graphql:schema:{env} -
Generate types:
bashbun run generate:types:{env}
Note: The backend must be running (locally or deployed) for schema fetching to work.
Output Format
Report operation result:
| Operation | Environment | Target | Status | Details |
|---|---|---|---|---|
| migrate | dev | local DB | SUCCESS | 2 migrations applied |
| codegen | dev | frontend | SUCCESS | Types regenerated |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?