refactor:laravel
CommunityRefactor Laravel for cleaner, maintainable code.
System Documentation
What problem does it solve?
This Skill helps Laravel projects shed fat controllers, duplicated logic, and inconsistent patterns by applying modern PHP 8.3+/8.4+ features and Laravel 11+ best practices. It enables teams to produce clean, maintainable code with clear responsibilities, strong typing, and modular architecture.
Core Features & Use Cases
- Extract business logic from controllers into single-purpose actions or services to follow the Single Responsibility Principle.
- Introduce modern PHP features (typed constants, property hooks) and Laravel 11+ patterns (Actions, simplified structure) to reduce boilerplate.
- Identify and address common anti-patterns (fat controllers, N+1 queries, missing type declarations) and retrofit with clean architecture.
- Use cases: refactor a legacy controller into a thin controller + actions/services, or gradually migrate to domain-driven structure with tests.
Quick Start
Start by locating a fatty controller (e.g., app/Http/Controllers/AuthController), create a dedicated Action or Service, inject it into the controller, and progressively move logic with type declarations. Then run your Pest/PHPUnit tests to ensure behavior remains unchanged.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: refactor:laravel Download link: https://github.com/SnakeO/claude-debug-and-refactor-skills-plugin/archive/main.zip#refactor-laravel Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.