php-migration-manager
Skill3 starsChanged 3 months agoMITView on GitHub
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.
In this repository86 other files it gives its agents.
- AGENTS.mdAGENTS.md
- project-templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- project-templates/CLAUDE.mdCLAUDE.md
- alembic-migration-managerSkill
- architecture-journalSkill
- architecture-reviewSkill
- automated-code-reviewSkill
- axum-scaffolderSkill
- capture-consolidateSkill
- cargo-package-scaffoldSkill
- code-review-coachSkill
- confluence-guide-writerSkill
- dependency-mapperSkill
- doc-syncSkill
- dotnet-architecture-checklistSkill
- dotnet-controller-api-scaffolderSkill
- dotnet-security-reviewSkill
- dotnet-vertical-sliceSkill
- ef-migration-managerSkill
- email-captureSkill
- environment-healthSkill
- evaluate-testsSkill
- fastapi-scaffolderSkill
- fitness-functionsSkill
- jira-comment-writerSkill
- legacy-migration-analyzerSkill
- minimal-api-scaffolderSkill
- nuget-package-scaffoldSkill
- oss-vettingSkill
- pattern-tradeoff-analyzerSkill
- php-api-scaffolderSkill
- php-architecture-checklistSkill
- php-feature-sliceSkill
- php-package-scaffoldSkill
- php-security-reviewSkill
- pr-feedback-writerSkill
- pypi-package-scaffoldSkill
- python-architecture-checklistSkill
- python-feature-sliceSkill
- python-modernization-analyzerSkill
- python-security-reviewSkill
- qraspi-architectureSkill
- qraspi-graduateSkill
- qraspi-implementSkill
- qraspi-planSkill
- qraspi-questionsSkill
- qraspi-researchSkill
- qraspi-skeletonSkill
- qrspi-implementSkill
- qrspi-planSkill
- qrspi-questionsSkill
- qrspi-researchSkill
- qrspi-specSkill
- react-app-scaffolderSkill
- react-architecture-checklistSkill
- react-component-scaffolderSkill
- react-feature-sliceSkill
- react-modernization-analyzerSkill
- react-security-reviewSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 53
Write both up() and down().
- Very specific: line 58
Read the migration and risk-rate it before applying.
- Very specific: line 72
If down() errors or leaves residue, fix it before going further.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PHP Migration Manager (Laravel)
"A migration you cannot roll back is a deployment you cannot reverse."
"Schema changes are the riskiest deploys you make. Treat them that way."
Core Philosophy
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:
- Every
up()has a testeddown()— rollback is verified, not assumed - No destructive operation without expand-contract on a table with live traffic
migrate:fresh/migrate:refresh/wipeare forbidden against any shared or production DB- Review before apply — a migration is read and risk-rated before
artisan migrateruns - Backfills are batched — never one unbounded
UPDATEon a large table - Indexes on large tables are added concurrently where the driver supports it
The 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.
Workflow
Phase 1: CREATE
php artisan make:migration create_orders_table # new table
php artisan make:migration add_phone_to_users_table # alterWrite both up() and down(). Prefer additive, nullable changes. See
references/migration-safety-checklist.md for column-by-column guidance.
Phase 2: REVIEW
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.
Phase 3: TEST ROLLBACK
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=scratchIf down() errors or leaves residue, fix it before going further.
Phase 4: APPLY
php artisan migrate --step # records each migration separately for granular rollback
php artisan migrate:statusPhase 5: VERIFY
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).
State Block
<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>Output Template
Two reports drive the lifecycle gates; full markdown templates are in references/output-templates.md:
- Migration Review — operation(s), risk class, reversibility, findings table, rollback plan, and the apply/backfill/expand-contract decision. Produced in Phase 2 before any apply.
- Post-Apply Verification — a checklist confirming the migration ran, schema matches intent, batched backfill reconciled, tests green, rollback rehearsed, and no long lock observed. Produced in Phase 5.
Integration with Other Skills
| 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-loop | Backfill logic and data transformations are driven test-first against a scratch database. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

