single-responsibility
Installation
SKILL.md
Single Responsibility Principle (Language-Agnostic)
Every file, function, class, and module does one thing. If you can describe it with "and", split it.
A unit should have one reason to change — it serves one actor or stakeholder. If changes from the business team AND the ops team both require editing the same file, that file has two responsibilities.
Hard Limits
| Metric | Max | Action |
|---|---|---|
| File length | 200 lines | Split into smaller modules |
| Function/method body | 30 lines | Extract helpers |
| Function parameters | 3 | Use an options/config object |
| Nesting depth | 3 levels | Extract early returns or helpers |
| Cyclomatic complexity | 5 branches | Simplify or split logic |
| Class dependencies | 5 imports | Class knows too much — split it |