reviewing-complexity

Identifies hard-to-maintain code by calculating cyclomatic complexity and related metrics.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/djankies/claude-configs --skill reviewing-complexity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reviewing-complexity
Source: https://github.com/djankies/claude-configs/tree/main/review/skills/reviewing-complexity
Command: npx skills add https://github.com/djankies/claude-configs --skill reviewing-complexity

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

High code complexity (e.g., high cyclomatic complexity, long functions, deep nesting) leads to hard-to-maintain code, increased bugs, and technical debt. This Skill helps you identify and address these complexity hotspots.

Core Features & Use Cases

  • Automated Complexity Analysis: Runs tools like Lizard to measure cyclomatic complexity (CCN), lines of code (NLOC), and nesting depth.
  • Manual Detection Patterns: Provides grep patterns to identify deep nesting, long conditional chains, and high parameter counts.
  • Complexity Sources Identification: Helps pinpoint specific causes of complexity, such as multiple responsibilities or mixed abstraction levels.
  • Refactoring Patterns: Suggests concrete refactoring strategies like "Extract Method," "Guard Clauses," or "Parameter Object" to simplify complex code.
  • Use Case: Analyze the src/utils/dataProcessor.ts file for code complexity, identifying functions with high cyclomatic complexity or excessive length, and suggest specific refactoring patterns to improve maintainability.

Quick Start

Run bash ~/.claude/plugins/cache/review/scripts/review-complexity.sh to get a complexity report for the project.

Frequently Asked Questions about reviewing-complexity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify functions with high cyclomatic complexity in my codebase?

Cyclomatic complexity measures code branching paths. Use Lizard to automatically calculate CCN (cyclomatic complexity number) across your codebase, identifying functions with excessive decision points that indicate maintainability issues and refactoring needs.

What metrics does automated code complexity analysis measure?

Automated complexity analysis measures cyclomatic complexity (CCN), lines of non-comment code (NLOC), nesting depth, cognitive load, token count, parameter count, and function length to pinpoint hard-to-maintain code across your project.

How can I find deeply nested code and long conditional chains?

Manual detection patterns use grep-based searching to locate deep nesting and complex conditional chains that resist automated tools. Combined with automated metrics, this identifies specific complexity sources causing maintainability problems.

What refactoring patterns help simplify complex functions?

Common refactoring strategies for complexity include Extract Method to reduce function length, Guard Clauses to flatten conditionals, and Parameter Object to reduce parameter counts, directly addressing identified complexity hotspots.

Can I use complexity analysis for code reviews and technical debt assessment?

Yes. Complexity analysis is designed for code reviews and technical debt planning, automatically generating reports that pinpoint refactoring priorities and help teams track maintainability improvements across sprints.

What happens if I have mixed abstraction levels or multiple responsibilities in one function?

Functions mixing responsibilities or abstraction levels show elevated complexity metrics. The Skill identifies these causes, enabling targeted refactoring to extract separate concerns and reduce cognitive load in complex code.