complexity-reducelisted
Install: claude install-skill manastalukdar/ai-devstudio
# Cyclomatic Complexity Reduction
I'll analyze your code for high cyclomatic complexity, identify complex functions and methods, and suggest targeted refactoring strategies to improve maintainability.
**Supported Languages:**
- JavaScript/TypeScript (ESLint complexity rules)
- Python (Radon, mccabe)
- Go (gocyclo)
- Java (Checkstyle complexity)
## Token Optimization
This skill uses complexity analysis-specific patterns to minimize token usage:
### 1. Language Detection Caching (600 token savings)
**Pattern:** Cache detected languages and tool configurations
- Store detection in `.complexity-language-cache` (1 hour TTL)
- Cache: languages, complexity tools, thresholds, source directories
- Read cached config on subsequent runs (50 tokens vs 650 tokens fresh)
- Invalidate on package.json/config file changes
- **Savings:** 92% on repeat complexity checks
### 2. Bash-Based Complexity Tool Execution (1,500 token savings)
**Pattern:** Use eslint/radon/gocyclo directly via bash
- JavaScript: `eslint --format json` (300 tokens)
- Python: `radon cc --json` (300 tokens)
- Go: `gocyclo -over 10` (300 tokens)
- Parse JSON output with jq
- No Task agents for complexity analysis
- **Savings:** 85% vs Task-based complexity detection
### 3. Sample-Based Function Analysis (1,000 token savings)
**Pattern:** Analyze top 10 most complex functions only
- Sort by complexity, show top 10 (600 tokens)
- Detailed analysis for top offenders only
- Full analysis via `--all` flag
- **Savings:** 7