/filament-ai-skills:eloquent-query-checkfrom filament-ai-skills
Verifies and fixes direct static calls on Eloquent models, ensuring they always go through ::query() before methods like find, where, create, all, etc.
Ships in filament-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
All data access via Eloquent model must go through ::query() before any method.
// ❌ Wrong
Product::find($id)
Product::create([...])
Product::where('tenant_id', $id)->get()
Product::all()
Product::count()
Product::pluck('name', 'id')
Product::first()
Product::firstOrCreate([...])
Product::updateOrCreate([...])
Product::exists()
// ✅ Correct
Product::query()->find($id)
Product::query()->create([...])
Product::query()->where('tenant_id', $id)->get()
Product::query()->get()
Product::query()->count()
Product::query()->pluck('name', 'id')
Product::query()->first()
Product::query()->firstOrCreate([...])
Product::query()->updateOrCreate([...])
Product::query()->exists()
Builder with correct type hints — PHPStan and IDEs infer the model type// Keep as-is — these are not database queries
Model::factory() // Test factories
Model::query() // Already correct
Model::class // Class constant
Model::make(...) // Filament Action, not Eloquent
Model::observe(...) // Observer registration
Model::getSelectComponent() // Custom static method
Model::from(...) // Rarely, accepted
new Model() // Direct instantiation
# Staged files (pre-commit)
git diff --name-only --cached | grep '\.php$'
# Modified files (working tree)
git diff --name-only | grep '\.php$'
Run for each identified PHP file:
# Direct calls without ::query()
::(find|findOrFail|findMany|where|whereIn|whereNotIn|whereHas|with|all|count|create|first|firstOrCreate|firstOrNew|updateOrCreate|pluck|exists|sum|avg|min|max|get|paginate|simplePaginate|cursor|chunk|each|latest|oldest|orderBy|select|groupBy|having|join|leftJoin|rightJoin|insert|upsert)\(
Use the Grep tool with output_mode: "content" to see the exact lines.
Additional filter: Ignore lines where the pattern is already preceded by ::query().
For each line found, confirm:
Model::method()::query() before it? (e.g. Model::query()->where( — OK)static)// Substitution pattern:
// Model::method( → Model::query()->method(
// Examples:
Contact::where('tenant_id', $id) → Contact::query()->where('tenant_id', $id)
Account::create([...]) → Account::query()->create([...])
Order::find($orderId) → Order::query()->find($orderId)
Product::all() → Product::query()->get()
vendor/bin/pint --dirty
Model::(find|create|where|all|count|first|pluck) in modified PHP files::query()?Model::query()->method()vendor/bin/pint --dirty executed// ❌ Frequent in Actions and Forms
->options(fn () => User::pluck('name', 'id'))
->options(fn () => Category::all()->pluck('name', 'id'))
$product = Product::find($productId);
// ✅ Correct
->options(fn () => User::query()->pluck('name', 'id'))
->options(fn () => Category::query()->pluck('name', 'id'))
$product = Product::query()->find($productId);
// ❌
$count = Order::count();
$total = Account::where('type', 'payables')->sum('amount');
// ✅
$count = Order::query()->count();
$total = Account::query()->where('type', 'payables')->sum('amount');
// ❌
$existing = Product::where('barcode', $barcode)->first();
// ✅
$existing = Product::query()->where('barcode', $barcode)->first();
Model::factory() — test factories are not queriesModel::class — it is a PHP constant, not a method::query() correctlyWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub felipearnold/filament-ai-skills --plugin filament-ai-skills18 skills in this plugin
/deep-code-reviewAnálise técnica profunda de código PHP/Laravel já implementado (não staged). 3 dimensões: segurança (OWASP), qualidade (SOLID, CC, DRY), padrões (PHP 8.4, Laravel 12, Filament v5). Foco em "como melhorar" — refactor, design, arquitetura. Gera relatório com scores e plano de ação. **Use pre-commit-review pra checklist rápido antes de commit.** Ativa: analisar implementação em profundidade, revisar feature pronta, audit de segurança, refatorar código existente, melhorar arquitetura, review profundo, análise completa, avaliar qualidade de feature, scoring de código./error-detectiveAgente especializado em detectar, diagnosticar e corrigir erros no sistema. Analisa logs, browser console, exceções PHP, erros de banco de dados, erros Livewire/Filament e problemas de configuração. Ativa quando o usuário menciona: erro, exception, bug, falha, não funciona, quebrou, 500, 404, null, undefined, stack trace, log, error, crash, problema, não atualiza, não salva, tela branca./filament-action-developmentCreates Filament v5 Actions — record, bulk, header, page actions — com modais, forms, confirmações e notificações. Activate: create action, action customizada, botão, modal, confirmação, dialog, bulk action, ação em lote, ação de tabela, ExportAction, ImportAction, gerar PDF a partir de botão, enviar email via action, atualizar status, agrupar ações./filament-export-developmentAdds Excel and PDF export a tabelas Filament. Cria Exporter classes pra Excel (via ExportAction + openspout) e BulkAction + Controller + Blade pra PDF (via DomPDF). Activate: export, exportação, Excel, planilha, relatório PDF de lista, download de dados, export./filament-infolist-developmentCreates and maintains Infolists Filament v5 para visualização read-only de registros. Activate when: infolist, view page, visualização, página de detalhes, exibir dados, read-only, ver registro, tela de detalhes, entries, TextEntry, IconEntry, RepeatableEntry, layout de visualização./filament-query-auditAnálise estática automatizada de N+1, eager load faltando, vazamento cross-tenant e colunas sem índice em arquivos Filament (Resources, Tables, Widgets, Pages). Diferente de query-performance-audit (diagnóstico de tela lenta em runtime): esta skill roda ANTES de produção via static analysis. Ativa: auditar filament, query audit filament, verificar N+1 filament, eager load resource, filament:query-audit, auditoria queries filament, checar performance resources, vazamento tenant filament, withoutGlobalScopes.