AgentSkillsCN

git-expert

轻松管理 MCP 服务器——新增、列出、启用、禁用。当用户咨询 MCP 服务器配置、希望添加新服务器,或需要对现有服务器进行启停操作时,这款工具将为您提供便捷的解决方案。

SKILL.md
--- frontmatter
name: git-expert
description: Git workflow expert — conventional commits, history exploration, worktree management, PR creation, squash, and safety. Activates for any git-related task including committing, branching, history, and repository analysis.
allowed-tools:
  - Bash(git *:*)
  - Bash(gh *:*)
  - Read
  - Glob
  - Grep

Git Expert

Unified git workflow skill. Routes to the right procedure based on what the user needs.

Routing

User wants...ReferenceKey commands
Create a commitWORKFLOWS.md § Commit + CONVENTIONS.md + EXAMPLES.mdgit status, git diff, git add, git commit
Quick checkpointWORKFLOWS.md § Checkpointgit add -u, git commit --no-verify
Squash WIP commitsWORKFLOWS.md § Squashgit merge-base, git reset --soft, git commit
Explore historyDecision tree belowgit log, git blame, git show, git diff
Create PRWORKFLOWS.md § PRgit push -u, gh pr create
Session activityWORKFLOWS.md § Session Loggit log --since="1 hour ago"
Manage worktreesWORKTREE.mdCLI at src/worktree/cli.ts
Review a PRWORKFLOWS.md § Review PRgh pr view, gh pr diff, gh api
Generate changelogWORKFLOWS.md § Changeloggit log, git tag, git describe
Compare branchesWORKFLOWS.md § Comparegit merge-base, git diff, git log

History Exploration Decision Tree

QuestionGit commands
"What changed recently?"git log --oneline -10, git status --porcelain -b, git diff --stat
"What changed in <area>?"git log --oneline -10 -- <path>, git log --all --grep="<area>"
"When did we add/change X?"git log --all --grep="<X>", git log -S "<X>", git log -G "<X>"
"Who changed this?"git blame <file>, git log --follow -- <file>
"Compare branches"git log --oneline main..HEAD, git diff main...HEAD --stat
"Show specific commit"git show <hash> --stat, git show <hash>
"What branches exist?"git branch -a, git branch --show-current
"What did we do this session?"git log --oneline --since="1 hour ago", git status
"Review this PR"gh pr view <PR>, gh pr diff <PR>, gh api .../pulls/<PR>/comments
"Generate changelog"git describe --tags --abbrev=0, git log <tag>..HEAD --oneline
"Compare these branches"git merge-base <base> HEAD, git diff <base>...HEAD --stat

Safety Rules

These are non-negotiable:

  • NEVER force push (git push --force / -f)
  • NEVER git reset --hard without explicit user confirmation
  • NEVER git clean -f without explicit user confirmation
  • NEVER git checkout . or git restore . without user confirmation
  • NEVER commit secrets (.env, credentials, API keys)
  • NEVER use git add . or git add -A — always stage specific files
  • NEVER skip hooks (--no-verify) except for WIP/checkpoint commits
  • ALWAYS verify on feature branch before squash (abort if main)
  • ALWAYS use HEREDOC format for multi-line commit messages
  • ASK user if commit scope or message is unclear
  • SPLIT large changes into atomic commits

Lifecycle Hooks

This plugin runs 5 hooks that fire automatically — you don't invoke them, but be aware of their effects:

HookEventWhat It Does
session-startSessionStartLoads git context (branch, recent commits, status)
pre-commit-guardPreToolUseBlocks git commit if validation hasn't passed
post-commit-lintPostToolUseRuns lint/typecheck after commits
pre-compactPreCompactSaves session git summary before context compaction
stopStopLogs session activity on exit

If a hook blocks an action, fix the underlying issue (e.g., run bun run validate) rather than bypassing hooks.

Commit Format

code
<type>(<scope>): <subject>

See CONVENTIONS.md for full spec and EXAMPLES.md for examples.

TypeUse for
featNew feature
fixBug fix
docsDocumentation only
refactorCode change (no feature/fix)
testAdding/updating tests
choreMaintenance
perfPerformance
styleFormatting
buildBuild system
ciCI/CD
revertRevert changes