Where this fits
You're a Laravel dev who just asked an AI agent to refactor a controller. It returns code that works but violates typical Laravel conventions—fat models, N+1 queries, inline validation. You end up rewriting more than you saved. The laravel-best-practices skill fixes this by giving agents a rule-based framework that enforces Laravel idioms across controllers, Eloquent, policies, and queues.
Why agents benefit
- Agents apply consistent rules: The skill provides a structured index of best practices, so agents know when to use Form Requests vs inline validation, when to extract service classes, and how to structure Eloquent queries.
- They catch performance traps early: N+1 detection, missing index hints, and query caching are explicitly covered, so agents can proactively suggest
with()orcache()calls. - Security patterns are enforced: Authorization with policies, mass-assignment protection, and safe error handling become non-negotiable rules rather than afterthoughts.
- Refactoring follows existing conventions: The skill instructs agents to check sibling files first, ensuring new code matches the codebase's style, not just generic Laravel docs.
- Code review improvements: Agents can act as a senior reviewer, flagging deviations from the skill's rules and offering targeted fixes.
Practical scenarios
Refactoring a bloated controller
An agent using this skill reads a 500-line controller and identifies that business logic belongs in a service class. It suggests steps to extract the logic, moves validation to a Form Request, and updates the route definition—all while matching the existing project's service injection pattern.
Optimizing a report query with N+1
You have an index page that loops through users and fetches posts for each. The agent flags the N+1, rewrites the query using with('posts'), and adds caching with remember() for heavy aggregates. It also remembers to check for similar patterns in the codebase.
Implementing authorization on a new endpoint
When creating a route that deletes a resource, the agent automatically suggests a policy, checks the Gate definitions in the app, and writes the authorize call. It then verifies that the controller method uses the policy correctly.
Add it to your agent workflow
Install with:
npx skills add promovaweb/specsfy --skill laravel-best-practices
Then, in your agent prompt, simply say: "Refactor this controller following Laravel best practices." The skill will auto-load (assuming your agent supports skills) and apply its rules. For a quick check, ask: "Review UserController@update for N+1s and security."
Compare before adopting
Before committing, look at how actively the skill is maintained (check commit frequency and issue responses). Compare with alternatives like laravel-lint or manual prompt instructions—does this skill offer structured rules rather than vague guidelines? Ensure it fits your agent framework (e.g., Claude Skills, OpenAI custom instructions) and that the rule files are readable for your use case.
Why it is worth tracking
With 60 stars and a clear focus on security and performance, this skill is gaining traction in the agent ecosystem. It's a concrete example of how domain-specific skills can elevate AI code generation. Track it if you work with Laravel and want agents to produce production-ready code—revisit it as the rule index expands and community feedback is incorporated. For more details, see the listing on OpenAgentSkill.