I’ve been working with AI tools on Filament projects, and gathered quite a few guidelines from practice - where LLMs fail to deliver the latest version code or slip somewhere else.
Here are the contents of .ai/guidelines/filament.md: this file is auto-added to Laravel Boost guidelines at php artisan boost:install.
Update Feb 7, 2026: added a rule for static $view.
filament.md:
## Filament Rules - When generating Filament resource, you MUST generate Filament smoke tests to check if the Resource works. When making changes to Filament resource, you MUST run the tests (generate them if they don't exist) and make changes to resource/tests to make the tests pass.- When generating Filament resource, don't generate View page or Infolist, unless specifically instructed.- When referencing the Filament routes, aim to use `getUrl()` instead of Laravel `route()`. Instead of `route('filament.admin.resources.class-schedules.index')`, use `ClassScheduleResource::getUrl('index')`. Also, specify the exacy Resource name, instead of `getResource()`.- When writing tests with Pest, use syntax `Livewire::test(class)` and not `livewire(class)`, to avoid extra dependency on `pestphp/pest-plugin-livewire`.- When using Enum class for Eloquent Model field, add Enum `HasLabel`, `HasColor` and `HasIcon` interfaces if aren't added yet instead of specifying values/labels/colors/icons inside of Filament Forms/Tables. **CRITICAL**: Always use the exact return type declarations from the interface definitions - do NOT substitute specific types (e.g., use `string|BackedEnum|Htmlable|null` for `getIcon()`, not `string|Heroicon|null`). When defining a default using enum never add `->value`. Refer to this docs page: https://filamentphp.com/docs/4.x/advanced/enums- Always use Enum instead of hardcoded string value where possible, if Enum class exists. For example, in the tests, when creating data, if field is casted to Enum, then use that Enum instead of hardcoded string value.- When adding icons, always use the Filament enum Filament\Support\Icons\Heroicon class instead of string.- When adding actions that require authorization, use the `->authorize('ability')` method on the action instead of manually calling `Gate::authorize()` or checking `Gate::allows()`. The `authorize()` method handles both authorization enforcement and action visibility automatically.- In Filament v4, validation rule `unique()` has `ignoreRecord: true` by default, no need to specify it.- In Filament v4, if you create custom Blade files with Tailwind classes, you need to create a custom theme and specify the folder of those Blade files in theme.css.- In Filament v4/v5, the `$view` property on Page classes is non-static (`protected string $view`), unlike v3 where it was static. Do NOT declare it as `protected static string $view` - this causes a "Cannot redeclare non static" fatal error.- **Deprecated v3 methods - do NOT use:** - `->form()` on Actions/Filters → use `->schema()` instead - `->mutateFormDataUsing()` → use `->mutateDataUsing()` instead - `Placeholder::make()` → use `TextEntry::make()->state()` instead (import from `Filament\Infolists\Components\TextEntry`) - `->label('')` for hidden labels → use `->hiddenLabel()` instead
A few of our Premium Examples: