agentleFS
shalombshalomb/agent-skills/skills/git-forensics/SKILL.md

git-forensics

Skill3 starsChanged 3 months agoMITView on GitHub

Use this skill to diagnose codebase health, identify risk areas, and perform code archaeology via git history. Trigger this when onboarding to a new project, assessing technical debt, searching for lost code or deleted files, tracing function evolution, or analyzing team dependency ("bus factor"). This provides deep insights beyond basic git commands.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use these commands for a high-level view of project health and stability.

    line 12
  2. Distinctive:

    Use these commands to dig into the history of specific code blocks or find lost context, treating the codebase as a crime scene.

    line 27

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Forensics

Analyze git history to identify health patterns (codebase drag, organizational risk) and perform deep code archaeology (finding lost code, tracing lines).

1. Codebase Health Assessment

Use these commands for a high-level view of project health and stability.

CommandDescriptionRisk Indicated
uv run scripts/forensics.py reportRun full health report-
uv run scripts/forensics.py churnTop 20 most frequently changed filesHigh Churn ("Codebase drag")
uv run scripts/forensics.py busContributor commit distributionLow Bus Factor (Knowledge silos)
uv run scripts/forensics.py bugsFiles most associated with "fix/bug"Bug Hotspots
uv run scripts/forensics.py velocityCommit counts by monthDeclining velocity (Tech debt)
uv run scripts/forensics.py fire"hotfix", "revert", "rollback" commitsDeployment/testing instability

Interpretation: Files appearing in BOTH "churn" and "bugs" are the highest risk components in the system and prime candidates for refactoring.

2. Code Archaeology

Use these commands to dig into the history of specific code blocks or find lost context, treating the codebase as a crime scene.

The Pickaxe (Find Lost Code)

Find exactly when a specific string, function name, or variable was added or deleted anywhere in the repository's history (across all branches).

uv run scripts/forensics.py pickaxe "my_deprecated_key"
uv run scripts/forensics.py pickaxe "^def legacy_.*" --regex

X-Ray Blame

Standard git blame is noisy. This ignores whitespace changes (-w) and detects if the code was moved/copied from elsewhere (-M -C), pointing you to the true original author.

uv run scripts/forensics.py xblame path/to/file.py

Trace Function Evolution

See every diff that modified a specific function or class. (Opens in a pager; press q to exit).

uv run scripts/forensics.py trace "my_function" path/to/file.py

Find Stale Code

List the oldest, untouched files in the repository. High churn is bad, but code that hasn't been touched in 5 years might be dead weight or forgotten legacy systems.

uv run scripts/forensics.py stale

Find Deleted Files

List recently deleted files across the repository to resurrect lost modules.

uv run scripts/forensics.py deleted

Credits

Based on concepts from Adam Tornhill's Your Code as a Crime Scene and recommendations by Ally Piechowski.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.