Getting Started with Laravel Boost: AI-Assisted Development with Deep Context
Overview
Prerequisites
To follow this tutorial, you should have a baseline understanding of the
Key Libraries & Tools
- Laravel Boost: The core package providing the MCP server and specialized guidelines.
- Claude Code: An AI agent capable of executing terminal commands and modifying files.
- Tinker: An interactive REPL forLaravel, used by Boost to safely test PHP code snippets.
- MCP Server: A standardized protocol that allows AI agents to use external tools and data sources.
Code Walkthrough
Installing the package requires a simple dev-dependency addition via
composer require laravel/boost --dev
php artisan boost:install
During installation, the tool prompts you to select your preferred editor and agent. This process generates specific configuration files, such as .claudemdrules or cursor.rules, which contain tailored instructions for the AI regarding your
Boost also enables a set of powerful tools. For example, when debugging an N+1 query issue, the AI can utilize the search-docs tool to find the most recent documentation for
// In AppServiceProvider.php
public function boot(): void
{
Model::shouldBeStrict(! $this->app->isProduction());
// Laravel 12 feature for automatic eager loading
Model::preventsLazyLoading(! $this->app->isProduction());
}
Syntax Notes
Boost relies heavily on Markdown-based guidelines. It scans your project for a custom AI-guidelines directory and injects your specific business logic or coding standards into the AI's prompt. This ensures the agent follows your unique architectural patterns rather than just generic boilerplate.
Practical Examples
- Database Seeding: Ask your agent to "add a new feature to the database," and it will use Tinkerto create models, categories, and relationships without you writing a single line of SQL.
- Error Resolution: If your application crashes due to a missing
APP_KEY, the agent can read theLaravellogs directly and perform the fix automatically.
Tips & Gotchas
Always verify the database-schema and tinker tools.
