AI 辅助开发
简介
INFO
本页受 Laravel 的 AI Assisted Development 文档 启发。Laravel Boost 由 Laravel 团队开发,更多信息见其官方文档,以及用 AI 辅助构建 Laravel 项目的其他说明。
Claude Code、Cursor、GitHub Copilot 等 AI 编程代理能显著加快 Filament 开发。Filament 为 Laravel Boost 提供了 Agent Skill,教代理编写地道的 Filament 代码并遵循框架约定。遇到不熟悉的需求时,Laravel Boost 甚至能让代理搜索 Filament 文档寻找答案。
安装 Laravel Boost
将 Boost 安装为开发依赖:
composer require laravel/boost --dev然后运行交互式安装程序。提示时选择 Agent Skills,再选择 filament/filament (skills):
php artisan boost:install安装程序会检测 IDE 与 AI 代理,并生成所需配置。验证安装时,在代理的 skills 目录中查看是否有 filament-development/SKILL.md。
INFO
若在 Filament 提供 Agent Skill 之前就安装了 Boost,请重新运行 php artisan boost:install 并选择 Agent Skills。仅运行 php artisan boost:update 不会启用新功能。
关于 Laravel Boost(工具、文档搜索、IDE 集成等)详见 Laravel AI 文档。
Filament Blueprint
Filament skill 主要面向实现类代理:在明确要构建什么之后,帮助代理写出正确的 Filament 代码。但 AI 生成代码的质量高度依赖计划质量。实现代理若有清晰、详细的规格,就能专注写对代码,而不是猜测需求或臆测你的意图。
对复杂功能,代理可能在规划阶段吃力:选对组件、设计关系、预判边界情况。计划含糊会导致代码含糊,最终纠错时间可能超过用代理省下的时间。
Filament Blueprint 是付费扩展,帮助 AI 代理为 Filament 生成准确、详细的实现计划。 兼容 Filament v4 及以上。
Blueprint 弥合「你想要什么」与「代理做出什么」之间的差距。不必指望代理自己懂 Filament 约定,Blueprint 提供结构化规划 skill,产出无歧义的规格文档。
一份 blueprint 会写明实现代理所需的一切:
- Models:属性、cast、关系与枚举,含确切语法
- Resources:完整命名空间、脚手架命令与配置
- Forms:字段组件、校验规则与布局结构
- Tables:列、筛选、操作与排序行为
- Authorization:可直接落成代码的通俗策略规则
- Testing:测什么、如何验证
- More:响应式字段、向导、导入/导出、批量操作、小部件、多租户等
规划 skill 覆盖代理常弄错的细节(命名空间、方法名、组件选择、嵌套布局计算等),让实现代理尽量一次写对。
规划 skill 只给规划代理用,不应占用实现代理的上下文。规划代理会把所需细节(命名空间、需拉取的文档 URL、确切方法语法)写入 blueprint,实现代理无需加载规划 skill 即可开工。
若想看 Claude Opus 4.5 在有无 Blueprint 时写出的计划对比,见 Blueprint 计划示例。
安装 Blueprint
Blueprint 兼容 Filament v4 及以上。
购买 Blueprint 许可证 后,用 Composer 安装:
composer config repositories.filament composer https://packages.filamentphp.com/composer
composer config --auth http-basic.packages.filamentphp.com "YOUR_EMAIL_ADDRESS" "YOUR_LICENSE_KEY"
composer require filament/blueprint --dev然后运行 Boost 安装程序。提示时选择 Agent Skills,再选择 filament/blueprint (skills):
php artisan boost:install验证安装:在代理的 skills 目录中查看是否有 planning-filament/SKILL.md 与 filament-security-audit/SKILL.md。
INFO
访问已购许可证:用购买 Blueprint 时的邮箱登录 Filament Packages。
使用 Blueprint
要创建 blueprint,在 AI 代理中启用 planning mode,并让它使用 planning-filament skill:
Using the planning-filament skill, create a Filament Blueprint for an order management system.
Orders belong to customers and have many order items. Each order has a status
(pending, confirmed, shipped, delivered, cancelled), shipping address, and
optional notes. Order items reference products with quantity and unit price.
I need to search orders by customer name and filter by status and date range.
The order form should calculate line totals automatically as items are added.
Only admins can delete orders, and orders can only be cancelled if not yet shipped.代理会生成可直接用于实现的详细规格文档。
Blueprint 计划示例
以下提示词在 Claude Code CLI 的 planning mode 下与 Claude Opus 4.5 一起使用:
Produce an implementation plan for a Filament v4 application. The application is
a SaaS invoicing system with the following capabilities:
- Manage customers
- Manage products
- Create and edit invoices
- Add line items to invoices
- Send invoices to customers
- Record and track payments
The plan should:
- Describe the primary user flows end to end (for example: creating an invoice,
sending it, recording a payment).
- Map each domain concept and flow to concrete Filament primitives (Resources,
Relation Managers, Pages, Actions).
- Identify state transitions (such as draft → sent → paid) and the Actions that
trigger them.可对比该提示词下 无 Blueprint 与 有 Blueprint 的计划,比较细节与周全程度。也可把这些计划交给你选用的 AI 代理在 implementation mode 下试跑,观察效果!
INFO
使用 Blueprint 时,提示开头明确点名了 planning-filament skill。
运行安全审计
Blueprint 还附带 Filament Security Audit skill:对照已知安全错误配置目录(授权、文件上传、XSS、查询作用域、依赖 CVE 等)扫描 Filament 代码库,并按发现项写出修复计划。每条会标明确切文件、组件命名空间、文档 URL 与可粘贴修复,实现代理无需猜测即可应用。
在提示中明确点名该 skill 是最可靠的调用方式。与 panel、resource、page 或 Livewire 组件等目标一起出现时,也会响应关键词 security-audit、security-review、harden、pen-test:
Using the filament-security-audit skill, audit the admin panel and write
the remediation plan to SECURITY_AUDIT.md.代理会生成按发现类别分组的 Markdown 报告,以及每项检查结果表(Finding / Pass / N/A),并为每个已确认问题给出推荐测试。
反馈 Blueprint 问题
若遇到问题或有改进 Filament Blueprint 的建议,请在 Filament Blueprint Issues GitHub 仓库 开 issue 或讨论。账号或购买相关问题请发邮件至 support@filamentphp.com。