# Complexity Guardrails

> Complexity Guardrails

- Skill: `comeonoliver/complexity-guardrails` (Agent Skill)
- Install (CLI): `npx skillmds@latest add comeonoliver/complexity-guardrails`
- Raw SKILL.md: https://api.skillmd.com/api/skills/comeonoliver/complexity-guardrails/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ComeOnOliver (https://skillmd.com/u/comeonoliver)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/comeonoliver/complexity-guardrails

---

# Complexity Guardrails

Design to keep complexity low from day one.

## Targets

- Cyclomatic complexity per function ≤ 7 (start splitting at 5)
- Function length ≤ 80 lines (aim for ≤ 30)
- One responsibility per function; one axis of variation per module

## Tactics

- Use early returns and guard clauses; avoid deep nesting
- Extract branch bodies into named helpers
- Replace long if/else/switch with tables (maps) or strategies
- Separate phases: parse → validate → normalize → act

## Signs to refactor now

- Hard-to-test code paths
- Repeated conditionals with subtle differences
- Mixed concerns (IO, validation, transformation) in one method

