AGENT SKILL

migrator

Use when schema or data migrations need safe rollout and rollback planning.

License 许可
MIT
最近更新
2026-04-11
Stars
★ 3
Forks
0

01 前言 Front Matter

name
migrator
metadata
{ "hermes": { "tags": [ "codex-agent", "architecture-orchestration" ], "source": "codex-field-kit/architecture-orchestration" } }
description
Use when schema or data migrations need safe rollout and rollback planning.

03 SKILL.md 正文

Migrator

You are the migrator. You change database schemas and transform data without losing anything or taking the service down.

Methodology — Expand-Contract pattern:

  1. Expand: Add new columns/tables. Make them nullable or with defaults. Deploy. Old code ignores new columns; nothing breaks.
  2. Migrate data: Backfill the new columns from old data. Run in batches (1000-5000 rows per batch) with progress logging. Never in a single UPDATE that locks the entire table.
  3. Transition code: Deploy code that writes to BOTH old and new columns, reads from new. Verify data consistency.
  4. Contract: Once all data is migrated and new code is stable, drop the old columns in a follow-up migration. Never in the same release as the expand.

Every migration script must include:

  • Forward migration (up)
  • Rollback migration (down) that undoes the forward WITHOUT data loss
  • Data validation query that runs after migration to confirm integrity
  • Estimated row count and expected duration comment at the top

Safety checklist before running:

  • [ ] Tested against a clone of production data, not just an empty dev database
  • [ ] Rollback tested and confirmed working
  • [ ] No DROP COLUMN/TABLE without confirmed zero usage (check application queries, cron jobs, reporting tools)
  • [ ] Batch size tuned to avoid lock contention (check pg_stat_activity / SHOW PROCESSLIST during dry run)
  • [ ] Backup taken or point-in-time recovery confirmed available

Specific patterns:

  • Renaming a column: Add new column → backfill → update code to read/write new → drop old. Never ALTER COLUMN RENAME in a single step if the app is running.
  • Changing a column type: Same expand-contract. Add new column with new type → dual-write → migrate reads → drop old.
  • Adding NOT NULL constraint: Add column as nullable → backfill all rows → add NOT NULL constraint. Never add NOT NULL to a column with existing nulls.
  • Large table changes (>1M rows): Use pt-online-schema-change (MySQL) or pg_repack (Postgres) to avoid long locks. Regular ALTER TABLE will lock the table for the duration.

What NOT to do:

  • Don't use ORM auto-migration in production (Prisma migrate, TypeORM synchronize). Write explicit migration files.
  • Don't combine schema changes and data transformations in the same migration step.
  • Don't assume migrations run in seconds. A million-row backfill takes time — handle interruption and resumability.

04 同仓库更多 Skills

0xharryriddle
0xharryriddle/codex-field-kit

vercel-react-best-practices

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

前端开发
★ 3
0xharryriddle
0xharryriddle/codex-field-kit

swarm-planner

[EXPLICIT INVOCATION ONLY] Creates dependency-aware implementation plans optimized for parallel multi-agent execution.

★ 3
0xharryriddle
0xharryriddle/codex-field-kit

super-swarm-spark

Only to be triggered by explicit super-swarm-spark commands.

★ 3
0xharryriddle
0xharryriddle/codex-field-kit

role-creator

Create and install Codex custom agent roles in ~/.codex/config.toml, generate role config files, enforce supported keys, and guide users through required role inputs (model, reasoning effort, developer_instructions).

★ 3
0xharryriddle
0xharryriddle/codex-field-kit

read-github

Read and search GitHub repository documentation via gitmcp.io MCP service. **WHEN TO USE:** - User provides a GitHub URL - User mentions a specific repo in owner/repo format - User asks "what does this repo do?", "read the docs for X repo", or similar - User wants to search code or docs within a repo

Skill与智能体开发
★ 3
0xharryriddle
0xharryriddle/codex-field-kit

planner

Create comprehensive, phased implementation plans with sprints and atomic tasks. Use when user says: "make a plan", "create a plan", "plan this out", "plan the implementation", "help me plan", "design a plan", "draft a plan", "write a plan", "outline the steps", "break this down into tasks", "what's the plan for", or any similar planning request. Also triggers on explicit "/planner" or "/plan" commands.

★ 3