PHPackages                             devsite/claude-skill-laravel-migration-searcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. devsite/claude-skill-laravel-migration-searcher

ActiveLibrary[Search &amp; Filtering](/categories/search)

devsite/claude-skill-laravel-migration-searcher
===============================================

Intelligent Laravel migration indexer with Claude AI integration. Automatically analyzes and indexes all migrations for instant search and debugging.

v3.0.2(2mo ago)0252↓28.3%MITPHPPHP ^8.3

Since Feb 23Pushed 2mo agoCompare

[ Source](https://github.com/AdrianKuriata/claude-skill-laravel-migration-searcher)[ Packagist](https://packagist.org/packages/devsite/claude-skill-laravel-migration-searcher)[ RSS](/packages/devsite-claude-skill-laravel-migration-searcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (17)Used By (0)

Laravel Migration Searcher
==========================

[](#laravel-migration-searcher)

[![Total Downloads](https://camo.githubusercontent.com/0a4c0ff061bef207c0723ba9b08227340fbc74f3249cf39abbd8b2b72e6114a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576736974652f636c617564652d736b696c6c2d6c61726176656c2d6d6967726174696f6e2d7365617263686572)](https://packagist.org/packages/devsite/claude-skill-laravel-migration-searcher)[![Latest Stable Version](https://camo.githubusercontent.com/aa7310781b7409ef5d09a1797e15222cd701e7a3f3cada468946bd92d46e74be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646576736974652f636c617564652d736b696c6c2d6c61726176656c2d6d6967726174696f6e2d7365617263686572)](https://packagist.org/packages/devsite/claude-skill-laravel-migration-searcher)[![License](https://camo.githubusercontent.com/16c6ca054b1b887f0865e49f3da89661a6591e651859357959e053f1cdc8bc2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646576736974652f636c617564652d736b696c6c2d6c61726176656c2d6d6967726174696f6e2d7365617263686572)](https://packagist.org/packages/devsite/claude-skill-laravel-migration-searcher)

Intelligent Laravel migration indexer with Claude AI integration. Automatically analyzes and indexes all migrations for instant search and debugging.

Why This Package?
-----------------

[](#why-this-package)

**Problem:** You have hundreds or thousands of migrations. Finding specific migrations is time-consuming and error-prone.

**Solution:** This package automatically analyzes **all** migrations and creates searchable markdown indexes that Claude AI (or you) can query instantly.

Features
--------

[](#features)

- **Deep Analysis** - Analyzes DDL, DML, Raw SQL, Eloquent operations, loops
- **Multiple Views** - Chronological, by-type, by-table, by-operation indexes
- **Claude AI Integration** - Ships with SKILL.md template for Claude AI workflow
- **Complexity Scoring** - Each migration gets a 1-10 complexity score
- **Multiple Formats** - Markdown and JSON output formats
- **Configurable** - Support for custom migration paths and types
- **Team-Friendly** - Commit indexes to git, whole team benefits
- **Zero Dependencies** - Only Laravel required

What It Analyzes
----------------

[](#what-it-analyzes)

The package performs comprehensive static analysis of each migration file:

### DDL Operations (Structure)

[](#ddl-operations-structure)

- CREATE/ALTER/DROP/RENAME tables
- Column definitions with types and modifiers (nullable, default, unique, etc.)
- Indexes (index, unique, primary)
- Foreign keys with dependency tracking

### DML Operations (Data)

[](#dml-operations-data)

- INSERT/UPDATE/DELETE via `DB::table()`
- WHERE conditions - `where`, `whereIn`, `whereNotIn`, `whereNull`, `whereNotNull`, `whereBetween`, `whereHas`, `whereDoesntHave`, `orWhere`
- Columns modified in UPDATE operations
- `DB::raw` expressions (CASE WHEN, subqueries, etc.)
- Eloquent operations - `Model::create()`, `->save()`, `->delete()`
- Relationship operations - `->relation()->create()`, `->relation()->createMany()`
- Operations inside loops (foreach with save/create/delete/update)

### Raw SQL

[](#raw-sql)

- `DB::statement()` - complete SQL queries
- `DB::unprepared()` - full SQL code
- `DB::raw()` expressions
- Heredoc/Nowdoc SQL blocks
- Auto-detected operation type (SELECT/INSERT/UPDATE/DELETE/CREATE/ALTER/DROP/TRUNCATE)

Installation
------------

[](#installation)

```
composer require devsite/claude-skill-laravel-migration-searcher
```

Publish configuration:

```
php artisan vendor:publish --tag=migration-searcher-config
```

Publish skill template (optional - auto-copied on first run):

```
php artisan vendor:publish --tag=migration-searcher-skill
```

Configuration
-------------

[](#configuration)

Edit `config/migration-searcher.php`:

```
return [
    // Where indexes will be generated (relative to project root)
    'output_path' => '.claude/skills/laravel-migration-searcher',

    // Define your migration types
    'migration_types' => [
        'default' => [
            'path' => 'database/migrations',
        ],
    ],

    // Custom format-to-renderer mapping (extends built-in markdown/json)
    'formats' => [],

    // Default output format: 'markdown' or 'json'
    'default_format' => 'markdown',

    // Maximum file size in bytes for migration analysis (default: 5MB)
    'max_file_size' => 5242880,
];
```

Usage
-----

[](#usage)

### Generate Index

[](#generate-index)

```
# Index all migrations
php artisan migrations:index

# Generate JSON format instead of markdown
php artisan migrations:index --format=json

# Refresh existing index (deletes and regenerates)
php artisan migrations:index --refresh

# Index specific type only
php artisan migrations:index --type=default

# Custom output path
php artisan migrations:index --output=/custom/path
```

### Generated Output

[](#generated-output)

Default (markdown):

```
.claude/skills/laravel-migration-searcher/
├── SKILL.md               # Instructions for Claude AI
├── index-full.md          # Chronological list with full details
├── index-by-type.md       # Grouped by migration type
├── index-by-table.md      # Grouped by database table
├── index-by-operation.md  # Grouped by operation (CREATE/ALTER/DROP/DATA/RENAME)
└── stats.md               # Statistics and metadata

```

With `--format=json`:

```
.claude/skills/laravel-migration-searcher/
├── SKILL.md               # Instructions for Claude AI
├── index-full.json        # Chronological list with full details
├── index-by-type.json     # Grouped by migration type
├── index-by-table.json    # Grouped by database table
├── index-by-operation.json # Grouped by operation
└── stats.json             # Statistics and metadata

```

### Using with Claude AI

[](#using-with-claude-ai)

1. Generate index:

    ```
    php artisan migrations:index
    ```
2. Upload to Claude:

    - Upload files from `.claude/skills/laravel-migration-searcher/` to claude.ai
    - Or use Claude Code with local file access
3. Ask Claude:

    ```
    "Find the migration that adds subscription_plan column"
    "Which migration deletes records from orders?"
    "Show all migrations with DB::raw"
    "What will break if I remove the create_users migration?"

    ```

Configuration Examples
----------------------

[](#configuration-examples)

### Multi-Tenant Application

[](#multi-tenant-application)

```
'migration_types' => [
    'system' => [
        'path' => 'database/migrations',
    ],
    'tenant' => [
        'path' => 'database/tenant-migrations',
    ],
],
```

### Modular Application

[](#modular-application)

```
'migration_types' => [
    'core' => [
        'path' => 'database/migrations',
    ],
    'modules' => [
        'path' => 'modules/*/migrations',
    ],
],
```

### Data Import Workflow

[](#data-import-workflow)

```
'migration_types' => [
    'default' => [
        'path' => 'database/migrations',
    ],
    'import_before' => [
        'path' => 'database/import/before',
    ],
    'import_after' => [
        'path' => 'database/import/after',
    ],
],
```

Team Workflow
-------------

[](#team-workflow)

### Initial Setup

[](#initial-setup)

```
composer require devsite/claude-skill-laravel-migration-searcher
php artisan vendor:publish --tag=migration-searcher-config
php artisan migrations:index
git add .claude/ config/migration-searcher.php
git commit -m "Add migration indexer"
git push
```

### Other Team Members

[](#other-team-members)

```
git pull
# Index is already in the repo - upload to Claude or use Claude Code
```

### After Adding/Modifying Migrations

[](#after-addingmodifying-migrations)

```
php artisan migrations:index --refresh
git add .claude/
git commit -m "Refresh migration index"
```

Index Entry Example
-------------------

[](#index-entry-example)

Each migration in the full index contains:

```
### 2024_01_15_143022_add_subscription_plan_to_users.php

**Type:** default
**Path:** database/migrations/2024_01_15_143022_add_subscription_plan_to_users.php
**Timestamp:** 2024_01_15_143022
**Complexity:** 3/10

**Tables:**
- `users` (ALTER)

**Columns:**
- `subscription_plan` (string [nullable])
- `subscription_expires_at` (timestamp [nullable])

**DDL Operations:**
- **column_create:** 2 operations

**DML Operations:**
- **UPDATE** on `users`
  - WHERE: subscription_plan IS NULL
  - Columns: subscription_plan
  - Data: ['subscription_plan' => 'free']
```

Architecture
------------

[](#architecture)

The package follows SOLID principles with a clean separation of concerns:

```
src/
├── Console/
│   └── Commands/
│       └── IndexMigrationsCommand.php    # Constructor injection via DI
├── Contracts/                             # Interfaces (no Interface suffix)
│   ├── Parsers/
│   │   ├── ContentParser.php
│   │   ├── DdlParser.php
│   │   ├── DmlParser.php
│   │   ├── RawSqlParser.php
│   │   ├── DependencyParser.php
│   │   └── TableDetector.php
│   ├── Renderers/
│   │   ├── Renderer.php                  # Output format contract
│   │   ├── RendererResolver.php          # Format resolution contract
│   │   └── MarkdownMigrationFormatter.php
│   ├── Services/
│   │   ├── MigrationAnalyzer.php
│   │   ├── ComplexityCalculator.php
│   │   ├── PathValidator.php             # Path security contract
│   │   ├── IndexGenerator.php
│   │   ├── IndexGeneratorFactory.php
│   │   ├── IndexDataBuilder.php          # Data preparation contract
│   │   └── TextSanitizer.php
│   ├── Support/
│   │   ├── MigrationFileInfo.php         # Filename parsing and path resolution contract
│   │   └── ScalarValueObject.php
│   └── Writers/
│       └── FileWriter.php
├── DTOs/
│   ├── BaseDTO.php                       # Abstract base with Arrayable + reflection toArray()
│   └── MigrationAnalysisResult.php       # Typed immutable analysis output
├── Parsers/
│   ├── DdlParser.php                     # Columns, indexes, foreign keys, DDL ops
│   ├── DependencyParser.php              # @requires, @depends_on, FK dependencies
│   ├── DmlParser.php                     # INSERT/UPDATE/DELETE, Eloquent, loops
│   ├── RawSqlParser.php                  # DB::statement, unprepared, raw, heredoc
│   └── TableDetector.php                 # Schema::create/table/drop/rename, DB::table
├── Renderers/
│   ├── JsonRenderer.php                  # Formats structured data as JSON
│   ├── MarkdownMigrationFormatter.php    # Migration formatting helpers for markdown
│   └── MarkdownRenderer.php              # Formats structured data as markdown
├── Services/
│   ├── ComplexityCalculator.php          # Pure function: calculates 1-10 score
│   ├── HtmlSanitizer.php                # HTML entity escaping (implements TextSanitizer)
│   ├── IndexDataBuilder.php              # Sorts, groups, calculates stats
│   ├── IndexGenerator.php                # Orchestrates data builder + renderer + writer
│   ├── MigrationAnalyzer.php             # Orchestrates parsers
│   ├── PathValidator.php                 # Path traversal protection
│   └── RendererResolver.php              # Config-based format resolution
├── Support/
│   └── MigrationFileInfo.php            # Timestamp, name, relative path (implements MigrationFileInfo contract)
├── Writers/
│   └── IndexFileWriter.php              # File I/O (implements FileWriter)
└── MigrationSearcherServiceProvider.php  # Registers interface bindings

```

Data flows through a clean pipeline: raw migrations → `MigrationAnalyzer` (returns `MigrationAnalysisResult` DTO) → `toArray()` → `IndexDataBuilder` (sort, group, stats) → `Renderer` (format to markdown/JSON) → file output. Adding a new format requires only a new class implementing `Renderer` and registering it in the `formats` config key.

All constructor dependencies are required (non-nullable) — no fallbacks to concrete implementations. All contracts are bound in the service provider, making it easy to swap implementations or mock in tests.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11.x or 12.x

Testing
-------

[](#testing)

```
docker compose -f docker-compose.test.yml run --rm tests
```

### Code Coverage

[](#code-coverage)

Generate an HTML coverage report (requires PCOV, included in the Docker image):

```
docker compose -f docker-compose.test.yml run --rm coverage
```

The report will be available in the `./coverage/` directory. Open `coverage/index.html` in a browser to inspect line-by-line coverage.

### Code Style

[](#code-style)

This project uses [Laravel Pint](https://laravel.com/docs/pint) with the PSR-12 preset.

Check formatting:

```
docker compose -f docker-compose.test.yml run --rm pint
```

Fix formatting locally:

```
docker compose -f docker-compose.test.yml run --rm --no-deps pint bash -c "composer install --no-interaction && vendor/bin/pint"
```

### Static Analysis

[](#static-analysis)

This project uses [PHPStan](https://phpstan.org/) at level 0.

Run analysis:

```
docker compose -f docker-compose.test.yml run --rm phpstan
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Support
-------

[](#support)

- Issues: [GitHub Issues](https://github.com/AdrianKuriata/claude-skill-laravel-migration-searcher/issues)
- Questions: Open a discussion on GitHub

Author
------

[](#author)

**Adrian Kuriata** - [GitHub](https://github.com/AdrianKuriata)

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance86

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

16

Last Release

73d ago

Major Versions

v1.3.0 → v2.0.02026-02-25

v2.6.0 → v3.0.02026-03-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/e9ccb8ca2f5be90c59bdd35f5e1de089395bc7924f60cf278a633cc33fd30c8b?d=identicon)[adriandj83](/maintainers/adriandj83)

---

Top Contributors

[![AdrianKuriata](https://avatars.githubusercontent.com/u/15891825?v=4)](https://github.com/AdrianKuriata "AdrianKuriata (34 commits)")

---

Tags

searchlaravelaimigrationsindexerclaudedeveloper-tools

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/devsite-claude-skill-laravel-migration-searcher/health.svg)

```
[![Health](https://phpackages.com/badges/devsite-claude-skill-laravel-migration-searcher/health.svg)](https://phpackages.com/packages/devsite-claude-skill-laravel-migration-searcher)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.3M6](/packages/algolia-scout-extended)[vanry/laravel-scout-tntsearch

包含中文分词的 Laravel Scout TNTSearch 驱动，支持 scws, phpanalysis 和 jieba 分词。

17811.8k1](/packages/vanry-laravel-scout-tntsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
