Analyze code complexity and find refactor targets using radon/gocyclo
View on GitHubboshu2/agentops
vibe-kit
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/boshu2/agentops/blob/main/plugins/vibe-kit/skills/complexity/SKILL.md -a claude-code --skill complexityInstallation paths:
.claude/skills/complexity/# Complexity Analysis Skill Analyze code complexity using `radon` (Python) and `gocyclo` (Go) to identify functions that need refactoring. **Supported Languages:** Python, Go ## Overview This skill provides comprehensive code complexity analysis: - Run `radon cc` on target paths - Interpret complexity grades (A-F) - Identify refactoring candidates - Generate actionable recommendations - Support enforcement checks via `xenon` --- ## Phase 1: Determine Scope ### If Path Provided ```bash # Validate the path exists ls -d "$PATH" ``` ### If No Path (Default) Analyze all Python services: ``` services/ ``` --- ## Phase 2: Run Complexity Analysis ### Python (radon) ```bash # Show complexity for all Python files with summary radon cc <path> -s -a # For single file radon cc <path/to/file.py> -s ``` **Output Format** - `radon cc` outputs lines like: ``` F 179:0 sync_gitlab - F (84) C 35:0 validate_input - C (12) A 117:4 embed_document - A (3) ``` Format: `<Grade> <line>:<col> <function_name> - <Grade> (<complexity>)` ### Go (gocyclo) ```bash # Show all functions with CC > 10 gocyclo -over 10 <path> # Top 10 most complex functions gocyclo -top 10 <path> # All functions sorted by complexity gocyclo <path> | sort -rn ``` **Output Format** - `gocyclo` outputs lines like: ``` 58 cmd runSling /path/to/sling.go:128:1 28 cmd formatLogLine /path/to/logger.go:110:1 ``` Format: `<complexity> <package> <function> <file>:<line>:<col>` **Install**: ```bash go install github.com/fzipp/gocyclo/cmd/gocyclo@latest ``` --- ## Phase 3: Interpret Results ### Complexity Grades Reference | Grade | CC Range | Status | Action | |-------|----------|--------|--------| | **A** | 1-5 | Ideal | No action needed | | **B** | 6-10 | Acceptable | No action needed | | **C** | 11-20 | Complex | Refactor when touching this code | | **D** | 21-30 | Very Complex | Should refactor soon | | **E** | 31-40 | Extremely Complex | Urgent refactor needed | | **F** | 41+ | Unmaintainable | Critical