L
laravel:complexity-guardrails
About laravel:complexity-guardrails
A complexity-management skill for Laravel developers, with design targets for functions and modules and signs that code needs refactoring. It suggests early returns, helper extraction, and phased processing to keep complexity in check.
Key features
- 01Set complexity and function-length targets
- 02Keep one responsibility per function
- 03Use early returns and guard clauses
- 04Extract branches into named helpers
- 05Organize processing into phases
Use cases
- 01Split hard-to-test code paths
- 02Refactor subtly different repeated conditionals
- 03Separate I/O, validation, and transformation
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ jpcaparas/ superpowers-laravel --skill laravel:complexity-guardrailsAfter installing, type/laravel:complexity-guardrailsin Claude Code to confirm it loaded.
Details
From the project READMEComplexity Guardrails
Design to keep complexity low from day one.
Targets
- Cyclomatic complexity per function ≤ 7 (start splitting at 5)
- Function length ≤ 80 lines (aim for ≤ 30)
- One responsibility per function; one axis of variation per module
Tactics
- Use early returns and guard clauses; avoid deep nesting
- Extract branch bodies into named helpers
- Replace long if/else/switch with tables (maps) or strategies
- Separate phases: parse → validate → normalize → act
Signs to refactor now
- Hard-to-test code paths
- Repeated conditionals with subtle differences
- Mixed concerns (IO, validation, transformation) in one method
Comments
Markdown supported