Mastering Laravel Boost 2.0: Optimizing AI Context with Skills and MCP
Overview: The Context Gap in AI Development
AI agents have changed how we write code, but they often struggle with the nuances of specific frameworks. Standard models like
Prerequisites
To follow this guide and implement Boost 2.0, you should be comfortable with the following:
- PHP 8.2+: Boost 2.0 has officially dropped support for PHP 8.1.
- Laravel 11 or 12: Older versions like Laravel 10are supported only by legacy versions of Boost (v1.x).
- Composer: Basic knowledge of managing PHP dependencies.
- AI Coding Agents: Familiarity with tools like Cursor,Claude Code,GitHub Copilot, orJuni.
Key Libraries & Tools
- Laravel Boost: The core CLI tool and package that manages AI context and skills.
- Laravel MCP: A package for building Model Context Protocolservers, allowing AI agents to interact with your app's internal state (routes, database schemas, etc.).
- Remotion: A React-based framework for programmatic video creation, often used as a demonstration of complex AI skill integration.
- Prism: A Laravelpackage for working with LLMs, used to demonstrate how documentation can be bundled directly into vendor folders for AI consumption.
Code Walkthrough: Installing and Configuring Boost 2.0
Setting up Boost 2.0 is a methodical process. It begins with the
1. Installation
First, ensure your
composer require laravel/boost --dev
2. Initialization
Run the install command to start the interactive configuration.
php artisan boost:install
This command triggers a CLI interface featuring randomized gradients—a touch of "developer joy" added by
3. Selecting Your AI Agent
Boost 2.0 simplifies agent selection. Instead of choosing both an IDE and an agent, you now choose the specific agentic tool you use daily, such as
4. Automated Skill Syncing
To ensure your AI context stays updated as your project evolves, add the update command to your composer.json file:
"scripts": {
"post-update-cmd": [
"@php artisan boost:update"
]
}
This ensures that every time you update your dependencies, Boost re-scans your composer.json and syncs the relevant skills for packages like
Deep Dive into Skills vs. Guidelines
Understanding the distinction between these two features is critical for a clean development workflow.
Guidelines: The Global Rules
Guidelines are persistent. They contain high-level rules that the AI should always know. For example, if you always use
Skills: The On-Demand Context
Skills are modular
Syntax Notes: Custom Skill Creation
Creating a custom skill allows you to automate highly specific tasks, like generating pull request descriptions or adhering to internal API versioning standards. Skills rely on a specific
---
name: my-custom-skill
description: Use this skill when generating API endpoints or PR descriptions.
---
# My Custom Skill Rules
- Always use the `App\Actions` namespace for business logic.
- Ensure all API responses are wrapped in a standard `JsonResource`.
- Pull Request descriptions must include a 'Breaking Changes' section.
When you save this in a local .boost/skills directory and run php artisan boost:update, Boost replicates this file into the hidden configuration folders of your chosen AI agents (e.g., .cursor/rules or .claudecode/skills).
Practical Examples
Automating Pull Requests
You can create a skill that teaches an agent how to use the /create-pr), the AI can analyze your staged changes, write a formatted description, and execute the CLI command to open the PR.
Package-Specific Intelligence
If you build a project using
Tips & Gotchas
- Git Management: Never commit the auto-generated agent folders (like
.cursor/rules) to your repository. These are local mirrors. Only commit the.boostfolder and yourboost.jsonfile. This allows your teammates to runboost:installand get the exact same AI behavior on their machines. - Hallucination Prevention: If your AI starts ignoring your project structure, check your guideline length. If it exceeds 500 lines, move package-specific rules into individual skills.
- Legacy Projects: Do not attempt to use Boost 2.0 on Laravel 10projects. The dependency tree for the newModel Context Protocolfeatures and skills requires the modern internals found inLaravel 11and up.
- Manual Invocation: If an agent fails to auto-detect a skill, you can usually force it by using a slash command in the chat interface. Most modern agents support
/to list and select active skills.
