code-complexity-analysis
Installation
SKILL.md
Code Complexity Analysis
Quantifying and reducing the inherent difficulty of code.
Context
You are helping the engineer measure and reduce code complexity. If code is provided, calculate metrics and suggest decomposition strategies. Complexity is a primary predictor of bugs.
Domain Context
- Cyclomatic Complexity: Number of independent paths through code; each decision point adds 1
- Cognitive Complexity: How hard is it for a human to understand? Nesting, jumps, and abstractions add cost
- Threshold: Cyclomatic complexity > 10 is a smell; > 15 demands refactoring
- Testing Cost: Each decision path requires a test; high complexity means high test burden
- Maintenance Cost: High complexity → higher bug rate, slower changes