84 lines
2.5 KiB
Markdown
84 lines
2.5 KiB
Markdown
---
|
|
name: git-expert
|
|
description: Git operations, history exploration, and intelligent commit management. Use when users ask about git history ("what did we change", "when did we add"), want to understand past changes, need help with commits ("commit this", "save my work", "checkpoint"), ask about branches, or mention recent work.
|
|
---
|
|
|
|
# Git Expert Skill
|
|
|
|
Git operations, history exploration, and intelligent commit management.
|
|
|
|
## Capabilities
|
|
|
|
### History Analysis
|
|
- Search commit messages and code changes
|
|
- Trace file history to understand evolution
|
|
- Find when specific code was introduced or removed
|
|
- Identify who made changes and why
|
|
|
|
### Smart Commits
|
|
- Create well-formatted Conventional Commits
|
|
- Split large changes into atomic commits
|
|
- Handle pre-commit hooks gracefully
|
|
- Never commit secrets or sensitive data
|
|
|
|
### Session Awareness
|
|
- Track what was done during the current session
|
|
- Show uncommitted work
|
|
- Create checkpoints before risky operations
|
|
|
|
## Tools Available
|
|
|
|
Use the git-intelligence MCP server tools:
|
|
- `get_recent_commits` - Recent commit history
|
|
- `search_commits` - Search by message or code
|
|
- `get_status` - Current repository state
|
|
- `get_diff_summary` - Summary of changes
|
|
|
|
For file history and branch info, use Bash:
|
|
- `git log --oneline -10 -- <filepath>` - File-specific history
|
|
- `git branch -a` - Branch information
|
|
|
|
## Commit Format
|
|
|
|
Always use Conventional Commits format:
|
|
```
|
|
<type>(<scope>): <subject>
|
|
```
|
|
|
|
Type mappings:
|
|
| Type | Use for |
|
|
|------|---------|
|
|
| feat | New feature |
|
|
| fix | Bug fix |
|
|
| docs | Documentation |
|
|
| style | Formatting |
|
|
| refactor | Refactoring |
|
|
| perf | Performance |
|
|
| test | Tests |
|
|
| build | Build system |
|
|
| ci | CI/CD |
|
|
| chore | Maintenance |
|
|
| revert | Revert |
|
|
|
|
## Best Practices
|
|
|
|
1. **Before editing**: Check recent commits to understand context
|
|
2. **Before committing**: Review all changes, never blind commit
|
|
3. **Large changes**: Suggest splitting into atomic commits
|
|
4. **Unclear intent**: Ask user for commit scope/description
|
|
5. **Secrets detected**: Warn and refuse to commit
|
|
|
|
## Example Interactions
|
|
|
|
**User**: "What changed in the auth module recently?"
|
|
- Use `search_commits` with query "auth" or Bash `git log --oneline -10 -- src/auth/`
|
|
|
|
**User**: "Commit my changes"
|
|
- Run `get_status`, review diffs, create appropriate conventional commit
|
|
|
|
**User**: "What did we do this session?"
|
|
- Check recent commits and current diff, summarize activity
|
|
|
|
**User**: "Save my work before I try this"
|
|
- Create a checkpoint commit with current context
|