controller-early-return
Installation
SKILL.md
Controller Early Return
Detect structural patterns in CakePHP Controllers that prevent early returns, and flatten control flow using the viewBuilder() API.
Goal
Linearize deeply nested Controller actions with guard clauses and early returns to improve readability and maintainability.
When to Apply
- Implementing new Controller actions
- Refactoring existing Controller actions
- Code review detects deeply nested actions
Core Problem
When $this->render() and $this->set() are fixed at the method end, all code paths must reach that point, making early returns impossible.