イントロダクションIntroduction
Laravelは、AI支援開発やエージェントによる開発において、最高のフレームワークとなる独自の地位を確立しています。Claude Code、OpenCode、Cursor、GitHub CopilotといったAIコーディングエージェントの台頭は、開発者のコード記述方法を一変させました。これらのツールは、これまでにないスピードで機能全体の生成、複雑な問題のデバッグ、コードのリファクタリングを実行できます。しかし、その効果はツールがあなたのコードベースをどれだけ深く理解しているかに大きく依存します。Laravel is uniquely positioned to be the best framework for AI assisted and agentic development. The rise of AI coding agents like Claude Code[https://docs.anthropic.com/en/docs/claude-code], OpenCode[https://opencode.ai], Cursor[https://cursor.com], and GitHub Copilot[https://github.com/features/copilot] has transformed how developers write code. These tools can generate entire features, debug complex issues, and refactor code at unprecedented speed - but their effectiveness depends heavily on how well they understand your codebase.
なぜAI開発にLaravelが最適なのか?Why Laravel for AI Development?
Laravelの規約を重視する設計(オピニオンな規約)と明確に定義された構造は、AI支援開発に理想的な環境を提供します。開発者がAIエージェントにコントローラの追加を依頼すると、AIはそれをどこに配置すべきか正確に判断します。新しいマイグレーションが必要な場合も、命名規則やファイルの場所を予測できます。この一貫性により、より柔軟なフレームワークでAIツールが陥りがちな「推測」という作業を排除します。Laravel's opinionated conventions and well-defined structure make it an ideal framework for AI assisted development. When you ask an AI agent to add a controller, it knows exactly where to place it. When you need a new migration, the naming conventions and file locations are predictable. This consistency eliminates the guesswork that often trips up AI tools in more flexible frameworks.
ファイル構成にとどまらず、Laravelの表現力豊かな構文と包括的なドキュメントは、AIエージェントが正確で慣習に沿った(イディオマティックな)コードを生成するために必要なコンテキスト(文脈)を与えます。Eloquentのリレーションシップ、フォームリクエスト、ミドルウェアなどの機能は、エージェントが確実に理解し、再現できるパターンに従っています。その結果、AIが生成するコードは、汎用的なPHPスニペットを繋ぎ合わせたものではなく、熟練したLaravel開発者が書いたような品質になります。Beyond file organization, Laravel's expressive syntax and comprehensive documentation give AI agents the context they need to generate accurate, idiomatic code. Features like Eloquent relationships, form requests, and middleware follow patterns that agents can reliably understand and replicate. The result is AI-generated code that looks like it was written by a seasoned Laravel developer, not stitched together from generic PHP snippets.
Laravel BoostLaravel Boost
Laravel Boostは、AIコーディングエージェントとあなたのLaravelアプリケーションの橋渡しをします。BoostはMCP(Model Context Protocol)サーバであり、15以上の専門的なツールを備えています。これらのツールは、アプリケーションの構造、データベース、ルートなどに関する深い洞察をAIエージェントに提供します。Boostをインストールすれば、AIエージェントは汎用的なコードアシスタントから、あなたのアプリケーションを具体的に理解したLaravelエキスパートへと進化します。Laravel Boost[https://github.com/laravel/boost] bridges the gap between AI coding agents and your Laravel application. Boost is an MCP (Model Context Protocol) server equipped with over 15 specialized tools that provide AI agents with deep insight into your application's structure, database, routes, and more. When you install Boost, your AI agent transforms from a general-purpose code assistant into a Laravel expert that understands your specific application.
Boostは3つの主要な機能を提供します。アプリケーションの検査や操作を行うためのMCPツール群、Laravelエコシステム向けに特別に作成した構成可能なAIガイドライン、そして17,000以上のLaravel固有のナレッジを含む強力なドキュメントAPIです。Boost provides three major capabilities: a suite of MCP tools for inspecting and interacting with your application, composable AI guidelines crafted specifically for the Laravel ecosystem, and a powerful documentation API containing over 17,000 pieces of Laravel-specific knowledge.
インストールInstallation
Boostは、PHP8.1以上で動作するLaravel10、11、12のアプリケーションにインストールできます。まずは、開発用依存パッケージとしてBoostをインストールしてください。Boost can be installed in Laravel 10, 11, and 12 applications running PHP 8.1 or higher. To get started, install Boost as a development dependency:
composer require laravel/boost --dev
インストール後、対話型インストーラを実行します。Once installed, run the interactive installer:
php artisan boost:install
インストーラがIDEとAIエージェントを自動検出し、プロジェクトに適した統合機能を選択できるようにします。Boostは、MCP対応エディタ用の.mcp.jsonや、AIのコンテキスト用ガイドラインファイルなどの必要な設定ファイルを生成します。The installer will auto-detect your IDE and AI agents, allowing you to select the integrations that make sense for your project. Boost will generate the necessary configuration files, such as .mcp.json for MCP-compatible editors and guideline files for AI context.
Note: 各開発者が独自の環境を構成したい場合は、生成される
.mcp.json、CLAUDE.md、boost.jsonなどの設定ファイルを.gitignoreへ安全に追加できます。[!NOTE] Generated configuration files like.mcp.json,CLAUDE.md, andboost.jsoncan be safely added to your.gitignoreif you prefer each developer to configure their own environment.
利用可能なツールAvailable Tools
Boostは、Model Context Protocol(MCP)を通じて、包括的なツールセットをAIエージェントへ公開します。これらのツールにより、エージェントはLaravelアプリケーションを深く理解し、操作できるようになります。Boost exposes a comprehensive set of tools to AI agents via the Model Context Protocol. These tools allow agents to deeply understand and interact with your Laravel application:
- アプリケーションのイントロスペクション - PHPやLaravelのバージョンを照会し、インストール済みパッケージを一覧表示し、アプリケーションの設定や環境変数を検査します。Application Introspection - Query your PHP and Laravel versions, list installed packages, and inspect your application's configuration and environment variables.
- データベースツール - 会話画面から離れることなく、データベーススキーマを検査し、読み取り専用クエリを実行し、データ構造を把握します。Database Tools - Inspect your database schema, execute read-only queries, and understand your data structure without leaving the conversation.
- ルート検査 - 登録されているすべてのルートを、関連するミドルウェア、コントローラ、パラメーターとともに一覧表示します。Route Inspection - List all registered routes with their middleware, controllers, and parameters.
- Artisanコマンド - 利用可能なArtisanコマンドとその引数を検出し、エージェントがタスクに最適なコマンドを提案・実行できるようにします。Artisan Commands - Discover available Artisan commands and their arguments, enabling agents to suggest and execute the right commands for your task.
- ログ分析 - アプリケーションのログファイルを読み込んで分析し、問題のデバッグを支援します。Log Analysis - Read and analyze your application's log files to help debug issues.
- ブラウザログ - Laravelのフロントエンドツールを使用した開発時に、ブラウザのコンソールログやエラーにアクセスします。Browser Logs - Access browser console logs and errors when developing with Laravel's frontend tools.
- Tinker統合 - Laravel Tinkerを経由してアプリケーションのコンテキスト内でPHPコードを実行し、エージェントが仮説をテストして動作を検証できるようにします。Tinker Integration - Execute PHP code in the context of your application via Laravel Tinker, allowing agents to test hypotheses and verify behavior.
- ドキュメント検索 - インストールされているパッケージのバージョンに合わせて調整された結果を用いて、Laravelエコシステムのドキュメントを検索します。Documentation Search - Search Laravel ecosystem documentation with results tailored to your installed package versions.
AIガイドラインAI Guidelines
Boostは、Laravelエコシステムのために特別に作られた包括的なAIガイドラインのセットを含みます。これらのガイドラインはAIエージェントへ、Laravelコードの慣用的な書き方、フレームワークの規約に従うこと、はまりがちな間違いの回避方法を教えます。ガイドラインは構成可能であり、バージョンを認識するため、エージェントは使用している正確なパッケージバージョンに適した指示を受け取ります。Boost includes a comprehensive set of AI guidelines specifically crafted for the Laravel ecosystem. These guidelines teach AI agents how to write idiomatic Laravel code, follow framework conventions, and avoid common pitfalls. Guidelines are composable and version-aware, meaning agents receive instructions appropriate for your exact package versions.
ガイドラインはLaravel自体に加え、以下を含むLaravelエコシステムの16以上のパッケージで利用可能です。Guidelines are available for Laravel itself and over 16 packages in the Laravel ecosystem, including:
- Livewire (2.x, 3.x, 4.x)Livewire (2.x, 3.x, and 4.x)
- Inertia.js (ReactおよびVueバリアント)Inertia.js (React and Vue variants)
- Tailwind CSS (3.xおよび4.x)Tailwind CSS (3.x and 4.x)
- Filament (3.xおよび4.x)Filament (3.x and 4.x)
- PHPUnitPHPUnit
- Pest PHPPest PHP
- Laravel PintLaravel Pint
- その他多数And many more
boost:installを実行すると、Boostはアプリケーションが使用しているパッケージを自動的に検出し、関連するガイドラインをプロジェクトのAIコンテキストファイルに組み込みます。When you run boost:install, Boost automatically detects which packages your application uses and assembles the relevant guidelines into your project's AI context files.
ドキュメント検索Documentation Search
Boostは、AIエージェントが17,000件を超えるLaravelエコシステムのドキュメントにアクセスできるようにする、強力なドキュメントAPIを備えています。一般的なWeb検索とは異なり、このドキュメントはインデックス化およびベクトル化されており、使用中の正確なパッケージバージョンに一致するようフィルタリングされています。Boost includes a powerful documentation API that gives AI agents access to over 17,000 pieces of Laravel ecosystem documentation. Unlike generic web searches, this documentation is indexed, vectorized, and filtered to match your exact package versions.
機能の仕組みを理解する必要がある場合、エージェントはBoostのドキュメントAPIを検索し、正確でバージョン固有の情報を受け取れます。これにより、AIエージェントが古いフレームワークバージョンの非推奨メソッドや構文を提案してしまうという、よくある問題を排除します。When an agent needs to understand how a feature works, it can search Boost's documentation API and receive accurate, version-specific information. This eliminates the common problem of AI agents suggesting deprecated methods or syntax from older framework versions.
IDEとの統合IDE Integration
Boostは、Model Context Protocolをサポートする一般的なIDEやAIツールと統合しています。いくつかの一般的なエディタでBoostを有効にする方法は以下の通りです。Boost integrates with popular IDEs and AI tools that support the Model Context Protocol. Here's how to enable Boost in a few popular editors:
// torchlight! {"lineNumbers": false}
Boostは通常、自動的に検出されます。手作業でのセットアップが必要な場合:
1. プロジェクトディレクトリでターミナルを開きます。
2. 次を実行します: claude mcp add laravel-boost -- php artisan boost:mcp
// torchlight! {"lineNumbers": false}
1. コマンドパレットを開きます (Cmd+Shift+P または Ctrl+Shift+P)。
2. 「MCP: Open Settings」を選択します。
3. 「laravel-boost」オプションをオンにします。
// torchlight! {"lineNumbers": false}
1. コマンドパレットを開きます (Cmd+Shift+P または Ctrl+Shift+P)。
2. 「MCP: List Servers」を選択します。
3. 「laravel-boost」に移動し、Enterキーを押します。
4. 「Start server」を選択します。
// torchlight! {"lineNumbers": false}
1. Shiftキーを2回押して「Search Everywhere」を開きます。
2. 「MCP Settings」を検索し、Enterキーを押します。
3. 「laravel-boost」の横にあるチェックボックスを有効にします。
4. 「Apply」をクリックします。
// torchlight! {"lineNumbers": false}
Boostは通常、自動的に検出されます。手作業でのセットアップが必要な場合:
1. プロジェクトディレクトリでターミナルを開きます。
2. 次を実行します: codex mcp add -- php artisan boost:mcp
// torchlight! {"lineNumbers": false}
Boostは通常、自動的に検出されます。手作業でのセットアップが必要な場合:
1. プロジェクトディレクトリでターミナルを開きます。
2. 次を実行します: gemini mcp add laravel-boost -- php artisan boost:mcp
カスタムBoostガイドラインCustom Boost Guidelines
Boostの組み込みガイドラインはLaravelエコシステムを包括的にカバーしていますが、AIエージェントに対してプロジェクト固有の指示を追加したい場合もあると思います。While Boost's built-in guidelines cover the Laravel ecosystem comprehensively, you may want to add project-specific instructions for your AI agents.
プロジェクトガイドラインの追加Adding Project Guidelines
プロジェクトにカスタムガイドラインを追加するには、アプリケーションの.ai/guidelinesディレクトリに.blade.phpまたは.mdファイルを作成してください。To add custom guidelines for your project, create .blade.php or .md files in your application's .ai/guidelines directory:
.ai/
└── guidelines/
└── api-conventions.md
├── architecture.md
├── testing-standards.blade.php
boost:install を実行すると、これらのファイルが自動的に取り込まれます。これらのガイドラインを使用して、チームのコーディング規約、アーキテクチャ上の決定事項、ドメイン固有の用語、あるいはAIエージェントがプロジェクトのためにより良いコードを書くのに役立つその他のコンテキストを文書化してください。These files will automatically be included when you run boost:install. Use these guidelines to document your team's coding standards, architectural decisions, domain-specific terminology, or any other context that would help AI agents write better code for your project.
パッケージガイドラインPackage Guidelines
Laravelパッケージをメンテナンスしていて、ユーザーへAIガイドラインを提供したい場合は、パッケージのresources/boost/guidelinesディレクトリへガイドラインを含めてください。If you maintain a Laravel package and want to provide AI guidelines for your users, you can include guidelines in your package's resources/boost/guidelines directory:
resources/
└── boost/
└── guidelines/
└── core.blade.php
AIガイドラインには、パッケージの概要、必要なファイル構造や規約、および主要機能の使用方法(コマンド例やコードスニペットを含む)を記載してください。AIがユーザーのために正しいコードを生成できるよう、簡潔かつ実践的で、ベストプラクティスに焦点を当てた内容に保ってください。以下に例を示します。AI guidelines should provide a short overview of what your package does, outline any required file structure or conventions, and explain how to create or use its main features (with example commands or code snippets). Keep them concise, actionable, and focused on best practices so AI can generate correct code for your users. Here is an example:
## パッケージ名
このパッケージは[機能の簡単な説明]を提供します。
### 機能
- 機能1: [明確で短い説明]。
- 機能2: [明確で短い説明]。使用例:
@verbatim
<code-snippet name="機能2の使い方" lang="php">
$result = PackageName::featureTwo($param1, $param2);
</code-snippet>
@endverbatim
ユーザーがあなたのパッケージを含むアプリケーションにBoostをインストールすると、Boostはガイドラインを自動的に検出し、ユーザーのAIコンテキストに含めます。これにより、パッケージ作成者は、AIエージェントがパッケージを適切に使用する方法を理解できるよう支援できます。When users install Boost in an application that includes your package, your guidelines will automatically be discovered and included in their AI context. This allows package authors to help AI agents understand how to properly use their packages.