code-decay

Ranks repository files by churn times complexity and writes a dated Markdown hotspot report.

3|Updated Oct 28, 2020
One-click install
npx skills add https://github.com/k0d3x8its/dotfiles --skill code-decay-k0d3x8its
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: code-decay
Source: https://github.com/k0d3x8its/dotfiles/tree/main/claude/.claude/skills/code-decay
Command: npx skills add https://github.com/k0d3x8its/dotfiles --skill code-decay-k0d3x8its

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ast-grep, and includes scripts (resource) components.

What problem does it solve? Identifying which files in a codebase are decaying — frequently changed and structurally complex — requires manually correlating git history with code complexity, which is tedious and error-prone across large repositories. ## Core Features & Use Cases - Hotspot Ranking: Computes score = churn × complexity for every tracked file, using git log for churn and ast-grep (with a regex/indent proxy fallback) for complexity. - Heuristic Labeling: Flags outliers as God Class, Shotgun Surgery, or Dormant Complexity using percentiles of the repo's own distribution. - Optional Model Review: The --interpret flag sends top-scoring files to a model pass that confirms, corrects, or drops heuristic labels before rendering. - Use Case: Run /code-decay against a legacy repo to produce docs/code-decay/<repo>-<date>.md, a ranked table showing which files carry the highest maintenance risk and deserve refactoring attention first. ## Quick Start Ask the AI to run /code-decay on a target repository path to generate a ranked hotspot report inside that repo's docs/code-decay directory.

Frequently Asked Questions about code-decay

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

FAQPage Schema
How do I find code hotspots in a git repository?▼

Run /code-decay with the repository path to rank every tracked file by score = churn × complexity. Churn comes from git log history and complexity from ast-grep branch and nesting analysis, producing a dated Markdown report in docs/code-decay inside that repo.

What does the code-decay score mean for refactoring priority?▼

The score multiplies a file's churn count by its complexity value (branch count plus nesting depth), so files that change often and are structurally complex rank highest. Labels like God Class, Shotgun Surgery, and Dormant Complexity highlight percentile-based outliers.

Which languages does ast-grep complexity analysis support?▼

The ast-grep backend covers Python, JavaScript, TypeScript, TSX, Lua, Bash, C, C++, and Solidity. Any other file type falls back to a regex and indentation-based proxy backend that always returns a complexity estimate without erroring.

Can code-decay analyze multiple repositories in one run?▼

No, each run analyzes exactly one repository and never merges history or scores across repos. Run the skill separately per repository; each report is written inside the analyzed repo, not a shared location.

What happens when code-decay runs on a shallow git clone?▼

The run continues with a warning rather than stopping. The shallow-clone warning is written into the report body itself, noting that churn numbers reflect only the truncated history and may understate real hotspots.

Why does code-decay fail when ast-grep is missing?▼

A missing or broken ast-grep binary fails loudly by design for supported languages. A silent fallback to the rougher proxy backend would disguise a broken installation as an accuracy problem, so the error must be fixed instead.