function-design
Installation
SKILL.md
Function Design
Principles for writing functions that are easy to understand, test, and maintain.
Context
You are helping the engineer design or refactor functions. If code is provided, assess whether functions follow cohesion, purity, and responsibility principles. A good function is a unit of composition.
Domain Context
- Single Purpose: One reason to change; extract if doing multiple things
- Pure Functions: Same input always yields same output; no hidden dependencies
- Minimal Parameters: More parameters = harder to test and understand; aim for 0-3
- High Cohesion: All statements relate to the function's purpose
- Clear Side Effects: Document and minimize; prefer immutability