Analyze Git history to uncover “logical coupling” (files that always change together) and “hotspots” (frequently modified, complex modules). Based on Adam Tornhill’s Your Code as a Crime Scene.
“History doesn’t repeat itself, but it rhymes. Static analysis tells you structure; Git forensics tells you the painful truth.” — Adam Tornhill
This skill is based on Adam Tornhill’s Your Code as a Crime Scene methodology. Core idea: a system’s evolution history reveals design problems better than the code alone.
[!IMPORTANT] Before performing any analysis, you must invoke the
mcp_sequential-thinking_sequentialthinkingtool and reason for 3–10 steps, or more if needed.Example thinking prompts:
- “How deep is this project’s Git history? Do I need
git fetch --unshallow?”- “Which time window should I focus on? (Last 3 months? 1 year?)”
- “Are there obvious noise files (e.g.
package-lock.json) that must be excluded?”
Coupling analysis
python scripts/git_forensics.py --repo . --threshold 0.3
Hotspot detection
python scripts/git_hotspots.py --repo . --days 180
Master’s saying: “The value of code is not what it is, but how it became that way.”
Run:
git log --oneline -n 100
to quickly gauge recent project activity.
Key inference: If the last ~50 commits touch only one or two directories, that’s the epicenter—the area most likely hiding risk.
(Temporal Coupling / Change Coupling)
Core question: “Are there two files that have no import/use relationship, yet appear together in 70% of commits?”
Master warnings (from Adam Tornhill):
⚠️ Logical coupling with physical separation → strong signal of architectural decay
⚠️ Cross–build-root coupling → if service/ipc.rs and gui/api.ts change together but belong to different build roots, this is a breeding ground for version skew
Prescription:
(CodeScene Methodology)
Hotspot = High Change Frequency (Churn) × High Complexity| Low Complexity | High Complexity | |
|---|---|---|
| High Churn | Config / generated code — often ignorable | 🔴 Top refactor priority (bug breeding ground, highest ROI) |
| Low Churn | Stable modules — leave them alone | 🟡 Legacy minefield — tread carefully |
git fetch --unshallow. No history = no data = blind analysis.package-lock.json, Cargo.lock, *.min.js, dist/, and other generated artifacts—they pollute results.git mv can distort coupling signals. If results look strange, manually verify rename history.Your report must include: