skills/team/php-migration-manager/SKILL.md
Manages the full Laravel database migration lifecycle with safety checks and rollback planning (PHP analog of ef-/alembic-/sqlx-migration-manager). Covers create, review, apply, and rollback; enforces a reversible down(), expand-contract for zero-downtime changes, and guards against destructive operations in production. Use when creating or reviewing Laravel migrations, planning a schema change, applying/rolling back, or designing a zero-downtime migration.
npx skillsauth add michaelalber/ai-toolkit php-migration-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
"A migration you cannot roll back is a deployment you cannot reverse."
"Schema changes are the riskiest deploys you make. Treat them that way."
Laravel migrations are version control for the database. This skill manages their full lifecycle — create → review → test rollback → apply → verify — with safety gates between each step. A migration is code that runs against production data exactly once per environment; a mistake is not a failed build, it is corrupted or destroyed data.
The central discipline is reversibility. Every up() has a matching down() that returns the schema
to its prior state. The central risk is destructive change on a live table: dropping a column,
renaming, or adding a non-nullable column with no default while the old code still runs. For those, the
expand-contract pattern (a.k.a. parallel change) replaces a single dangerous migration with a safe
sequence across multiple deploys.
Non-Negotiable Constraints:
up() has a tested down() — rollback is verified, not assumedmigrate:fresh / migrate:refresh / wipe are forbidden against any shared or production DBartisan migrate runsUPDATE on a large tableThe full domain principles, knowledge-base lookups, and anti-pattern catalog live in
references/domain-principles-and-anti-patterns.md. The AI discipline rules and error-recovery
procedures live in references/discipline-and-recovery.md.
php artisan make:migration create_orders_table # new table
php artisan make:migration add_phone_to_users_table # alter
Write both up() and down(). Prefer additive, nullable changes. See
references/migration-safety-checklist.md for column-by-column guidance.
Read the migration and risk-rate it before applying. Classify each operation as
SAFE / CAUTION / DANGEROUS using references/dangerous-operations.md. Produce the Migration Review
report (see references/output-templates.md). DANGEROUS operations require an expand-contract plan.
Apply and immediately roll back in a scratch database to prove down() works.
php artisan migrate --database=scratch
php artisan migrate:rollback --database=scratch --step=1
php artisan migrate:status --database=scratch
If down() errors or leaves residue, fix it before going further.
php artisan migrate --step # records each migration separately for granular rollback
php artisan migrate:status
Confirm the schema, run the backfill (batched), and re-run the app's test suite. Produce the
Post-Apply Verification report (see references/output-templates.md).
<php-migration-manager-state>
phase: CREATE | REVIEW | TEST_ROLLBACK | APPLY | VERIFY | COMPLETE
migration: [migration file]
laravel_version: [detected]
operation_class: SAFE | CAUTION | DANGEROUS
expand_contract_required: true | false
down_method_present: true | false
rollback_tested: true | false
backfill_required: true | false
applied: true | false
last_action: [description]
</php-migration-manager-state>
Two reports drive the lifecycle gates; full markdown templates are in references/output-templates.md:
| Skill | Relationship |
|-------|-------------|
| php-feature-slice | A new slice that needs schema changes uses this skill for the migration lifecycle. |
| php-architecture-checklist | The checklist flags missing down() and direct-SQL risks this skill prevents. |
| php-security-review | Reviews migrations for unsafe raw SQL and over-broad grants. |
| php-api-scaffolder | When an endpoint needs new tables/columns, sequence the migration before shipping the route. |
| tdd | Backfill logic and data transformations are driven test-first against a scratch database. |
development
Interviews the user relentlessly about a plan, decision, or idea — one question at a time, each with a recommended answer. Shared engine behind "grill-me" and "grill-with-docs". Use on any "grill" trigger phrase or to stress-test thinking. Do NOT use to build the plan; it ends at shared understanding, not implementation.
testing
Runs a relentless interview to sharpen a plan or design, capturing the decisions as ADRs and a glossary along the way. Use when the user wants to be grilled AND wants the session to leave durable domain documentation behind. Do NOT use for a throwaway stress-test with no artifacts; use grill-me instead.
tools
OWASP-based security review of Vue/TypeScript front-ends. Detects framework (Vite/Vue CLI/Nuxt), entry points, and data flows; scans the OWASP Top 10 (2025) mapped to Vue client-side risks (raw-HTML XSS via v-html, URL/protocol injection, bundled secrets, insecure token storage, dependency CVEs, missing CSP, open redirects, router guard bypass); emits an exec summary plus graded findings. Use to audit Vue for vulnerabilities. Not for architecture grading (vue-architecture-checklist).
tools
Analyzes legacy Vue codebases and produces actionable modernization plans. Primary migration paths include Options API to Composition API, Vue 2 to Vue 3, Vue CLI to Vite, JavaScript to TypeScript, Vue Test Utils/Karma/Mocha to Vitest + Vue Testing Library, legacy Vuex to Pinia, and removed-in-Vue-3 pattern cleanup (filters, event bus, `$listeners`). Does NOT perform the migration — assesses, quantifies risk, and plans.