Mastering Laravel Boost 2.0: Optimizing AI Context for Agentic Development

Overview: Why Your AI Agent Needs a Boost

AI models like

and
GPT-4
are powerful, but they arrive at your codebase as strangers. They possess a massive, static library of internet-scale training data, but they lack the specific, real-time context of your unique
Laravel
application. This gap often leads to what developers call "hallucinations"—code that looks correct but fails to follow your team's conventions or uses deprecated patterns.

is designed to solve this context deficiency. It acts as a bridge, packaging your application's routes, configuration, and coding standards into a format that AI agents can ingest and act upon. With the release of
Laravel Boost
, the focus has shifted from merely providing static instructions to implementing dynamic Skills and the Model Context Protocol (MCP). This evolution allows developers to manage the "Context Window"—the finite memory of an AI model—with surgical precision, ensuring the agent only sees what it needs to see to complete a specific task.

Prerequisites: Setting the Stage

To effectively implement

2.0, you should have a baseline understanding of the following:

  • Modern PHP & Laravel: Familiarity with
    PHP
    and
    Laravel
    is essential, as
    Laravel Boost
    has moved away from supporting older versions to utilize the latest framework features.
  • AI Coding Tools: You should be using an AI-capable editor or agent such as
    Claude Dev
    ,
    Cursor
    ,
    GitHub Copilot
    , or
    Windsurf
    .
  • Command Line Basics: You will need to interact with the terminal to run Artisan commands for installation and synchronization.

Key Libraries & Tools

  • Laravel Boost: The core package that manages guidelines, skills, and the MCP server for AI integration.
  • Laravel MCP: A foundational package that implements the
    Model Context Protocol
    , allowing external systems (like your app) to communicate with AI models.
  • Composer: Used for managing dependencies and third-party AI skills.
  • MCP Inspector: A utility for debugging the connection between your editor and the MCP server.

Code Walkthrough: Installation and Configuration

Setting up

2.0 is a methodical process. It begins with a standard installation and moves into configuring how the AI interacts with your files.

Step 1: Installation

Run the following command in your project root:

composer require laravel/boost --dev
php artisan boost:install

During installation, the CLI will prompt you to select which AI agents you are using (e.g.,

,
Claude
). This is critical because each agent looks for context in different locations—
Cursor
uses .cursorrules, while others might look for agents.md.

Step 2: Synchronizing Skills and Guidelines

Whenever you update your configuration or add custom rules, you must run the update command to rebuild the context files that the AI reads:

php artisan boost:update

This command scans your AI/guidelines and AI/skills directories, composing a unified markdown file (like claudedev.md) that represents the current state of your project's rules.

Step 3: Customizing Business Logic

One of the most powerful features of

is the ability to inject custom business context. You can publish the configuration file to unlock this:

php artisan vendor:publish --tag=boost-config

Inside config/boost.php, you can add a purpose key. This is where you tell the AI exactly what the app does—for example, "This project is a logistics platform for tracking international shipping containers."

return [
    'purpose' => 'A financial dashboard for tracking cryptocurrency tax compliance.',
    'coding_style' => 'Spatie',
    // ... other config
];

Syntax Notes: The Architecture of a Skill

A Skill in

is a specialized markdown file that the AI can "invoke" only when needed. This prevents the context window from being cluttered with irrelevant information. The syntax follows a specific pattern:

# Name: Inertia Vue Development
# Description: Use this skill when building or modifying Vue components within the Inertia.js stack.

## Implementation Guidelines
- Always use the <script setup> syntax.
- Utilize Tailwind CSS for all styling.
- Ensure all components are stored in the resources/js/Pages directory.

The AI reads the # Description to decide if the skill is relevant to your current prompt. If you ask to fix a CSS bug, it will pull in the Tailwind Skill but ignore the Database Skill, saving thousands of tokens.

Practical Examples: Real-World Agent Workflows

Automated Refactoring with Verification

Don't just ask an AI to refactor code; ask it to verify its work using the tools provided by

. A high-level prompt might look like this:

"Refactor the OrderController@store method to use a Form Request. Use the Laravel Skill for validation patterns. Once completed, use the Tinker Tool via MCP to create a test order and ensure the database record is created correctly."

Documentation Ingestion

If you are using a new package that the AI hasn't been trained on, you can use the search_docs tool provided by the

. The agent can query the latest
Laravel
documentation in real-time to find the correct syntax for
Laravel
features like
Pest
integration or the newest
Inertia.js
helpers.

Tips & Gotchas: Navigating the AI Frontier

  • The Context Trap: Be careful not to put too much in your guidelines. If your agents.md file becomes 10,000 lines long, the AI will lose the thread of your conversation. Move specific package logic into Skills so they are only loaded on demand.
  • Plan Mode First: Always use "Plan Mode" in your AI editor before letting it write code. This allows the agent to outline its approach based on the
    Laravel Boost
    guidelines before it commits to a file structure.
  • Sync Often: If you change a route name or a config value, run php artisan boost:update. If you don't, the AI will be working from a "ghost" version of your app's previous state.
  • Override Wisely:
    Laravel Boost
    comes with sensible defaults for
    Tailwind CSS
    and
    Pest
    . However, if your team has a unique way of writing tests, create a custom file in AI/skills/pest.md to override the default
    Laravel Boost
    behavior.
6 min read