git-mining
/git-mining
This skill should be used when the user asks to "check git history", "trace code changes", "find when something was added", "correlate commits with sessions", "find hotspot files", or needs to mine git repository history for insights. Only applicable when the current project is a git repository.
- Author
- xiaolai ↗
- Repository
- echo-sleuth-for-claude ↗
- Licence
- ISC
- Last repository change
- 02.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.
ISC, otwarta.
What it does and when to use it
This skill should be used when the user asks to "check git history", "trace code changes", "find when something was added", "correlate commits with sessions", "find hotspot files", or needs to mine git repository history for insights. Only applicable when the current project is a git repository.
Triggers from the description
Original author description
This skill should be used when the user asks to "check git history", "trace code changes", "find when something was added", "correlate commits with sessions", "find hotspot files", or needs to mine git repository history for insights. Only applicable when the current project is a git repository.
How it works
- Prerequisite Check
- Scripts
- Key Git Commands for Agents
- Correlating Git Commits with Claude Sessions
- What to Extract from Git History
- Combining Git + JSONL
SKILL.md preview
---
name: git-mining
description: This skill should be used when the user asks to "check git history", "trace code changes", "find when something was added", "correlate commits with sessions", "find hotspot files", or needs to mine git repository history for insights. Only applicable when the current project is a git repository.
version: 0.1.0
---
# Git Mining — Code History Integration
## Prerequisite Check
Before using git commands, verify the project is a git repo:
```bash
git rev-parse --git-dir 2>/dev/null && echo "IS_GIT_REPO" || echo "NOT_GIT_REPO"
```
If not a git repo, skip all git-related analysis and rely on JSONL data only.
## Scripts
### Cluster commits into work sessions
```bash
bash ${CLAUDE_PLUGIN_ROOT}/scripts/git-sessions.sh [repo-path] [--since "14 days ago"] [--gap 3600]
```
### Full structured context dump
```bash
bash ${CLAUDE_PLUGIN_ROOT}/scripts/git-context.sh [repo-path] [--since "7 days ago"] [--limit 30]
```
## Key Git Commands for Agents
### Recent commits with file changes
```bash
git log --pretty=format:"%h|%ai|%s" --numstat --since="14 days ago" -30
```
### File history (survives renames)
```bash
git log --oneline --follow -- path/to/file.ts
```
### Symbol archaeology (when was X introduced?)
```bash
git log --oneline -S "FunctionName" # exact string
git log --oneline -G "pattern.*regex" # regex in diff
```
### Hotspot files (most frequently changed)
```bash
git log --name-only --pretty=format: --since="30 days ago" | grep -v '^$' | sort | uniq -c | sort -rn | head -15
```
### Commit message search
```bash
git log --oneline --grep="keyword" -i
```
### What changed in a file recently
```bash
git log -p --follow --since="7 days ago" -- path/to/file.ts
```
## Correlating Git Commits with Claude Sessions
Git commits made during Claude Code sessions cluster together in time (typically 60-440 seconds apart). Cross-session gaps are 1+ hours.
### Method 1: Timestamp matching
Compare `sessions-index.json` entries (`created`/`modified` fields) with git commit timestamps (`git log --pretty=format:"%at"`) to find which commits were made during which sessions.
### Method 2: Conventional commit patterns
Claude Code sessions typically produce commit sequences like:
- `feat:` → `fix:` → `fix:` → `docs:` → `release:` (complete cycle)
- `fix:` → `test:` (debugging session)
- `refactor:` → `style:` (cleanup session)
### Method 3: Branch correlation
The `gitBranch` field in session records and `sessions-index.json` entries tells you which branch each session was working on. Match with `git log --all --oneline <branch>`.
## What to Extract from Git History
| Question | Command |
|----------|---------|
| What changed recently? | `git log --oneline --since="7 days ago"` |
| What files change together? | `git log --name-only` then co-occurrence analysis |
| Who/what introduced a bug? | `git log -S "buggy_code"` + `git blame` |
| What's the architectural evolution? | `git log --diff-filter=A --name-status` (new files over time) |
| What keeps breaking? | `git log --grep="fix" --name-status` |
| What was the rationale? | `git log --pretty=format:"%s%n%b" -1 <hash>` (commit body) |
## Combining Git + JSONL
The most powerful analysis combines both sources:
1. Find the relevant git commits for a time period
2. Match their timestamps to Claude sessions
3. Read the session `.jsonl` to understand the full conversation context behind those commits
4. This gives you: **what was done** (git) + **why it was done** (conversation) + **what was tried and failed** (tool errors in JSONL)
Files in this package (2)
- SKILL.md 4 KB
- references/git-commands.md 2 KB
Versions
The database has no other skills named git-mining.
Database snapshot: 13.11.2026 · package version 7f0395f49410 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100git-history-forensics
Git 历史追溯与文档完整性验证 - 追踪功能/概念的引入时间、演变过程,发现文档遗漏。 当用户问"X呢"、"Y什么时候加的"、"之前的Z呢"时使用。 Use when user asks "what about X", "when was Y added", "what happened to Z before date". - 100forensics-report
Use when a release review needs machine-derived evidence from git history — hotspot risk and change-coupling analyzers. Triggers on 'hotspot', 'what changes together', 'release forensics'. - 92git-commit
Use when creating Git commits. - 100code-history
Trace the git history of specific code — when a function, pattern, or file was added, modified, or removed, and the intent behind each change. Use when the user asks when or why a piece of code changed, wants the evolution of a function, or needs the commit or PR that introduced… - 90committing
Makes clean git commits in the project's own style. Use when the user asks to commit, write a commit message, split changes into commits, or open a PR. Not for reviews or explaining history. - 100repo-audit
Deep analysis of Git history: identify frequently changed hotspot files, analyze code ownership by contributor, and scan for leaked secrets. Triggered when users ask about Git analysis, code hotspots, who owns what code, secret scanning, security audits of commit history, or…