# Commit Archaeologist

Reconstruct why code exists from local git history before a risky edit.

- Repository: https://github.com/Shubhamsaboo/awesome-llm-apps (143670 stars)
- Category: Git and review
- License: Apache-2.0
- Last updated: 2026-10-22
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add Shubhamsaboo/awesome-llm-apps --skill commit-archaeologist -g -a claude-code -y`
Codex: `npx skills add Shubhamsaboo/awesome-llm-apps --skill commit-archaeologist -g -a codex -y`
Cursor: `npx skills add Shubhamsaboo/awesome-llm-apps --skill commit-archaeologist -g -a cursor -y`
Gemini CLI: `npx skills add Shubhamsaboo/awesome-llm-apps --skill commit-archaeologist -g -a gemini-cli -y`

## Description

Reconstructs why code exists from local git history, including the introducing commit, later changes, current authors, repeated companion files, and likely intent. Use when the user asks "why does this code exist", "who wrote this function and why", or to "explain the history of this function" before a rewrite, refactor, or risky edit. Runs entirely locally.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Commit Archaeologist

`git blame` names the last person to touch a line. This skill reconstructs the
reason the line exists. It traces a file or current line range through local git
history, identifies its origin and later edits, finds files that repeatedly
changed beside it, and extracts intent clues from commit messages.

Everything runs locally. No network calls, API keys, or repository writes.

## When to use

- The user asks why a block, function, or file exists
- The user wants to know who introduced code and what changed afterward
- A rewrite or refactor needs historical constraints and change risks
- A workaround, temporary branch, or surprising design choice needs context

## When not to use

- The user only wants raw blame output or a commit list
- The task is to squash, delete, or rewrite git history
- The repository is remote and has not been cloned locally
- The question is about project-wide architecture rather than one file or region

## Gather the target

Get the repository path and tracked file path. Use a line range when the user
names a current block or function. If either path is missing, ask only for the
missing value. Do not scan sibling repositories.

Paths should be relative to the repository and use forward slashes. Line ranges
use inclusive current line numbers such as `40-72`.

## Run the dig

From this skill directory:

```bash
python3 scripts/archaeologist.py /path/to/repo src/cache.py --lines 40-72 --json
```

For the complete history of a file, omit `--lines`:

```bash
python3 scripts/archaeologist.py /path/to/repo src/cache.py --json
```

The script is read-only. With a range it uses git line-log; without one it uses
file history with rename following. It also reads current authorship with blame.
If it rejects a path or range, report that error and ask for a corrected target.

The rest: https://github.com/Shubhamsaboo/awesome-llm-apps/blob/HEAD/agent_skills/commit-archaeologist/SKILL.md
