laravel-boost
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLaravel Boost
Laravel Boost
Overview
概述
Laravel Boost is an official Laravel package that accelerates AI-assisted development by providing composable guidelines, on-demand agent skills, an MCP (Model Context Protocol) server, and a documentation API with semantic search across 17,000+ Laravel-specific knowledge pieces. It bridges AI coding tools and the Laravel ecosystem, ensuring that AI agents generate high-quality, convention-compliant Laravel code.
Apply this skill when setting up, configuring, or extending Laravel Boost in a project, or when integrating AI agents with a Laravel application.
Laravel Boost是Laravel官方推出的扩展包,通过提供可组合的开发指南、按需加载的Agent技能、MCP(模型上下文协议)服务器,以及覆盖17000+ Laravel专属知识片段的语义搜索文档API,来加速AI辅助开发流程。它打通了AI编码工具和Laravel生态,确保AI Agent生成高质量、符合规范的Laravel代码。
当你需要在项目中搭建、配置、扩展Laravel Boost,或者将AI Agent与Laravel应用集成时,可以使用本技能。
Multi-Phase Process
多阶段流程
Phase 1: Assessment
阶段1:评估
- Confirm Laravel version compatibility (10.x, 11.x, 12.x)
- Identify the AI IDE or agent in use (Cursor, Claude Code, Codex, Gemini CLI, GitHub Copilot, Junie)
- Check if an MCP configuration already exists ()
.mcp.json - Review existing guideline and skill customizations in
.ai/
STOP — Do NOT install Boost without confirming Laravel version compatibility and target IDE.
- 确认Laravel版本兼容性(10.x、11.x、12.x)
- 明确当前使用的AI IDE或Agent(Cursor、Claude Code、Codex、Gemini CLI、GitHub Copilot、Junie)
- 检查是否已存在MCP配置()
.mcp.json - 查看目录下现有的指南和技能自定义内容
.ai/
停止操作 — 未确认Laravel版本兼容性和目标IDE之前,请勿安装Boost。
Phase 2: Installation and Configuration
阶段2:安装与配置
- Install the package and run the installer
- Configure MCP server for the target IDE
- Set up automatic updates via Composer hooks
- Verify MCP tools are accessible from the AI agent
STOP — Do NOT proceed until MCP server connectivity is verified with at least one tool call.
- 安装扩展包并运行安装程序
- 为目标IDE配置MCP服务器
- 通过Composer钩子设置自动更新
- 验证AI Agent可以访问MCP工具
停止操作 — 至少完成一次工具调用、确认MCP服务器连通性之前,请勿进入下一阶段。
Phase 3: Customization
阶段3:自定义
- Add project-specific guidelines in
.ai/guidelines/ - Create domain-specific skills in
.ai/skills/ - Override built-in guidelines or skills where project conventions differ
- Register custom agents if extending to unsupported IDEs
STOP — Do NOT override built-in guidelines unless project conventions genuinely differ from Laravel defaults.
- 在目录下添加项目专属指南
.ai/guidelines/ - 在目录下创建业务域专属技能
.ai/skills/ - 当项目规范与默认规则不同时,覆盖内置指南或技能
- 如果要扩展支持未适配的IDE,注册自定义Agent
停止操作 — 除非项目规范确实与Laravel默认规则存在差异,否则请勿覆盖内置指南。
Phase 4: Validation
阶段4:验证
- Confirm MCP server responds to tool calls (Application Info, Database Schema, Search Docs)
- Verify guidelines load in the AI agent's context window
- Test skill activation for domain-relevant tasks
- Check that keeps resources current after dependency changes
boost:update
- 确认MCP服务器可以响应工具调用(应用信息、数据库 schema、文档搜索)
- 验证指南可以正常加载到AI Agent的上下文窗口中
- 测试业务域相关任务的技能激活功能
- 检查命令可以在依赖变更后同步资源
boost:update
IDE Setup Decision Table
IDE配置决策表
| IDE / Agent | Setup Method | Configuration File |
|---|---|---|
| Claude Code | CLI command | |
| Codex | CLI command | |
| Gemini CLI | CLI command | |
| Cursor | Command Palette GUI | |
| GitHub Copilot | Command Palette GUI | |
| Junie | Settings GUI | |
| Custom / Unsupported | Custom agent class | Manual MCP config |
| IDE / Agent | 安装方式 | 配置文件 |
|---|---|---|
| Claude Code | CLI命令 | |
| Codex | CLI命令 | |
| Gemini CLI | CLI命令 | |
| Cursor | 命令面板GUI | |
| GitHub Copilot | 命令面板GUI | |
| Junie | 设置GUI | |
| 自定义/未支持 | 自定义Agent类 | 手动MCP配置 |
Installation
安装
bash
undefinedbash
undefinedInstall as a development dependency
安装为开发依赖
composer require laravel/boost --dev
composer require laravel/boost --dev
Run the installer — generates .mcp.json, guideline files, and boost.json
运行安装程序 — 生成.mcp.json、指南文件和boost.json
php artisan boost:install
The installer generates:
- `.mcp.json` — MCP server configuration for IDE integration
- Guideline files (`CLAUDE.md`, `AGENTS.md`, etc.) tailored to detected packages
- `boost.json` — Boost configuration filephp artisan boost:install
安装程序会生成:
- `.mcp.json` — 用于IDE集成的MCP服务器配置
- 适配已检测到的扩展包的指南文件(`CLAUDE.md`、`AGENTS.md`等)
- `boost.json` — Boost配置文件IDE-Specific MCP Setup
特定IDE的MCP配置
| IDE / Agent | Setup Command or Action |
|---|---|
| Claude Code | |
| Codex | |
| Gemini CLI | |
| Cursor | Command Palette -> "Open MCP Settings" -> toggle on |
| GitHub Copilot | Command Palette -> "MCP: List Servers" -> select |
| Junie | Shift-Shift -> "MCP Settings" -> check |
| IDE / Agent | 配置命令或操作 |
|---|---|
| Claude Code | |
| Codex | |
| Gemini CLI | |
| Cursor | 命令面板 -> "打开MCP设置" -> 开启 |
| GitHub Copilot | 命令面板 -> "MCP: 列出服务器" -> 选择 |
| Junie | 双击Shift -> "MCP设置" -> 勾选 |
Manual MCP Configuration
手动MCP配置
json
{
"mcpServers": {
"laravel-boost": {
"command": "php",
"args": ["artisan", "boost:mcp"]
}
}
}json
{
"mcpServers": {
"laravel-boost": {
"command": "php",
"args": ["artisan", "boost:mcp"]
}
}
}Keeping Resources Updated
保持资源更新
bash
undefinedbash
undefinedManual update after dependency changes
依赖变更后手动更新
php artisan boost:update
php artisan boost:update
Automatic updates — add to composer.json scripts
自动更新 — 添加到composer.json的scripts配置中
{
"scripts": {
"post-update-cmd": [
"@php artisan boost:update --ansi"
]
}
}
undefined{
"scripts": {
"post-update-cmd": [
"@php artisan boost:update --ansi"
]
}
}
undefinedMCP Server Tools
MCP服务器工具
Laravel Boost exposes the following tools through its MCP server, giving AI agents direct access to application context:
| Tool | Purpose | Typical Use |
|---|---|---|
| Application Info | Read PHP and Laravel versions, database engine, ecosystem packages, Eloquent models | Context discovery at session start |
| Database Schema | Read full database schema | Migration planning, model generation |
| Database Query | Execute queries against the database | Data inspection, debugging |
| Database Connections | Inspect available database connections | Multi-database configuration |
| Search Docs | Semantic search across Laravel documentation API | Finding best practices, API references |
| Last Error | Read the most recent application log error | Debugging workflow |
| Read Log Entries | Read last N log entries | Monitoring, debugging |
| Browser Logs | Read logs and errors from browser | Frontend debugging |
| Get Absolute URL | Convert relative path URIs to absolute URLs | Link generation |
Laravel Boost通过其MCP服务器提供以下工具,让AI Agent可以直接访问应用上下文:
| 工具 | 用途 | 典型使用场景 |
|---|---|---|
| 应用信息 | 读取PHP和Laravel版本、数据库引擎、生态扩展包、Eloquent模型 | 会话启动时的上下文发现 |
| 数据库Schema | 读取完整数据库schema | 迁移规划、模型生成 |
| 数据库查询 | 对数据库执行查询 | 数据核查、调试 |
| 数据库连接 | 查看可用的数据库连接 | 多数据库配置 |
| 文档搜索 | 跨Laravel文档API的语义搜索 | 查找最佳实践、API参考 |
| 最新错误 | 读取应用日志最新的错误信息 | 调试流程 |
| 读取日志条目 | 读取最近N条日志 | 监控、调试 |
| 浏览器日志 | 读取浏览器的日志和错误 | 前端调试 |
| 获取绝对URL | 将相对路径URI转换为绝对URL | 链接生成 |
AI Guidelines
AI指南
Guidelines are composable instruction files loaded upfront into the AI agent's context, providing broad conventions and best practices.
指南是预先加载到AI Agent上下文中的可组合指令文件,提供通用规范和最佳实践。
Available Built-in Guidelines
可用内置指南
| Package | Versions Supported |
|---|---|
| Laravel Framework | Core, 10.x, 11.x, 12.x |
| Livewire | Core, 2.x, 3.x, 4.x |
| Flux UI | Core, Free, Pro |
| Inertia | React, Vue, Svelte (1.x-3.x) |
| Tailwind CSS | Core, 3.x, 4.x |
| Pest | Core, 3.x, 4.x |
| PHPUnit, Pint, Sail, Pennant, Volt, Wayfinder, Folio, Herd, MCP | Core |
| 扩展包 | 支持版本 |
|---|---|
| Laravel Framework | 核心、10.x、11.x、12.x |
| Livewire | 核心、2.x、3.x、4.x |
| Flux UI | 核心、免费版、专业版 |
| Inertia | React、Vue、Svelte (1.x-3.x) |
| Tailwind CSS | 核心、3.x、4.x |
| Pest | 核心、3.x、4.x |
| PHPUnit、Pint、Sail、Pennant、Volt、Wayfinder、Folio、Herd、MCP | 核心 |
Custom Guidelines
自定义指南
Create or files in :
.blade.php.md.ai/guidelines/.ai/guidelines/team-conventions.md
.ai/guidelines/billing/stripe-patterns.blade.phpOverride a built-in guideline by matching its path:
.ai/guidelines/inertia-react/2/forms.blade.php在目录下创建或文件:
.ai/guidelines/.blade.php.md.ai/guidelines/team-conventions.md
.ai/guidelines/billing/stripe-patterns.blade.php通过匹配内置指南的路径来覆盖它:
.ai/guidelines/inertia-react/2/forms.blade.phpThird-Party Package Guidelines
第三方扩展包指南
Package authors can ship guidelines at:
resources/boost/guidelines/core.blade.php扩展包开发者可以将指南放在以下路径:
resources/boost/guidelines/core.blade.phpAgent Skills
Agent技能
Skills are on-demand knowledge modules activated only when relevant, reducing context window bloat.
技能是仅在相关场景下才会激活的按需知识模块,可减少上下文窗口冗余。
Available Built-in Skills
可用内置技能
| Skill | Domain |
|---|---|
| Livewire components and reactivity |
| Inertia.js with React |
| Inertia.js with Vue |
| Inertia.js with Svelte |
| Pest test patterns |
| Flux UI components |
| Folio page-based routing |
| Tailwind CSS utility classes |
| Volt single-file Livewire components |
| Pennant feature flags |
| Wayfinder type-safe routing |
| MCP server/tool development |
| 技能 | 业务域 |
|---|---|
| Livewire组件和响应式开发 |
| 搭配React的Inertia.js开发 |
| 搭配Vue的Inertia.js开发 |
| 搭配Svelte的Inertia.js开发 |
| Pest测试模式 |
| Flux UI组件开发 |
| Folio页面路由开发 |
| Tailwind CSS工具类开发 |
| Volt单文件Livewire组件开发 |
| Pennant功能开关开发 |
| Wayfinder类型安全路由开发 |
| MCP服务器/工具开发 |
Custom Skills
自定义技能
Create :
.ai/skills/{skill-name}/SKILL.mdmarkdown
---
name: invoice-management
description: Build and work with invoice features including PDF generation and payment tracking.
---创建文件:
.ai/skills/{skill-name}/SKILL.mdmarkdown
---
name: invoice-management
description: 构建和使用发票功能,包括PDF生成和支付跟踪。
---Invoice Management
发票管理
When to use this skill
何时使用本技能
Use when working with the invoicing module...
undefined当你开发发票模块时使用...
undefinedGuidelines vs Skills Decision Table
指南与技能决策表
| Question | Guidelines | Skills |
|---|---|---|
| When is it loaded? | Always — upfront context | On-demand — when the task matches |
| How broad is the scope? | Foundational conventions | Focused implementation patterns |
| Impact on context window? | Constant (always present) | Minimal (loaded only when needed) |
| Best for? | Coding standards, package versions | Step-by-step implementation guides |
| Content changes often? | Rarely (stable conventions) | Frequently (evolving patterns) |
| Team-wide applicability? | High (everyone follows) | Varies (domain-specific) |
| 问题 | 指南 | 技能 |
|---|---|---|
| 何时加载? | 始终预先加载到上下文 | 按需加载,仅当任务匹配时激活 |
| 覆盖范围有多广? | 基础规范 | 聚焦的实现模式 |
| 对上下文窗口的影响? | 固定占用(始终存在) | 极小(仅需要时加载) |
| 最佳适用场景? | 编码标准、扩展包版本约束 | 分步实现指南 |
| 内容变更频率? | 很少(规范稳定) | 频繁(模式迭代) |
| 团队适用性? | 高(所有人都需要遵守) | 不固定(特定业务域适用) |
Documentation API
文档API
Boost provides semantic search across 17,000+ documentation pieces covering:
| Package | Versions |
|---|---|
| Laravel Framework | 10.x, 11.x, 12.x |
| Filament | 2.x, 3.x, 4.x, 5.x |
| Flux UI | 2.x Free, 2.x Pro |
| Inertia | 1.x, 2.x |
| Livewire | 1.x, 2.x, 3.x, 4.x |
| Nova | 4.x, 5.x |
| Pest | 3.x, 4.x |
| Tailwind CSS | 3.x, 4.x |
The MCP tool queries this API. Guidelines and skills automatically instruct agents to use it when they need implementation details.
Search DocsBoost提供覆盖17000+文档片段的语义搜索能力,覆盖以下内容:
| 扩展包 | 版本 |
|---|---|
| Laravel Framework | 10.x、11.x、12.x |
| Filament | 2.x、3.x、4.x、5.x |
| Flux UI | 2.x免费版、2.x专业版 |
| Inertia | 1.x、2.x |
| Livewire | 1.x、2.x、3.x、4.x |
| Nova | 4.x、5.x |
| Pest | 3.x、4.x |
| Tailwind CSS | 3.x、4.x |
搜索文档When to Use vs When Not Needed
适用与不适用场景
| Scenario | Use Laravel Boost? | Why |
|---|---|---|
| Laravel project with AI-assisted development | Yes | Primary use case |
| Team uses Cursor, Claude Code, Copilot, or other AI IDE | Yes | MCP integration improves output |
| Need consistent Laravel conventions across AI-generated code | Yes | Guidelines enforce standards |
| Non-Laravel PHP project | No | Boost is Laravel-specific |
| No AI coding tools in workflow | No | Boost's value is in AI agent integration |
| Production runtime performance optimization | No | Boost is dev-time only, not a runtime optimizer |
| Already have comprehensive custom AI prompts | Optional | Boost may supplement or replace them |
| 场景 | 是否需要使用Laravel Boost? | 原因 |
|---|---|---|
| 使用AI辅助开发的Laravel项目 | 是 | 核心使用场景 |
| 团队使用Cursor、Claude Code、Copilot或其他AI IDE | 是 | MCP集成可以提升输出质量 |
| 需要AI生成的代码遵循统一的Laravel规范 | 是 | 指南会强制遵守标准 |
| 非Laravel的PHP项目 | 否 | Boost是Laravel专属工具 |
| 工作流中不使用AI编码工具 | 否 | Boost的价值在于AI Agent集成 |
| 生产环境运行时性能优化 | 否 | Boost仅用于开发阶段,不是运行时优化工具 |
| 已经有完善的自定义AI提示词 | 可选 | Boost可以补充或替代现有提示词 |
Extending Boost
扩展Boost
Custom Agent Registration
自定义Agent注册
For AI tools not supported out of the box:
php
// In AppServiceProvider::boot()
use Laravel\Boost\Boost;
Boost::registerAgent('custom-ide', CustomAgent::class);The custom agent class must extend and implement the relevant interfaces:
Laravel\Boost\Install\Agents\Agent- — for guideline file generation
SupportsGuidelines - — for MCP server configuration
SupportsMcp - — for skill file generation
SupportsSkills
针对默认不支持的AI工具:
php
// 在AppServiceProvider::boot()方法中
use Laravel\Boost\Boost;
Boost::registerAgent('custom-ide', CustomAgent::class);自定义Agent类必须继承并实现相关接口:
Laravel\Boost\Install\Agents\Agent- — 用于生成指南文件
SupportsGuidelines - — 用于MCP服务器配置
SupportsMcp - — 用于生成技能文件
SupportsSkills
Anti-Patterns / Common Mistakes
反模式/常见错误
| Anti-Pattern | Why It Fails | What To Do Instead |
|---|---|---|
| Installing in production | Boost is dev-time only, adds unnecessary overhead | Use |
| Overriding every built-in guideline | Drifts from Laravel core team recommendations | Override only where project genuinely differs |
Ignoring | Guidelines fall out of sync with installed packages | Run after every |
| Overly broad custom skills | Wastes context window tokens when activated | Focus each skill on a single domain |
| Skipping MCP verification | Misconfigured MCP silently degrades AI agent quality | Test tool calls after installation |
Not committing | Team members get inconsistent AI agent experience | Commit to version control |
| Mixing guidelines and skills | Context window pollution with always-loaded content | Conventions in guidelines, patterns in skills |
| Not running installer after upgrade | Missing new guideline files and MCP tools | Run |
| 反模式 | 失败原因 | 正确做法 |
|---|---|---|
| 安装到生产环境 | Boost仅用于开发阶段,会增加不必要的开销 | 使用 |
| 覆盖所有内置指南 | 偏离Laravel核心团队的推荐规范 | 仅在项目确实有不同要求时才覆盖 |
忽略 | 指南会与已安装的扩展包版本不同步 | 每次执行 |
| 自定义技能覆盖范围过广 | 激活时浪费上下文窗口token | 每个技能仅聚焦单个业务域 |
| 跳过MCP验证 | 配置错误的MCP会悄无声息地降低AI Agent的输出质量 | 安装后测试工具调用 |
不提交 | 团队成员的AI Agent体验不一致 | 提交到版本控制 |
| 混淆指南和技能的使用场景 | 始终加载的内容导致上下文窗口污染 | 规范放在指南中,实现模式放在技能中 |
| 升级后不运行安装程序 | 缺失新的指南文件和MCP工具 | 重大升级后运行 |
Anti-Rationalization Guards
反合理化约束
- Do NOT skip MCP verification because "the install succeeded" -- test at least one tool call.
- Do NOT override built-in guidelines without a documented reason for the deviation.
- Do NOT create broad skills -- if it covers more than one domain, split it.
- Do NOT install Boost in production -- it is a dependency exclusively.
--dev - Do NOT forget to run after dependency changes -- stale guidelines degrade AI output.
boost:update
- 不要因为“安装成功了”就跳过MCP验证——至少测试一次工具调用。
- 没有记录偏离原因的情况下,不要覆盖内置指南。
- 不要创建覆盖范围过广的技能——如果覆盖多个业务域,就拆分它。
- 不要在生产环境安装Boost——它是专属的依赖。
--dev - 依赖变更后不要忘记运行——过时的指南会降低AI输出质量。
boost:update
Documentation Lookup (Context7)
文档查询(Context7)
Use then for up-to-date docs. Returned docs override memorized knowledge.
mcp__context7__resolve-library-idmcp__context7__query-docs- — for core Laravel APIs, configuration, or Artisan commands
laravel/framework - — for component lifecycle, wire directives, or Alpine.js integration
livewire
使用和获取最新文档,返回的文档优先级高于记忆中的知识。
mcp__context7__resolve-library-idmcp__context7__query-docs- — 用于查询Laravel核心API、配置或Artisan命令
laravel/framework - — 用于查询组件生命周期、wire指令或Alpine.js集成
livewire
Integration Points
集成点
| Skill | How It Connects |
|---|---|
| Boost guidelines and skills enhance AI-generated Laravel code quality |
| Boost respects PHP version and PSR standards in generated guidelines |
| Boost's MCP server is an example of the MCP pattern; extend it for custom tools |
| Boost's Application Info tool feeds project context into the learning phase |
| Boost's Database Schema and Query tools support backend architecture decisions |
| Boost's Pest skill provides testing patterns for AI-generated tests |
| 技能 | 集成方式 |
|---|---|
| Boost的指南和技能可以提升AI生成的Laravel代码质量 |
| Boost生成的指南会遵守PHP版本和PSR标准 |
| Boost的MCP服务器是MCP模式的示例,可以扩展它实现自定义工具 |
| Boost的应用信息工具可以将项目上下文输入到学习阶段 |
| Boost的数据库Schema和查询工具可以支撑后端架构决策 |
| Boost的Pest技能可以为AI生成的测试提供测试模式参考 |
Skill Type
技能类型
FLEXIBLE — Adapt the process phases to what the project needs. A new project requires full installation and IDE setup (Phases 1-4). An existing Boost installation may only need customization (Phase 3) or validation after a Laravel upgrade (Phase 4). The non-negotiable minimum: verify MCP server connectivity and confirm guidelines match installed package versions.
灵活适配 — 根据项目需求调整流程阶段。新项目需要完整的安装和IDE配置(阶段1-4)。已安装Boost的现有项目可能只需要自定义(阶段3)或者Laravel升级后的验证(阶段4)。不可协商的最低要求:验证MCP服务器连通性,确认指南与已安装的扩展包版本匹配。