complexity-reducer

Community

Reduce code complexity with actionable refactoring plans.

Authorrobotijn
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill eliminates the guesswork and regression risk of refactoring complex, hard-to-maintain code by providing step-by-step, behaviour-preserving refactoring plans with measurable complexity reduction targets.

Core Features & Use Cases

  • Quantified Refactoring Plans: Calculates exact cyclomatic and cognitive complexity before and after each refactoring step, with clear effort estimates and risk ratings.
  • Multi-Language Pattern Catalog: Includes before/after examples and AST-based codemod recipes for 7 languages (C#, Java, Python, C, C++, TypeScript, SQL) aligned with Fowler's refactoring best practices.
  • Safety Guardrails: Enforces an 80% test coverage prerequisite before recommending refactors, and grades finding severity based on impact to current development workflows.
  • Use Case: For a 95-LOC payment processing function with a cyclomatic complexity of 18 and 4 levels of nested conditionals, use this skill to get a plan that reduces complexity by 75%, includes guard clause extractions, and provides a libCST codemod for repeated conditional patterns across the codebase.

Quick Start

Use the complexity-reducer skill to generate a refactoring plan for the complex validate_order function in src/orders/validator.py, including quantified complexity metrics and codemod recipes for repeated type-checking conditionals.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: complexity-reducer
Download link: https://github.com/robotijn/ctoc/archive/main.zip#complexity-reducer

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.