DEV Community

Cover image for Turn Claude Code into a Laravel expert with LaraClaude
Eduardo Lázaro
Eduardo Lázaro

Posted on

Turn Claude Code into a Laravel expert with LaraClaude

Claude Code writes PHP in Laravel quite well, but it starts every session as a generalist. It does not know your project has three hundred migrations that should be thirty, that a @foreach two files over is firing an N+1, or that your modals follow one specific pattern. You end up re-explaining the same context constantly.

LaraClaude packages that context as slash commands. It is a Claude Code plugin with over thirty Laravel skills, each a /lc: command. Install it once and you have audits, scaffolders and cleanup tools that already know Laravel. Here are the ones I run most.

How to install

LaraClaude installs through Claude Code's plugin system. Add the marketplace once, then install, so you get updates later:

/plugin marketplace add edulazaro/laraclaude
/plugin install laraclaude@edulazaro
Enter fullscreen mode Exit fullscreen mode

Or grab it directly from GitHub:

/plugin install github:edulazaro/laraclaude
Enter fullscreen mode Exit fullscreen mode

You need Claude Code and a Laravel project. That is it for most skills; a couple that hit a live database also want Docker.

Audit before you change anything

Most skills default to a read-only report and only touch files when you add fix, so start by looking. /lc:find-n-plus-one scans your Blade views, Livewire components and controllers for a relationship accessed inside a loop, traces it back to the query that built the collection, and tells you the exact with() to add.

/lc:find-n-plus-one
Enter fullscreen mode Exit fullscreen mode

/lc:security-audit is the other one I run on any project I inherit. It looks for SQL injection, XSS, mass-assignment and secrets committed to the repo, and like most fixable skills it takes a preview flag before it changes anything.

/lc:security-audit                 # report
/lc:security-audit fix --dry-run   # preview the fixes
/lc:security-audit fix             # apply, with confirmation
Enter fullscreen mode Exit fullscreen mode

Clean up what has piled up

Every long-lived Laravel app accumulates migration cruft: a create followed by twenty add_column and change_column files. /lc:consolidate-migrations groups them by table, classifies each table as safe to merge or not, and folds the ALTERs back into the original create while leaving data migrations alone.

/lc:consolidate-migrations              # analyze
/lc:consolidate-migrations fix --dry-run
Enter fullscreen mode Exit fullscreen mode

It refuses to run against a production database and asks before deleting anything, which is the behavior you want from something rewriting your schema history. /lc:dead-code is its companion for the code side: unused classes, methods, routes and views.

Scaffold to your conventions, not a generic stub

The generators read how your project already does things instead of emitting a boilerplate stub. /lc:volt-component writes a Livewire Volt single-file component with the PHP block, validation and @text() strings in place and a single root element.

/lc:volt-component UserProfile
Enter fullscreen mode Exit fullscreen mode

/lc:generate-crud goes wider and produces the whole stack for a model, migration through views, and /lc:generate-action creates a Laractions action and registers it on the model. There is even /lc:generate-scraper, which reads a real page and fills a Larascraper class from its actual markup.

Understand an unfamiliar app

Two I reach for on a codebase I do not know yet. /lc:model-diagram renders a Mermaid ER diagram of your Eloquent models and their relationships, which is the fastest way to see how everything connects.

/lc:model-diagram
Enter fullscreen mode Exit fullscreen mode

And /lc:analyze-model Property dumps one model completely: its relationships, casts, scopes, observers and the problems it notices. When something is already broken at runtime, /lc:analyze-error takes the stacktrace and finds the root cause rather than the symptom.

Wrapping up

LaraClaude is over thirty of these, from /lc:deploy-checklist to /lc:api-docs, all following the Agent Skills standard so they are just Markdown you can read. It turns the Laravel context you keep re-explaining into commands Claude Code runs on demand.

👉 On GitHub at https://github.com/edulazaro/laraclaude

Top comments (0)