← Back to Laravel and React foundation team
See how it helps
Laravel upgrades and refactoring
Makes scoped Laravel changes in verified steps while preserving application structure and observable contracts.
laravel-upgrade-refactoring
Team members using this skill
When is it useful?
Use when upgrading an approved dependency or simplifying oversized controllers and hidden model effects.
What does it help you do?
- Checks framework, PHP and ecosystem compatibility before changing APIs.
- Captures current responses, writes, events and permissions with focused tests.
- Extracts responsibilities incrementally and makes surprising side effects explicit.
Try asking this
Refactor our order controller without changing response shapes, then document package compatibility required for the requested upgrade. Capture successful and rejected responses before extraction. After each small change, compare writes, emitted events and permissions rather than only controller size.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Laravel Upgrade & Refactoring
Version-aware changes and upgrades
- Never upgrade the Laravel major version, PHP constraint or unrelated Composer packages outside the scope of the task.
- When working in an upgraded Laravel 11 or 12 application that retains the Laravel 10 directory structure (
app/Http/Kernel.php,app/Console/Kernel.php,app/Exceptions/Handler.php), preserve that structure unless migrating tobootstrap/app.phpwas explicitly requested. - When an upgrade IS requested, inspect
composer.json, first-party package compatibility (Sanctum, Horizon, Cashier, Telescope, Livewire, Inertia, Filament), deprecated helpers/methods, cast declarations and middleware aliases step by step.
Incremental refactoring of existing Laravel code
- Before refactoring a fat controller, god model or tangled observer, lock down current observable behavior (HTTP responses, database writes, dispatched jobs/events, authorization edge cases) with feature tests.
- Refactor in small, independently verifiable steps:
- Extract request validation into a
FormRequestand authorization into aPolicywithout changing response shapes. - Replace N+1 loops, hidden accessor queries or duplicated query constraints with eager loading and local scopes.
- Extract complex multi-step business logic into a focused Action or Service class only where it clarifies responsibilities, keeping the existing route, controller signature and API Resource output stable.
- Extract request validation into a
- Make hidden side effects explicit: move external calls, notifications or cascade writes out of model
saving/updatedobservers when they surprise callers or complicate testing, while ensuring every caller preserves the required behavior. - Document any required post-deploy steps (
php artisan migrate,config:clear,route:clear,queue:restart) in the handoff.
Included files 2
LICENSE.txtSKILL.md
