Skip to content
项目

saurabhkumar8112/cyclomatic-complexity-skill

在 GitHub 查看

关于

Claude 技能:重构代码以降低圈复杂度

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

cyclomatic-complexity

A Claude skill that refactors code to reduce cyclomatic complexity. Built for AI-generated code: it works, but branches like a jungle. This skill makes Claude measure complexity, refactor hotspots, and keep code maintainable for humans and the long-term vision of the codebase.

What it does

  • Measures cyclomatic complexity per function (radon, eslint, gocyclo, lizard, or manual count)
  • Respects your project's own linter thresholds when configured
  • Refactors worst hotspots first: guard clauses, extract function, lookup tables, named predicates
  • Refuses to game the metric. Complexity moves into well-named functions, not into clever one-liners
  • Ends every refactor with a before/after complexity table

Install

Claude Code

/plugin marketplace add saurabhkumar8112/cyclomatic-complexity-skill
/plugin install cyclomatic-complexity@cyclomatic-complexity-skill

Claude.ai

Download the .skill file from Releases (or zip the skills/cyclomatic-complexity folder) and upload it under Settings → Capabilities → Skills.

Claude API

Upload via the Skills API.

Usage

Triggers automatically on refactoring, cleanup, and code review requests. Or invoke directly:

"Use the cyclomatic complexity skill to refactor parser.py"

Example output

## Complexity report
| Function | Before | After |
|----------|--------|-------|
| parseOrder | 14 | 4 |

Extracted: validateHeader, resolveDiscount
Behavior verified: existing test suite passes

License

Apache 2.0

探索相关项目

加载中…