A Claude Code Agent Skill that restructures a codebase by applying the Single Responsibility Principle — one extraction per cycle, verify, commit, reassess. It changes the shape of a system (module and class boundaries) rather than the internals of any one function.
Restructure modules by applying the Single Responsibility Principle — one extraction per cycle, commit, reassess. Triggers on "restructure", "split this module", "SRP refactor".
This repository is a portfolio example of an Agent Skill I designed and built. It's extracted from a larger private skill library; the sibling skills and reference docs it depends on are vendored here (under skills/ and docs/) so every cross-reference resolves and you can read it as it actually runs.
Given a module that has grown to hold several responsibilities, the skill runs a disciplined loop:
- Assess — score each file for structural tension (complexity × churn), so effort lands where it pays.
- Pick one extraction — the single highest-priority split, chosen by an explicit lexicographic rule, not a vibe.
- Execute in a fresh sub-agent — no accumulated context to bias the change.
- Verify against a gate — the change must match its stated intent before it lands.
- Commit atomically, then reassess — the next cycle starts from the new reality, never a stale plan.
The design choice throughout: make future change easier, one small reversible step at a time.
| Piece | What it demonstrates |
|---|---|
skills/restructure/SKILL.md |
The stable principles — the entry point Claude reads first |
WORKFLOW.md |
The orchestrator + fresh-sub-agent execution model, phase by phase |
PRIORITIES.md |
The lexicographic priority ladder — check one thing at a time, act on the highest that fires |
scripts/tension_score.py |
Deterministic Python scoring (complexity × churn), with a passing unit-test suite |
reference/ |
The design rationale — including a post-mortem on a taxonomy approach that didn't converge |
The architecture leans on a few reusable patterns, all included here as context: an orchestrator + sub-agent execution model, a loop-until-satisfied verification gate, and the restructuring-vs-refactoring distinction that defines the skill's boundary.
cd skills/restructure/scripts
python3 -m pytest tests/ -qskills/
restructure/ the skill itself — SKILL, WORKFLOW, PREPARE, PRIORITIES, reference/, scripts/
srp/ agility/ ... sibling skills it references, vendored so links resolve
docs/ the patterns, distinctions, and principles it builds on
skills/restructure/ is the work. Everything else is the surrounding context, included verbatim so nothing is a dead link.
Built by Mike Mindel.
MIT.