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.
npx skills add AratKruglik/claude-sdlc --skill eloquent-patternsgit clone --depth 1 https://github.com/AratKruglik/claude-sdlcWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/aratkruglik/claude-sdlc/eloquent-patterns)<a href="https://agentmods.dev/skills/aratkruglik/claude-sdlc/eloquent-patterns"><img src="https://agentmods.dev/badge/skills/aratkruglik/claude-sdlc/eloquent-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/aratkruglik/claude-sdlc/eloquent-patterns"><img src="https://agentmods.dev/badge/skills/aratkruglik/claude-sdlc/eloquent-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00068 | $0.01775 |
| Opus 5 | $0.00034 | $0.00888 |
| Sonnet 5 | $0.00014 | $0.00355 |
| Haiku 4.5 | $0.00007 | $0.00178 |
Grade A, and why
eloquent-patterns 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 12d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 310 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Eloquent Patterns
Patterns for working with Eloquent that catch the common pitfalls (N+1, mass assignment, race conditions on counts, raw SQL injection).
1. N+1 prevention
The single most common Eloquent performance bug.
Problem
$users = User::all();
foreach ($users as $user) {
echo $user->subscription->plan; // 1 query per user → N+1
}
Solution: eager loading
$users = User::with('subscription')->get();
foreach ($users as $user) {
echo $user->subscription?->plan; // No extra queries
}
Nested eager loading
$users = User::with('subscription.invoices')->get();
Selective columns (further optimization)
$users = User::with(['subscription:id,user_id,plan,status'])->get();
Detection in code review
Look for any foreach or array_map over an Eloquent collection followed by ->relation access without with() upstream. That's N+1 90% of the time.
2. Scopes for reusable query logic
Encapsulate common query fragments as model scopes.
class Subscription extends Model
{
public function scopeActive(Builder $query): void
{
$query->where('status', 'active')
->where('ends_at', '>=', now());
}
public function scopeForUser(Builder $query, User $user): void
{
$query->where('user_id', $user->id);
}
}
// Usage:
$activeForUser = Subscription::active()->forUser($user)->get();
Benefits:
- DRY — definition lives once.
- Testable — scopes can be unit-tested.
- Self-documenting —
Subscription::active()reads better thanwhere('status', 'active')->where(...).
3. Mass assignment safety
class Subscription extends Model
{
protected $fillable = [
'user_id',
'plan',
'status',
'starts_at',
];
}
Then:
Subscription::create($request->validated()); // ✅ safe
Never:
class Subscription extends Model
{
protected $guarded = []; // ❌ — opens door to mass-assigning is_admin, etc.
}
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.
- 12d ago First seen · 310 lines · 68 tokens per session scan A d8c06ef864d5
eloquent-patterns is a skill published in the GitHub repository AratKruglik/claude-sdlc (33 stars, last pushed 8d ago), licensed MIT. It adds 68 tokens to every session and 1,775 once invoked, about $0.0003 per session on Opus 5. 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-30.
Other skills, from other repositories
truss-schema
Ground a database schema change in this application's real structure using Laravel Truss. Use when adding or altering tables, columns, indexes, or foreign keys, when a migration needs to match what is already there, or when you need to know what a migration actually changed. Structure only, never data.
laravel-database-optimization
Laravel database optimization patterns. Use when writing Eloquent queries, creating migrations, configuring caching, debugging slow queries, or optimizing database performance. Triggers on tasks involving N+1 queries, indexing, Redis caching, pagination, or database transactions.
check-batch-processing
Analyzes PHP code for batch processing issues. Detects single-item vs bulk operations, missing batch inserts, individual API calls in loops, transaction overhead.
laravel-migrations
Use when designing a database schema or managing Laravel 13 migrations — Schema Builder, columns, indexes, foreign keys, or seeders.
laravel-eloquent
Eloquent and query-layer engineering rules for Laravel — eliminating N+1, choosing a pagination strategy, short atomic transactions, casts and scopes on the model, where raw SQL is allowed, and how migrations declare the schema those queries depend on. Use when writing or reviewing Eloquent models, migrations, query…
Laravel Migration Safety Review
Reviews Laravel migrations for destructive operations, change() dropping modifiers, locking index creation on large tables (PostgreSQL), and asymmetric down().