Home › Laravel › Laravel Filament admin panel CLAUDE.md

Laravel Filament admin panel CLAUDE.md

CLAUDE.md for Laravel apps with Filament admin panels: resources, forms and tables, policies for authorization, relation managers, actions, and Pest tests.

Claude Code (CLAUDE.md)Laravel

How to use

Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

CLAUDE.mdDownload  
# CLAUDE.md: Laravel + Filament

## Commands
- `php artisan test` (Pest or PHPUnit) · `./vendor/bin/pint` (format) · `./vendor/bin/phpstan analyse` if configured.
- Generate, don't hand-scaffold: `php artisan make:filament-resource Post --generate`, `make:filament-relation-manager`, `make:filament-page`, `make:filament-widget`.
- Check the installed Filament major in `composer.json` before writing code: v3 and v4 differ (v4 moves forms and infolists onto unified schemas and changes some namespaces). Follow the version's docs; don't mix APIs.

## Resources
- One resource per model under `app/Filament/Resources`. In v4 keep form/table definitions in the generated schema and table classes; in v3 keep them in `form()` and `table()`.
- Forms: validation rules on fields (`->required()`, `->maxLength()`, `->unique(ignoreRecord: true)`), relationship selects with `->relationship()` and `->searchable()->preload()` only for small sets.
- Tables: eager-load what columns use (`modifyQueryUsing(fn ($q) => $q->with('author'))`) to avoid N+1; add filters and searchable/sortable columns deliberately.
- Business logic stays in models, actions or services. Filament actions call them; they don't contain domain logic or raw queries.

## Authorization
- Every resource is backed by a Laravel policy (`php artisan make:policy PostPolicy --model=Post`). Filament respects `viewAny`, `create`, `update`, `delete`; never rely on hiding navigation for security.
- Panel access via `canAccessPanel()` on the `User` model (implements `FilamentUser`); never return `true` for everyone in production.
- Destructive actions use `->requiresConfirmation()`; bulk actions respect policies too.

## Tests
Livewire tests for resource pages: `livewire(ListPosts::class)->assertCanSeeTableRecords($posts)`, create/edit form submission with `->fillForm()->call('create')->assertHasNoFormErrors()`, and authorization tests per role.

## Done when
Pint clean, tests pass, and `php artisan filament:upgrade` / asset publishing ran if a Filament version bump was part of the change.

More: all Laravel rules · all Claude Code (CLAUDE.md) rules

Related rules

Laravel Copilot instructions

GitHub Copilot instructions for Laravel 11+ apps with Eloquent, Pest, and Form Requests.

GitHub CopilotLaravel

Laravel 13 rules

Cursor rules for Laravel 13 apps on PHP 8.3+: Eloquent, Form Requests, policies, queues, Pest tests, and Pint.

CursorLaravel

Laravel Livewire AGENTS.md

AGENTS.md for Livewire 3+ components in Laravel: properties, validation attributes, computed data, and Alpine.

AGENTS.mdLaravel

Bun runtime CLAUDE.md

CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.

Claude Code (CLAUDE.md)Bun

Clojure project CLAUDE.md

CLAUDE.md for Clojure projects: deps.edn or Leiningen commands, REPL-friendly namespaces, pure functions and data, malli/spec at boundaries, clj-kondo, and tests.

Claude Code (CLAUDE.md)Clojure

Django CLAUDE.md

CLAUDE.md for Django 5 projects with DRF, pytest-django and PostgreSQL.

Claude Code (CLAUDE.md)Django

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.