/code-metrics-tracker:code-metrics-trackerfrom Code Metrics: Complexity and Duplication Report
Measures cyclomatic complexity, code size, and duplication across multiple languages. Helps identify what to refactor by ranking candidates by complexity, churn, and test coverage.
Ships in Code Metrics: Complexity and Duplication Report. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Scripts: ${CLAUDE_SKILL_DIR} is the folder that contains this file. If your agent does not define it, use the folder where this SKILL.md is located.
Measure complexity, size and duplication, find the code worth refactoring, and track the numbers over time.
python3 ${CLAUDE_SKILL_DIR}/scripts/metrics.py <dir>
python3 ${CLAUDE_SKILL_DIR}/scripts/metrics.py src --threshold 15 --dup-lines 8
The report shows:
Python is measured exactly with ast. JavaScript, TypeScript, Java, Kotlin, C#, Go, PHP, Rust, Swift, C and C++ are measured by counting branches (if, loops, case, catch, &&, ||, ??, ternaries) inside each function, which is close to ESLint's complexity rule but not identical. Vendor, build, generated and migration folders are skipped.
python3 ${CLAUDE_SKILL_DIR}/scripts/metrics.py src --save .metrics/2026-10-03.json
python3 ${CLAUDE_SKILL_DIR}/scripts/metrics.py src --compare .metrics/2026-10-03.json
--compare shows the change in every total and lists the functions that became more complex. To compare with an older commit without a saved snapshot, check it out in a temporary worktree (git worktree add /tmp/old <ref>), run with --save there, then remove the worktree.
Complexity alone does not make code a problem. Rank candidates by:
git log --since="6 months ago" --name-only --format= | sort | uniq -c | sort -rn | head -30. A complex file that nobody touches is low priority; a complex file changed every week is where bugs come from.Give a short table of the top 5 to 10 candidates with complexity, length, churn and the reason, then a concrete first step for each (extract function, replace conditional chain with a lookup table, early returns, merge duplicated block into one function). Do not refactor without being asked; when asked, change one function at a time and run the tests after each step.
Avoid scores that sound more precise than they are. Report the measured numbers and explain them.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Python, JavaScript, TypeScript, Java, Kotlin, C#, Go, PHP
npx claudepluginhub petrovicistefan/claude-code-plugins --plugin code-metrics-trackerOther plugins' skills for the same job