/analyze-complexity
Calculate cyclomatic complexity and identify overly complex functions.
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/analyze-complexity
Context preview
What this command does when you run it.
Calculate cyclomatic complexity and identify overly complex functions.
Command definition
analyze-complexity.md/analyze-complexity - Analyze Code Complexity
Calculate cyclomatic complexity and identify overly complex functions.
Steps
1. Detect the project language to select the appropriate complexity analysis tool 2. Scan all source files excluding tests, vendor, and generated code 3. Calculate cyclomatic complexity for each function and method 4. Calculate cognitive complexity as a secondary metric 5. Identify functions exceeding the threshold (default: cyclomatic > 10) 6. Rank the top 20 most complex functions by complexity score 7. For each complex function, identify the complexity drivers: nested conditionals, switch cases, loops 8. Calculate file-level complexity averages and identify the most complex files 9. Compare against industry benchmarks: low (1-5), moderate (6-10), high (11-20), very high (21+) 10. Generate a formatted report with function name, file, line, complexity score 11. Suggest specific refactoring strategies for the top 5 most complex functions 12. Save the report and track complexity trends over time
Rules
- Use cyclomatic complexity as the primary metric
- Include cognitive complexity as a complementary measure
- Exclude generated code, migrations, and configuration files
- Threshold of 10 for warnings, 20 for critical flags
- Consider function length alongside complexity (long + complex = priority)
- Do not count simple switch/case with returns as highly complex
- Report both absolute values and percentile rankings
Read more
/analyze-complexity - Analyze Code Complexity
Calculate cyclomatic complexity and identify overly complex functions.
Steps
1. Detect the project language to select the appropriate complexity analysis tool 2. Scan all source files excluding tests, vendor, and generated code 3. Calculate cyclomatic complexity for each function and method 4. Calculate cognitive complexity as a secondary metric 5. Identify functions exceeding the threshold (default: cyclomatic > 10) 6. Rank the top 20 most complex functions by complexity score 7. For each complex function, identify the complexity drivers: nested conditionals, switch cases, loops 8. Calculate file-level complexity averages and identify the most complex files 9. Compare against industry benchmarks: low (1-5), moderate (6-10), high (11-20), very high (21+) 10. Generate a formatted report with function name, file, line, complexity score 11. Suggest specific refactoring strategies for the top 5 most complex functions 12. Save the report and track complexity trends over time
Rules
- Use cyclomatic complexity as the primary metric
- Include cognitive complexity as a complementary measure
- Exclude generated code, migrations, and configuration files
- Threshold of 10 for warnings, 20 for critical flags
- Consider function length alongside complexity (long + complex = priority)
- Do not count simple switch/case with returns as highly complex
- Report both absolute values and percentile rankings
The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills (+400,000 via SkillKit), 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 15 MCP configs, 26 companion apps, 53 ecosystem entries, and more.
Repo: rohitg00/awesome-claude-code-toolkit
Other commands on rohitg00-claude-code-toolkit.
- /adr
Write an Architecture Decision Record documenting a significant technical decision.
Open command - /design-review
Conduct a structured design review of a module, feature, or system component.
Open command - /diagram
Generate Mermaid diagrams from codebase analysis or description.
Open command - /migrate
Plan and execute a framework or library migration incrementally.
Open command - /plan
Create a structured implementation plan for the requested feature or change.
Open command - /refactor
Perform a systematic refactoring of the specified code area.
Open command

