filament

A set of coding rules for Filament, a Laravel toolkit for building administrative interfaces. It covers resources, forms, actions, icons, enums, and tests.

In plain words
What is it for?
Use it when creating or changing Filament resources, actions, forms, filters, enums, custom themes, or their smoke tests.
Why use it?
It helps keep Filament code consistent with the project's conventions and avoids deprecated or unsafe patterns.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/pekral/cursor-rules/filament
Clone the repo
git clone --depth 1 https://github.com/pekral/cursor-rules
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 313 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00313
Opus 5 $0.00000 $0.00156
Sonnet 5 $0.00000 $0.00063
Haiku 4.5 $0.00000 $0.00031

Measured yesterday against content hash b3643a719596, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

filament scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/laravel/filament.mdc · 31 lines

What it actually says

Resources

  • Generate smoke tests for every Filament Resource.
  • When changing a Resource, add or update tests and ensure they pass.
  • Do not add a View page or Infolist unless explicitly requested.
  • Use Resource::getUrl('index') with the exact Resource class.

Enums

  • When enums back model fields, prefer implementing HasLabel, HasColor, and HasIcon where useful.
  • Use enum instances instead of hardcoded strings when an enum already exists.
  • Do not append ->value when defining enum defaults unless truly required.
  • Match Filament interface return types exactly.

Actions and Forms

  • Use ->authorize('ability') on actions.
  • Do not use Gate::authorize() or Gate::allows() manually inside Filament actions.
  • In Filament v4, do not specify ignoreRecord: true for unique() when it is already the default.
  • Use ->schema() instead of deprecated ->form() on actions and filters.
  • Use ->mutateDataUsing() instead of deprecated ->mutateFormDataUsing().

UI

  • Use Filament\\Support\\Icons\\Heroicon for icons instead of raw strings.
  • For custom Blade files with Tailwind, create and register a custom theme.

Testing

  • Use Livewire::test(...), not livewire(...).
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 31 lines · 0 tokens per session scan A b3643a719596

Subscribe to this mod's changes

filament is a cursor rule published in the GitHub repository pekral/cursor-rules (6 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 313 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.