commit-diff-analyzerlisted
Install: claude install-skill afine907/skills
# Commit Diff Analyzer
## Goal
Analyze code changes between two git commits, presenting commit metadata, change summaries, and detailed diffs in a structured format for easy review.
## Trigger
- User says "对比 commit"、"compare commits"、"查看两个提交的差异"
- User provides two commit IDs and wants to see what changed
## Usage Pattern
When user provides two commit IDs (in any order or format), analyze the changes between them:
1. **Validate commits exist**: Run `git cat-file -t <commit>` for each commit ID
2. **Get commit info**: Run `git log -1 --format=fuller <commit>` for both commits
3. **Show diff**: Run `git diff <older-commit>..<newer-commit>` (chronological order)
4. **Show stats**: Run `git diff --stat <older-commit>..<newer-commit>`
## Output Organization
Present the analysis with:
1. **Commit metadata** - Author, date, commit message for both commits
2. **Change summary** - Files changed, insertions, deletions
3. **Detailed diff** - Line-by-line changes with context
4. **File breakdown** - Group by: Modified, Added, Deleted files
## Key Commands
```bash
# Validate commits exist
git cat-file -t <commit-id>
# Get full commit info
git log -1 --format="Hash: %H%nAuthor: %an%nDate: %ad%nMessage: %s%n" <commit-id>
# Chronological diff (older..newer)
git diff <older-commit>..<newer-commit>
# Diff stat
git diff --stat <older-commit>..<newer-commit>
# Show files changed
git diff --name-only <older-commit>..<newer-commit>
```