Function Design

Designing pure functions with single purpose, minimal parameters, clear side effects, and high cohesion.

48 stars 10 forksOther Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill function-design
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/engineer/code-quality/skills/function-design ~/.claude/skills/function-design

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the 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

## Instructions

1. **Identify Purpose**: Can you explain the function in one sentence? If not, it's doing too much
2. **Count Parameters**: Refactor if > 3; use Parameter Object or method extraction
3. **Check for Side Effects**: Does it modify global state? Database? Output? Document explicitly
4. **Verify Purity**: Same inputs = same outputs? If not, document the dependency
5. **Measure Cohesion**: Do all lines support the stated purpose? If not, extract
6. **Review Return Value**: Does it return useful information or just status? Prefer returning data
7. **Check Error Handling**: Are failure cases explicit? Return errors, don't swallow silently
8. **Test Independence**: Can you test this function without mocks or fixtures? If not, refactor

## Anti-Patterns
Read the full skill on GitHub

Details

Skill name
function-design
Path
engineer/code-quality/skills/function-design/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the Function Design skill do?

Designing pure functions with single purpose, minimal parameters, clear side effects, and high cohesion.

How do I install the Function Design skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Function Design popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.