Git-aware skill for finding implementation patterns and retrieving story context from git history. Use when searching for similar implementations or understanding how a feature was built...
INVOKE when user asks about:
# Get full implementation history
git log --grep="US-001-auth-login-admin" --oneline --graph
# Get detailed changes with code
git log --grep="US-001-auth-login-admin" -p --follow
# Get just the files changed
git diff --name-only main...$(git log --grep="US-001-auth-login-admin" -1 --format=%H)
# Find similar authentication implementations
git log --grep="auth\|login\|clerk" --oneline
# See how rate limiting was implemented across stories
git log -S"RateLimiter" -p
# Find all FastAPI endpoint additions
git log --diff-filter=A -- "apps/server/src/api/**/*.py"
# Get story implementation timeline
git log --grep="US-001-auth-login-admin" --format="%ai %s" | sort
# Calculate implementation time
git log --grep="US-001-auth-login-admin" --format="%at" | awk 'NR==1{first=$1} END{print (last-first)/3600 " hours"}'
# Get test coverage evolution
git log --grep="US-001-auth-login-admin" --format="%h" | xargs -I {} sh -c 'git show {}:coverage.json 2>/dev/null | jq .total'
# Create story summary
story="US-001-auth-login-admin"
echo "=== Story $story Implementation ==="
echo "\nš Commits:"
git log --grep="$story" --oneline
echo "\nš Files Modified:"
git diff --name-status main...$(git log --grep="$story" -1 --format=%H)
echo "\nā
Tests Added:"
git diff main...$(git log --grep="$story" -1 --format=%H) -- "*test*.py" --name-only
echo "\nš Statistics:"
git log --grep="$story" --shortstat | grep -E "files? changed"
# Example: Find all endpoint security patterns
patterns = {
"auth": "git log -S'@router.post.*Depends.*get_current_user' -p",
"rate_limit": "git log -S'RateLimiter' -p",
"validation": "git log -S'@validator' -p",
"error_handling": "git log -S'HTTPException' -p"
}
# Extract common backend structure from story
git show --format="" --name-only $(git log --grep="US-001-auth-login-admin" --format=%H) |
grep "apps/server" |
sed 's|apps/server/||' |
sort -u
When building context from git:
Start with story commits
git log --grep="US-XXX" --oneline
Get implementation details
git show <commit-hash>
Find related patterns
git log -S"<key-concept>" --oneline
Build file history
git log --follow -p -- <file-path>
The minimal user story files reference git commits. Use these commands to expand context:
# From user story: "Implementation: git log --grep='US-001-auth-login-admin'"
# Expand to full context:
git log --grep="US-001-auth-login-admin" --stat --format=fuller
Use git aliases for common patterns:
git config --global alias.story 'log --grep'
git config --global alias.pattern 'log -S'
Cache results in Memory MCP:
Batch operations for multiple stories:
for story in US-001-auth-login-admin US-002 US-003; do
echo "=== $story ==="
git log --grep="$story" --oneline
done
If git history is unclear:
Git operations are typically:
git log --grep: <100msgit show: <50ms per commitgit diff: <200ms for feature branchCompare to file reading:
Git approach is 3-5x faster for context retrieval