code-hotspots
Installation
SKILL.md
Code hotspots
Complexity costs money only in code that changes. A gnarly file untouched for four years costs nothing. A moderately complex file edited twice a week absorbs the bugs and the time.
So the ranking signal is not complexity:
hotspot = change frequency x complexity
Git already recorded which code is hard, for free. Every commit to a file is evidence that somebody had to understand it. This is behavioral code analysis, from Adam Tornhill's Your Code as a Crime Scene.
Step 1: change frequency
git log --format=format: --name-only --since=12.months \
-- ':!*lock*' ':!*generated*' ':!vendor/*' ':!*.snap' \
| sed '/^$/d' | sort | uniq -c | sort -rn | head -25
Use a 6 to 12 month window, matching how far back the team remembers. Longer windows include code that has since stabilized. Exclude lockfiles, generated code, vendored directories, and snapshots.