git-analysis — Claude Code skill: read your repo history
Answers questions about git history: what changed, who wrote a line, where a regression crept in. Useful for review, bisect-style narrowing and changelogs.
npx skills add autohandai/code-cli --skill git-analysis -a claude-codeWhat git-analysis does
This skill flips the usual order: history first, code second. It walks a commit range and groups the changes by module, then explains a single line by running git blame -L and pulling up the commit with git show. When a test exists, it narrows a breakage with git bisect run <test command>; without one, you bisect by hand over the commits that touched the path.
It also surfaces who edits an area most often (git shortlog -sn -- <path>), what looks risky in a release — oversized diffs, recent edits with no tests, dependency bumps — and how branches relate: the graph, merge bases, commits not yet in main. The skill can call read_file, find_grep, git_log, git_diff, git_diff_range, git_status, git_branch and run_command.
Everything is read-only. It will not rebase, reset or rewrite history unless you ask for that exact operation and confirm it. On a large repository, bound your queries with paths, --since and -n, or the output balloons. Commit hashes and dates get quoted rather than paraphrased.
What it helps with
- pin down the commit that introduced a bug
- explain why a line of code exists
- draft a changelog between two releases
- see who edits a module most often
- flag risky changes before a release
Example prompts for the agent
- What changed between
v1.4.0andv1.5.0? Group it by module - Why is this check in
src/auth/session.ts? Show me the commit and its message - Find where
test_orders.pybroke: last good commit and first bad one
How to install git-analysis
1Skills CLI (Vercel)
npx skills add autohandai/code-cli --skill git-analysis -a claude-code2Manually: put the files in place
~/.claude/skills/git-analysis/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/git-analysis/
1Skills CLI (Vercel)
npx skills add autohandai/code-cli --skill git-analysis -a codex2Manually: put the files in place
.agents/skills/git-analysis/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add autohandai/code-cli --skill git-analysis -a cursor2Manually: put the files in place
.cursor/skills/git-analysis/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install autohandai/code-cli git-analysis2Manually: put the files in place
.github/skills/git-analysis/SKILL.md1Skills CLI (Vercel)
npx skills add autohandai/code-cli --skill git-analysis -a gemini-cli2Platform CLI
gemini skills install https://github.com/autohandai/code-cli --path src/skills/builtin/git-analysisManually: put the files in place
.devin/skills/git-analysis/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add autohandai/code-cli --skill git-analysis -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about git-analysis
How do I install git-analysis in Claude Code?
Run npx skills add autohandai/code-cli --skill git-analysis -a claude-code. The skill file lands at ~/.claude/skills/git-analysis/SKILL.md.
What does git-analysis do?
It answers questions from repository history: what changed and when, who wrote a line, which commits touched an area, where a regression entered, how branches relate. Use it for blame, bisect-style narrowing, changelog drafting and release diffs.
Can the skill rewrite history?
No. It stays read-only by default, and will only rebase, reset or rewrite history if you ask for that specific operation and confirm.
Source text
SKILL.md · Apache-2.0
--- name: git-analysis description: Answer questions from repository history, including what changed, when, by whom, why a line exists, which commits touched an area, where a regression entered, and how branches relate. Use for blame, bisect-style narrowing, changelog drafting, and release diffs. allowed-tools: read_file find_grep git_log git_diff git_diff_range git_status git_branch run_command --- # Read the history, not just the tree Git already knows most of what a reviewer wants to ask. Use it before reading code, and cite commits. ## Techniques - **What changed between X and Y**: `git_diff_range`, then group by module; summarize behavior changes, not file lists. - **Why does this line exist**: `git blame -L` through `run_command`, then `git show` the commit and read its message and the surrounding diff. - **When did it break**: find the last known good and first known bad, then narrow with `git bisect run <test command>` when a test exists; otherwise bisect by hand on the commits touching the area (`git log -- <path>`). - **Who owns this area**: `git shortlog -sn -- <path>` and recent authors. - **What is risky in this release**: largest diffs, files with many recent touches, changes without tests, dependency bumps. - **Branch relationships**: `git log --oneline --graph`, merge bases, commits not yet in main. ## Rules - Quote commit hashes and dates; never paraphrase a commit message as fact without showing it. - Read-only by default. Do not rebase, reset, or rewrite history unless the user asks for that specific operation and confirms. - Large histories: bound queries with paths, `--since`, and `-n`. ## Output A short narrative with the commits that matter, then a table of commit, date, author, summary, and the evidence line for each claim. End with the open questions the history cannot answer.
© autohandai · Apache-2.0 · autohandai/code-cli