lc-consolidate-migrations
Analyze and consolidate fragmented Laravel migration files. Groups by table, detects dependencies, proposes safe merges.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Analyze and consolidate fragmented Laravel migration files. Groups by table, detects dependencies, proposes safe merges.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | lc:consolidate-migrations |
| description | Analyze and consolidate fragmented Laravel migration files. Groups by table, detects dependencies, proposes safe merges. |
| argument-hint | [analyze | fix | fix --dry-run | table-name | fix table-name] |
| user-invocable | true |
| allowed-tools | Read Grep Bash Edit Write Glob |
Analyze and consolidate fragmented migration files for Laravel projects. Multiple migrations that modify the same table over time can be merged into a single clean migration.
| Subcommand | Description |
|---|---|
| (no argument) | Analyze all migrations and report consolidation opportunities. Read-only. |
fix | Consolidate all tables classified as SAFE_TO_MERGE. Asks for confirmation before each change. |
fix --dry-run | Show what consolidation would produce without writing any files. |
[table-name] | Analyze migrations for a specific table only. |
fix [table-name] | Consolidate migrations for a specific table, with confirmation. |
analyze)Perform a read-only analysis of all migration files.
Steps:
Glob to find database/migrations/*.php files.Read to extract:
Schema::create('table_name', ...) -- table creationSchema::table('table_name', ...) -- table modificationSchema::dropIfExists('table_name') -- table dropSchema::rename('old', 'new') -- table renameDB::statement(...) or DB::table(...)->update(...) -- data migrations->foreign(...), ->foreignId(...), ->constrained(...), and ->references(...)->on(...) calls.Table | Migrations | Category | Notes
-----------------------|------------|-------------------|---------------------------
users | 5 | SAFE_TO_MERGE | 4 ALTER migrations
properties | 8 | MERGE_WITH_CAUTION| 2 data migrations found
locations | 2 | DO_NOT_MERGE | SQL data import in migration
clients | 1 | ALREADY_OPTIMAL |
fix or fix [table-name])Consolidate migrations, asking for confirmation before each change.
Steps:
[table-name] is specified, operate on all SAFE_TO_MERGE tables. If a table name is given, operate on that table only.php -l on every new migration file to validate syntax.fix --dry-run)Show what each consolidated migration would look like, without writing any files.
Steps:
[table-name])Analyze migrations for a specific table.
Steps:
When consolidating migrations for a table:
$table->string('name') in CREATE + $table->string('name', 500)->change() in ALTER = $table->string('name', 500) in final$table->string('temp') in CREATE + $table->dropColumn('temp') in ALTER = column removed from finalWrite, replacing the original CREATE file.php -l on the consolidated file via Bash.down() method logic. The consolidated down() should drop the table entirely.database/schema/*.sql). If one exists, warn the user that consolidation may conflict with the schema dump.If a docker-compose.yml exists in the project root, use docker exec {container_name} php -l {file} for PHP syntax validation. Detect the container name from the docker-compose.yml service configuration (look for the PHP/app service).
Always provide clear, structured output. Use tables for summaries. Show file paths as absolute paths. When showing migration content, use syntax-highlighted PHP code blocks.
Create a Larascraper scraper (v2 or v3) for a target website, chaining browser actions (click, type, wait, scroll), conditional flow (when/repeatUntil), captcha solving, and file/PDF downloads. Detects the installed major and generates the matching style.
Add or edit a Laracrate file collection in config/laracrate.php with the correct anatomy (disk, access, types, variants, previews, extract/embed, flags, per-model scoping).
Runtime-verified Laravel inspection using the Laravel Boost MCP server (Tinker, Database Query/Schema, Last Error) instead of static grep. Falls back to Docker/Tinker if Boost is not installed.
Scaffold spatie/laravel-permission setup - add the HasRoles trait to a model and generate a roles & permissions seeder.
Audit spatie/laravel-permission usage - permissions used in code but undefined, defined but unused, unprotected routes, guard mismatches, and cache pitfalls.
Extract business logic from a controller or Livewire component method into a Laractions Action class.