laravel-patterns

laravel-patterns is a skill for Claude Code from shennawardana23/skillme. It costs 60 tokens per session (959 once invoked), scanned A, original, Apache-2.0.

A guide to structuring Laravel applications with controllers, Eloquent models, services, actions, API resources, queues, events, and caching.

In plain words
What is it for?
Use it when building Laravel routes, controllers, models, relationships, API responses, queued jobs, events, or caching.
Why use it?
It helps keep request handling and business logic organized while avoiding common Laravel problems such as unsafe model updates and slow database queries.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the skillme plugin — 137 skills, 2 commands shipped together

Good fit Use it when building Laravel routes, controllers, models, relationships, API responses, queued jobs, events, or caching.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/shennawardana23/skillme/laravel-patterns
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.

Any agent
npx skills add shennawardana23/skillme --skill laravel-patterns
Clone the repo
git clone --depth 1 https://github.com/shennawardana23/skillme

Made for: Claude Code.

Or install skillme, the plugin that ships this one along with the rest of its 137 skills, 2 commands.

Wrote 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.

agentmods badge for laravel-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/shennawardana23/skillme/laravel-patterns/github.svg)](https://agentmods.dev/skills/shennawardana23/skillme/laravel-patterns)
Your own site
<a href="https://agentmods.dev/skills/shennawardana23/skillme/laravel-patterns"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/laravel-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.

agentmods 80×15 button for laravel-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/shennawardana23/skillme/laravel-patterns"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/laravel-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 959 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00060 $0.00959
Opus 5 $0.00030 $0.00479
Sonnet 5 $0.00012 $0.00192
Haiku 4.5 $0.00006 $0.00096

Measured 7d ago against content hash 2641b6d6596b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

laravel-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 7d 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.

skills/laravel-patterns/SKILL.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Laravel Patterns

Keep controllers thin — orchestration lives in services, single-purpose logic lives in actions. Eloquent's convenience is also its biggest footgun: mass assignment and N+1 queries both look correct until they hit real data volume or an untrusted request body.

Layering

app/Http/Controllers/  → routing + response shape only
app/Http/Requests/     → validation (FormRequest classes)
app/Actions/           → single-purpose use cases
app/Services/          → coordinating domain logic across multiple actions/models
app/Models/            → Eloquent models, casts, scopes, relationships
final class CreateReservationAction
{
    public function __construct(private ReservationRepository $reservations) {}

    public function handle(CreateReservationData $data): Reservation
    {
        return $this->reservations->create($data);
    }
}

final class ReservationsController extends Controller
{
    public function __construct(private CreateReservationAction $createReservation) {}

    public function store(StoreReservationRequest $request): JsonResponse
    {
        $reservation = $this->createReservation->handle($request->toDto());
        return response()->json(['data' => ReservationResource::make($reservation)], 201);
    }
}

Gotchas

  • Mass assignment is opt-in trust, not automatic safety. $fillable only allowlists the fields Eloquent will accept from create()/update() arrays — a model with $guarded = [] (guard nothing) accepts every field in the incoming array, including ones like is_admin or hotel_id that a request body should never be allowed to set directly. Always define $fillable explicitly for any model that accepts request-derived data; never set $guarded = [] on such a model.
  • N+1 queries hide in plain view. Reservation::all() followed by $reservation->guest->name inside a loop issues one query per reservation. Use ->with(['guest']) (eager loading) whenever a relationship is accessed inside a loop over a collection — this is the single most common Eloquent performance defect, and it's invisible in a dev database with 10 rows.
  • Route-model binding without scopeBindings() allows cross-tenant access on nested routes: /accounts/{account}/projects/{project} without scoped bindings will resolve {project} globally, letting a request supply a project ID belonging to a different account than the one in the URL. Use Route::scopeBindings() on any nested resource route.
  • Queued job handlers must be idempotent — Laravel's queue driver can redeliver a job (worker crash mid-job, a retry after a transient failure), so a handler that isn't safe to run twice (e.g., "increment a counter" instead of "set to this value") will double-apply on redelivery.

Read the full file on GitHub · 96 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 7d ago First seen · 96 lines · 60 tokens per session scan A 2641b6d6596b

Subscribe to this mod's changes

laravel-patterns is a skill published in the GitHub repository shennawardana23/skillme (2 stars, last pushed 13d ago), licensed Apache-2.0. It adds 60 tokens to every session and 959 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-09-03.

Related

Other skills, from other repositories

php-pro

A set of practices for building PHP applications with modern PHP, Laravel, or Symfony. PHP is a programming language commonly used for server-side web applications.

sutchan/Agent-Skills-Hub · 120 tokens

mvc-expert

Expert guidelines to refactor legacy PHP codebases into clean, modern, and scalable MVC-structured projects / Pedoman ahli untuk merefaktor codebase PHP lama menjadi proyek terstruktur MVC yang bersih, modern, dan skalabel.

roedyrustam/vibes-plug · 51 tokens

bd-better-route-bridge

Compose better-data DTOs with the better-route library — use BetterRouteBridge::{get, post, put, patch, delete} to register a REST route that hydrates the request into a DTO, validates, calls the handler with (DataObject, mixed $request), and presents returned DataObject values through Presenter with…

Lonsdale201/wp-agent-skills · 214 tokens

bd-data-object

Add or modify DataObject subclasses inside the better-data library — the immutable, attribute-decorated DTOs the whole library is built around. Every DTO is final readonly class extends DataObject with constructor-promoted typed parameters; sources hydrate via ::fromArray, sinks project via SinkProjection, the…

Lonsdale201/wp-agent-skills · 206 tokens

wp-plugin-bootstrap

Scaffolds and reviews the main entry-point PHP file of a WordPress plugin — header (with Requires Plugins for WP 6.5+), ABSPATH guard, file/path/url/version constants, Composer PSR-4 autoload with src/ as the default class root, optional scoped fallback for release ZIP safety, PascalCase class filenames that match…

Lonsdale201/wp-agent-skills · 183 tokens

bd-hydration-coercion

Modify how raw values become typed property values in better-data — work in TypeCoercer (primitives + DateTime + Enum + Secret) or DataObject::coerceParameter (attribute-aware — ListOf, Encrypted, etc.). Critical layering — TypeCoercer is pure, must stay callable from a no-WordPress unit test, no side effects, no…

Lonsdale201/wp-agent-skills · 224 tokens