detect-complexity

Detect over-complex code using cyclomatic complexity, function length, and nesting depth.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/foolishimp/ai_sdlc_method --skill detect-complexity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: detect-complexity
Source: https://github.com/foolishimp/ai_sdlc_method/tree/main/plugins/code-skills/skills/debt/detect-complexity
Command: npx skills add https://github.com/foolishimp/ai_sdlc_method --skill detect-complexity

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires radon, pytest.

What problem does it solve?

Overly complex code is a major source of bugs, difficult to test, and expensive to maintain, violating the "Modular & Maintainable" principle. This skill identifies such areas.

Core Features & Use Cases

  • Complexity Analysis: Scans codebase for high cyclomatic complexity, excessively long functions, and deep nesting.
  • Detailed Reporting: Provides a structured report of violations with line numbers, severity, and specific issues.
  • Refactoring Suggestions: Offers concrete, actionable recommendations to simplify identified complex code.
  • Use Case: Run this skill on a new feature branch to identify any functions exceeding a cyclomatic complexity of 10 or having more than 50 lines of code, guiding refactoring efforts before merging.

Quick Start

Detect complexity violations in the current codebase, focusing on functions with cyclomatic complexity above 10.

Frequently Asked Questions about detect-complexity

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

FAQPage Schema
How do I detect overly complex functions in my codebase?

Detect complexity by analyzing cyclomatic complexity, function length, and nesting depth across your source files. This skill scans for violations—cyclomatic complexity above 10, functions exceeding 50 lines of code, or nesting deeper than 3 levels—and flags them with line numbers and severity for refactoring guidance.

What's the best way to identify code that's hard to maintain and test?

Code maintainability issues stem from high cyclomatic complexity, excessive function length, and deep nesting. This skill generates a structured report identifying these violations across your codebase with actionable remediation suggestions to simplify problematic functions before they accumulate technical debt.

Can I use complexity analysis on Python authentication and payment processing code?

Yes. This skill applies complexity analysis to Python functions and methods across any codebase, including authentication flows, payment processing, and utility modules. It uses cyclomatic complexity thresholds and function metrics to flag maintainability violations in real-world scenarios.

How do I get started analyzing code quality on a feature branch?

Run this skill on your feature branch to scan for functions exceeding cyclomatic complexity of 10 or 50 lines of code. It outputs a detailed report with violation locations, severity levels, and specific refactoring recommendations to guide cleanup before merging.

What dependencies does complexity analysis require?

Complexity analysis uses radon for cyclomatic complexity measurement and pytest for testing integration. These dependencies enable accurate detection of code metrics and support validation of refactoring changes across your Python codebase.