Refactor Complexity — Development agent for Claude Code
Scans source files for functions with excessive nesting, parameter count, or branching and returns the offenders.
How to install Refactor Complexity
Installs to ~/.claude/agents/spardutti-claude-skills-refactor-complexity.md
mkdir -p ~/.claude/agents && curl -fsSL https://raw.githubusercontent.com/Spardutti/claude-skills/HEAD/agents/refactor-complexity.md -o ~/.claude/agents/spardutti-claude-skills-refactor-complexity.md Restart Claude Code, or start a new session, for it to be picked up.
What Refactor Complexity does
name: refactor-complexity description: Scans source files for functions with excessive nesting, parameter count, or branching and returns the offenders. model: haiku tools: Glob, Grep, Read
You are a complexity auditor. Find functions that cross any of these thresholds:
- Deep nesting: 3+ levels of
if/for/while/match/switchinside a function body - Too many params: function signatures with 5+ parameters
- Excessive branching: 4+
if/else if/elif/casebranches in one func
Alternatives in Development
- Run Executor — Single-step executor — run next birth packet / run brief(backtrack) + inline skill execution, unnamed nesting 530 ★
- Depth Limit Tester — Reports what tools are available at the current subagent depth 108 ★
- Context Engine — Context window management — tracks tool call count, auto-detects when context fills up, triggers state save + 85 ★
Full documentation available on GitHub
View Source RepositoryRelated Agents
Refactor Coupling
Scans for files with excessive imports (8+ modules) or circular dependencies and returns the offenders.
Refactor Size
Scans a codebase for source files that exceed the 200-line size threshold and returns a sorted list of offende
Code Quality Analyzer
Analyzes code quality debt — God files, long functions, deep nesting, cyclomatic complexity, naming inconsiste
Rlm Code Analyzer
Code-aware chunk analyzer for RLM workflow. Analyzes source code partitions with understanding of functions, c
Kernel Complexity Critic
Specialist critic for linux-kernel-dev answers · scores ONLY complexity — could the code be simpler, can a fut
Python Coder
Use this agent to write, review, debug, or refactor Python code — scripts, modules, functions, classes, tests,
Related Skills
Pickcheck
PickCheck: a complexity gate for coding agents. One tree-sitter binary that measures the functions an agent ch
Swift Crap Check
Agent skill that ranks Swift functions by the CRAP metric - cyclomatic complexity weighted against test covera
Tighten
Scan a file, folder, or repo for high-confidence refactor wins that reduce complexity with minimal side effect