filament-performance-lord
Lord skill for Filament v5 performance optimization — deferred loading, query optimization, caching, Octane, and real-time patterns.
Files1
View on GitHubSKILL.mdskills/filament-performance-lord/SKILL.md
GitHubFilament Performance Lord
[OBJ] Optimize Filament v5 admin panels for speed — deferred loading, query optimization, caching, Octane compatibility, and real-time patterns.
[RULES]
- [CMD] Query Context7 for Filament v5 performance docs. Use
/filament/filamentlibrary ID. - [REQ] Deferred Loading:
->deferLoading()on all relation managers and heavy schemas. Prevents waterfall renders. Measure withFilament\Telemetry. - [REQ] Query Optimization: Eager load relationships (
->with()). NEVER N+1 queries. Use->withCount()for badge counts.->deferLoading()for relation manager tabs. - [REQ] Table Performance:
->persistGroupingInSession()to avoid re-grouping. Cursor pagination for >10k rows (->cursorPaginate()). Index all sort columns. NEVER->get()without pagination on large tables. - [REQ] Caching: Cache computed table columns via
->getStateUsing()withCache::remember(). Cache navigation viaNavigationManager. NEVER compute in render loops. - [REQ] Octane Compatibility: Register
FlushAuthenticationState,FlushSessionState,FlushUploadedFileslisteners. Useoctane.warmfor pre-resolving. Granular flush — NEVER flush entire app state. - [REQ] Real-time: Reverb SSE for live updates (NEVER client-side polling).
->deferLoading()+ Reverb push for relation managers. UseLaravel\Reverbfor WebSocket server. - [REQ] Asset Loading:
loadedOnRequest()for lazy JS.FilamentAsset::register()with versioning. NEVER load all assets on every page. Use Vite for production builds. - [REQ] Database Indexing: Index all Filament table sort columns. Index foreign keys. Use
EXPLAIN (ANALYZE, BUFFERS)on PG /EXPLAINon MySQL for slow table queries. Add composite indexes for multi-column sorts. - [REQ] Memory: State < 50KB per Livewire component (Redis for larger). Pass scalar IDs (NEVER full models). Use
->deferLoading()to keep initial render lean. - [REQ] CSP:
LIVEWIRE_CSP_SAFE=falsein dev (Filament Alpinex-initincompatible with CSP-safe build).truein production with strict nonce-based CSP only. - [REQ] Profiling: Use
Laravel\Telescopein dev for query analysis.Filament\Debugbarfor component render time. NEVER deploy with debug tools enabled.
[WORKFLOWS]
- Diagnose Slow Panel: Enable Telescope → load panel → identify N+1 queries → add
->with()→ add->deferLoading()→ re-measure → add indexes if needed. - Octane Migration: Install Octane → register flush listeners → test with
octane:reload→ benchmark withwrk→ tuneoctane.warm→ deploy with FrankenPHP or Swoole. - Real-time Setup: Install Reverb → configure WebSocket server → add
->deferLoading()on relation managers → push updates viaBroadcast::event()→ listen in Filament component.