custom-laravel-coding

Applies Laravel PHP coding conventions during implementation and refactoring of backend application logic.

1|Updated Apr 3, 2021
One-click install
npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-laravel-coding-naoyamiyagawa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: custom-laravel-coding
Source: https://github.com/NaoyaMiyagawa/dotfiles/tree/main/.ai/skills/custom-laravel-coding
Command: npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-laravel-coding-naoyamiyagawa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Laravel codebases drift into inconsistent patterns when multiple contributors write controllers, models, and services without a shared style contract, making reviews slow and error-prone. This Skill encodes a project's Laravel conventions as enforceable rules so generated or refactored PHP matches existing patterns on the first pass. ## Core Features & Use Cases - Fifteen core coding rules: Covers guard clauses, collection pipelines, Eloquent idioms, FormRequest validation, exception handling, routing, naming, and enum usage with concrete good/bad PHP examples. - Long-tail review checklist: A references/checklist.md file holds detailed rules for formatting, PHPDoc typing, migrations, policies, API resources, queues, and config that the mandatory review gate enforces before presenting changes. - Tooling migration map: references/tooling-candidates.md tracks which mechanical rules should move into Pint, PHPStan, or Rector so the checklist shrinks as automation grows. - Use Case: When asked to add a new API endpoint, the Skill writes the FormRequest, single-action controller, route registration, and Eloquent query following project conventions, then self-reviews the diff against the checklist before presenting it. ## Quick Start Ask the AI to implement or refactor a Laravel controller, model, action, or service following the project's coding conventions and run the mandatory review gate on the diff.

Frequently Asked Questions about custom-laravel-coding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Laravel coding conventions in AI-generated code?

Load this Skill before implementing or refactoring Laravel code. It applies fifteen core rules covering guard clauses, Eloquent idioms, FormRequests, and naming, then runs a mandatory review gate that checks the diff against an extended checklist before presenting changes.

What Laravel coding standards does this Skill cover?

It covers collection pipelines over array functions, FormRequest validation, named-constructor exceptions, route-model binding, enum-driven design, immutable datetime casts, bulk inserts, and PHPDoc typing with list and array-shape syntax. The checklist adds rules for migrations, policies, queues, and API resources.

Does this Skill work with Laravel Pint, PHPStan, or Rector?

Yes, it includes a tooling-candidates map that pairs mechanical rules with candidate Pint, PHPStan, or Rector enforcement. When a rule lands in tooling, it is removed from the checklist so automated and manual enforcement stay in sync.

When should I not use these Laravel conventions?

The rules assume a convention-heavy Laravel project with FormRequests, action classes, and enum-driven domains. They are less suitable for non-Laravel PHP frameworks, quick prototypes without review requirements, or projects following a different established style guide.

How does the mandatory review gate work?

After changing PHP, the diff is reviewed against the core rules and references/checklist.md before being presented. Non-trivial diffs are offloaded to a separate review pass per the project's Codex rules, while small diffs are reviewed in-session, and violations are fixed before delivery.