check-history
npx skills add https://github.com/meriley/claude-code-skills --skill check-history
Agent 安装分布
Skill 文档
Git History Context Skill
â ï¸ MANDATORY SKILL – YOU MUST INVOKE THIS
Purpose
This skill gathers comprehensive git context before starting any work. It helps understand the current state of the repository, recent changes, and identify related previous work.
CRITICAL: You MUST invoke this skill – NEVER gather git context manually with individual git commands.
ð« NEVER DO THIS
- â Running
git statusmanually - â Running
git diffmanually - â Running
git logmanually - â Gathering git context with individual commands
If you need git context, invoke this skill. Manual execution is FORBIDDEN.
â ï¸ SKILL GUARD – READ BEFORE USING BASH TOOL
Before using Bash tool for git commands, answer these questions:
â Are you about to run git status?
â STOP. Invoke check-history skill instead.
â Are you about to run git diff?
â STOP. Invoke check-history skill instead.
â Are you about to run git log?
â STOP. Invoke check-history skill instead.
â Are you gathering git context at the start of a task?
â STOP. Invoke check-history skill instead.
â Are you about to run multiple git commands in parallel (git status & git diff & git log)?
â STOP. Invoke check-history skill instead.
IF YOU PROCEED WITH BASH FOR THESE GIT COMMANDS, YOU ARE VIOLATING YOUR CORE DIRECTIVE.
This skill runs these commands for you, in parallel, with proper analysis. Use it.
Workflow
Step 1: Run Parallel Git Status Commands
Execute these commands in parallel for efficiency:
git status & git diff & git log --oneline -10 &
What to look for:
- Current branch name
- Uncommitted changes (staged or unstaged)
- Untracked files
- Recent commit messages and their scope
- Commit patterns and conventions in use
Step 2: Analyze Current State
Based on the parallel command output:
-
Branch Status:
- Verify branch name follows
mriley/prefix convention - Check if branch is ahead/behind remote
- Note if on main/master vs feature branch
- Verify branch name follows
-
Working Directory State:
- Identify any uncommitted changes
- Note files that might conflict with planned work
- Check for untracked files that might be relevant
-
Recent Work:
- Review last 10 commits for context
- Identify patterns in commit messages
- Note any related work or recent changes in relevant areas
Step 3: Search for Related Work (If Applicable)
If the task relates to a specific feature, bug, or area:
git log --grep="<keyword>" --oneline -10
Example keywords:
- Feature names (e.g., “auth”, “parser”, “api”)
- Bug identifiers (e.g., “fix”, “bug”, “issue”)
- Scope identifiers from conventional commits
Step 4: Get Detailed Context (If Needed)
For more detailed information about recent changes:
git show --name-only HEAD # Files changed in last commit
git diff --name-only origin/main # Files changed vs main branch
git log --graph --oneline -10 # Visual commit graph
Step 5: Generate Context Summary
Provide a concise summary including:
-
Current State:
- Branch:
<branch-name> - Status: Clean working directory / Has uncommitted changes
- Position: Up to date / Ahead by N commits / Behind by N commits
- Branch:
-
Recent Activity:
- Last 3-5 relevant commits with their scope and purpose
- Any ongoing work that might be related
-
Relevant History:
- Related previous work (if found via grep)
- Patterns or conventions observed
-
Recommendations:
- Any concerns or conflicts to address
- Suggested next steps based on current state
Example Output
Git Context Summary:
==================
Current State:
- Branch: mriley/feat/user-authentication
- Status: Clean working directory
- Position: Ahead of origin/main by 2 commits
Recent Activity:
1. feat(auth): add JWT token generation (3 hours ago)
2. feat(auth): implement user login endpoint (5 hours ago)
3. test(auth): add unit tests for password hashing (1 day ago)
Relevant History:
- Found 3 commits related to "auth" in past week
- Project consistently uses conventional commits with scope
- Security-focused: all auth changes include tests
Recommendations:
- Safe to proceed with auth-related work
- Follow existing pattern: feature + tests in same commit
- Consider reviewing recent auth commits for context
Error Handling
If git command fails:
- Verify we’re in a git repository
- Check git is installed and accessible
- Report error to user with specific command that failed
If not in a git repo:
- Note this is not a git repository
- Skip git-specific checks
- Proceed with file system context if needed
Integration with Other Skills
This skill should be invoked by:
sparc-plan– Before creating implementation planssafe-commit– To understand what’s being committedcreate-pr– To generate meaningful PR descriptions
Best Practices
- Always run parallel commands – Don’t run git commands sequentially
- Be concise – Summarize, don’t dump raw git output
- Focus on relevance – Highlight information relevant to the current task
- Note patterns – Identify conventions and patterns in commit history
- Flag concerns – Highlight any potential conflicts or issues early
Related Commands
/quick-status– Quick visual git dashboard (lighter weight alternative for simple status checks)/review-branch– Full branch code review against main