code-structure
Installation
SKILL.md
Code Structure — Responsibility & Abstraction
Two complementary disciplines decide how code is shaped. They pull in opposite directions, and good structure is the balance between them:
- Single Responsibility (SRP) — when to split. One unit, one job, one reason to change.
- Avoid Hasty Abstractions (AHA) — when not to extract. Duplication is cheap; the wrong abstraction is expensive.
The synthesis: split on responsibility, never on shape or line count alone. SRP tells you to separate two jobs that happen to sit in one file; AHA tells you not to merge two blocks that merely look alike.
Quick Reference — When to Load What
| Working on… | Read |
|---|---|
| Splitting a file/function/class, separating concerns, file size | SINGLE-RESPONSIBILITY.md |
| Tempted to extract a helper/base class/utility from duplicated code | AVOID-ABSTRACTIONS.md |
Hard Limits
Concrete, enforceable thresholds. Crossing one is a signal to split — not an automatic split, but a prompt to check for a second responsibility.