plugins/developer-toolkit/skills/git/git-history-detective/SKILL.md
Use this skill when investigating Git history. Activate when the user wants to find when a bug was introduced, who changed a line of code, track down a regression, use git bisect, search commit history, understand why code was changed, or investigate when and how something broke.
npx skillsauth add latestaiagents/agent-skills git-history-detectiveInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Find when bugs were introduced and understand code evolution.
| Task | Command |
|------|---------|
| Who changed this line? | git blame <file> |
| Find commit by message | git log --grep="keyword" |
| Find commit by code change | git log -S "code" |
| Binary search for bug | git bisect |
| See file at old commit | git show <commit>:<file> |
# Basic blame
git blame <file>
# Blame specific lines
git blame -L 10,20 <file>
# Ignore whitespace changes
git blame -w <file>
# Show original author (ignore moves/copies)
git blame -M -C <file>
# Blame with email
git blame -e <file>
Reading blame output:
abc1234 (John Doe 2024-01-15 10:30:45 +0000 42) function processData() {
│ │ │ │ │
│ │ │ │ └─ Line content
│ │ │ └─ Line number
│ │ └─ Timestamp
│ └─ Author
└─ Commit SHA (first 7 chars)
# Search commit messages
git log --grep="fix login"
# Search code that was added/removed
git log -S "functionName" # "pickaxe" search
# Search with regex
git log -G "function.*deprecated"
# Find commits touching a file
git log --follow -- <file>
# Find commits by author
git log --author="John"
# Find commits in date range
git log --since="2024-01-01" --until="2024-02-01"
# Combine searches
git log --author="John" --grep="refactor" --since="2024-01-01"
When you know a bug exists now but didn't before:
# Start bisect
git bisect start
# Mark current (broken) commit as bad
git bisect bad
# Mark known good commit
git bisect good v1.2.0 # or a commit SHA
# Git checks out middle commit
# Test it, then:
git bisect good # if bug NOT present
git bisect bad # if bug IS present
# Repeat until Git finds the culprit
# "abc1234 is the first bad commit"
# End bisect
git bisect reset
Automated bisect with test script:
git bisect start
git bisect bad HEAD
git bisect good v1.0.0
git bisect run npm test # or any command that exits 0 for good, 1 for bad
# See all commits that touched a file
git log --oneline -- <file>
# See actual changes in each commit
git log -p -- <file>
# Follow file through renames
git log --follow -p -- <file>
# Show file at specific commit
git show <commit>:<file>
# Compare file between commits
git diff <commit1> <commit2> -- <file>
# Find when code was deleted
git log -S "deletedFunction" --diff-filter=D
# Find deleted file
git log --all --full-history -- "**/deleted-file.js"
# Restore deleted file
git checkout <commit-before-deletion>^ -- <file>
Step 1: Identify the symptom
# Find when the feature last worked
# Check release tags, deployment dates
git tag -l --sort=-version:refname | head -10
Step 2: Narrow the time range
# Find commits between working and broken state
git log --oneline v1.2.0..HEAD -- src/feature/
Step 3: Use bisect to pinpoint
git bisect start
git bisect bad HEAD
git bisect good v1.2.0
# Test each checkout
Step 4: Analyze the culprit commit
git show <culprit-commit>
git log -1 --format="%B" <culprit-commit> # Full message
# Find who last touched the broken code
git blame -L 45,50 src/broken-file.js
# See the full commit
git show <commit-from-blame>
# See what else changed in that commit
git show --stat <commit>
# Find first commit with the function
git log --reverse -S "functionName" --oneline
# See the full commit
git show <first-commit>
# Get the commit that last changed this line
git blame -L 42,42 <file>
# See full commit message (hopefully explains why)
git show <commit>
# See related commits around that time
git log --oneline --since="2024-01-01" --until="2024-01-15" -- <file>
git log -G "TODO:.*hack" --oneline
# Commits in feature not in main
git log main..feature --oneline
# Commits in either but not both
git log main...feature --oneline
# ASCII graph
git log --graph --oneline --all
# Show merge history
git log --first-parent --oneline
git log --all -S "searchTerm"
git branch --contains <commit>
# Open blame in browser (GitHub)
gh browse --blame <file>
# Interactive blame in VS Code
# Install GitLens extension
# GUI tools
gitk --all # Built-in
tig # Terminal UI
git log -S "eval(" --oneline
git log -S "innerHTML" --oneline
git log -G "password.*=.*['\"]" --oneline
git bisect start
git bisect bad HEAD
git bisect good <last-known-good>
git bisect run npm test
# Find the refactoring commit
git log --grep="refactor" --oneline -- src/
# See what files it touched
git show --stat <refactor-commit>
# Compare before/after
git diff <commit>^..<commit>
development
Test skills for correct activation, content quality, and regression — both automated checks (frontmatter validity, lint) and manual verification (query-suite activation testing). Covers CI integration and how to catch skill regressions before users do. Use this skill when adding skills to a repo, setting up CI for a skill library, or debugging "the skill exists but doesn't work". Activate when: test skills, validate skills, skill CI, skill linting, skill activation test, skill regression.
documentation
Write the YAML frontmatter for a SKILL.md file so it activates reliably — name, description, and activation keywords that the model matches against. Covers length, tone, and the most common frontmatter mistakes. Use this skill when authoring a new skill, fixing a skill that isn't auto-activating, or reviewing skills for publication. Activate when: SKILL.md frontmatter, skill description, skill activation, skill YAML, write a skill, author a skill.
development
Design skills that fire at the right moment — neither over-eager (noise) nor under-eager (silent). Covers activation specificity, trigger phrases, disambiguation between overlapping skills, and debugging activation. Use this skill when multiple skills could fire on the same query, a skill never fires, or a skill fires too often. Activate when: skill won't activate, skill over-activates, overlapping skills, skill triggers, skill selection, skill disambiguation.
development
Structure SKILL.md content so the model reads just enough — concise summary up front, progressively deeper detail, examples on demand. Covers section ordering, length budgets, when to split into multiple skills. Use this skill when writing or refactoring a skill body, one skill has grown too long, or a skill is wordy but not useful. Activate when: SKILL.md structure, skill content, skill too long, split skill, progressive disclosure, skill body.