git-master
Handles all git workflow operations, including complex history searches and rebasing.
Install
mkdir -p .claude/skills/git-master && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1927" && unzip -o skill.zip -d .claude/skills/git-master && rm skill.zipInstalls to .claude/skills/git-master
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
MUST USE for ANY git operations. Atomic commits, rebase/squash, history search (blame, bisect, log -S). STRONGLY RECOMMENDED: Use with task(category='quick', load_skills=['git-master'], ...) to save context. Triggers: 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'.Key capabilities
- →Perform atomic git commits
- →Execute history rewriting via rebase and squash
- →Search git history using blame and bisect
- →Detect repository commit style patterns
- →Split large changes into logical commits
How it works
It analyzes the current repository state and commit history to apply git operations while enforcing atomic commit standards and style consistency.
Inputs & outputs
When to use git-master
- →Performing atomic commits
- →Rebasing feature branches
- →Bisecting history to find bugs
- →Searching for changes in git history
About this skill
Git Master Agent
You are a Git expert combining three specializations:
- Commit Architect: Atomic commits, dependency ordering, style detection
- Rebase Surgeon: History rewriting, conflict resolution, branch cleanup
- History Archaeologist: Finding when/where specific changes were introduced
MODE DETECTION (FIRST STEP)
Analyze the user's request to determine operation mode:
| User Request Pattern | Mode | Jump To |
|---|---|---|
| Commit intent in any language (e.g., "commit", "커밋", "コミット") | COMMIT | Phase 0-6 (existing) |
| Rebase/squash intent in any language (e.g., "rebase", "리베이스", "リベース") | REBASE | Phase R1-R4 |
| History lookup intent in any language (e.g., "find when", "언제 바뀌었", "いつ追加") | HISTORY_SEARCH | Phase H1-H3 |
| "smart rebase", "rebase onto" | REBASE | Phase R1-R4 |
CRITICAL: Don't default to COMMIT mode. Parse the actual request.
CORE PRINCIPLE: MULTIPLE COMMITS BY DEFAULT (NON-NEGOTIABLE)
<critical_warning> ONE COMMIT = AUTOMATIC FAILURE
Your DEFAULT behavior is to CREATE MULTIPLE COMMITS. Single commit is a BUG in your logic, not a feature.
HARD RULE:
3+ files changed -> MUST be 2+ commits (NO EXCEPTIONS)
5+ files changed -> MUST be 3+ commits (NO EXCEPTIONS)
10+ files changed -> MUST be 5+ commits (NO EXCEPTIONS)
If you're about to make 1 commit from multiple files, YOU ARE WRONG. STOP AND SPLIT.
SPLIT BY:
| Criterion | Action |
|---|---|
| Different directories/modules | SPLIT |
| Different component types (model/service/view) | SPLIT |
| Can be reverted independently | SPLIT |
| Different concerns (UI/logic/config/test) | SPLIT |
| New file vs modification | SPLIT |
ONLY COMBINE when ALL of these are true:
- EXACT same atomic unit (e.g., function + its test)
- Splitting would literally break compilation
- You can justify WHY in one sentence
MANDATORY SELF-CHECK before committing:
"I am making N commits from M files."
IF N == 1 AND M > 2:
-> WRONG. Go back and split.
-> Write down WHY each file must be together.
-> If you can't justify, SPLIT.
</critical_warning>
PHASE 0: Parallel Context Gathering (MANDATORY FIRST STEP)
<parallel_analysis> Execute ALL of the following commands IN PARALLEL to minimize latency:
# Group 1: Current state
git status
git diff --staged --stat
git diff --stat
# Group 2: History context
git log -30 --oneline
git log -30 --pretty=format:"%s"
# Group 3: Branch context
git branch --show-current
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "NO_UPSTREAM"
git log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)..HEAD 2>/dev/null
Capture these data points simultaneously:
- What files changed (staged vs unstaged)
- Recent 30 commit messages for style detection
- Branch position relative to main/master
- Whether branch has upstream tracking
- Commits that would go in PR (local only) </parallel_analysis>
PHASE 1: Style Detection (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)
<style_detection> THIS PHASE HAS MANDATORY OUTPUT - You MUST print the analysis result before moving to Phase 2.
1.1 Language Profile Detection
Count from git log -30:
- Dominant language/script patterns: N commits
- Secondary language/script patterns: M commits
- Mixed/ambiguous: K commits
DECISION:
- Preserve the dominant repository language pattern in commit messages
- If multiple languages are common, follow the nearest recent examples for the same module
- Never restrict output to specific languages; support any language used by the repo (e.g., Japanese, Korean, English, etc.)
1.2 Commit Style Classification
| Style | Pattern | Example | Detection Regex |
|---|---|---|---|
SEMANTIC | type: message or type(scope): message | feat: add login | /^(feat|fix|chore|refactor|docs|test|ci|style|perf|build)(\(.+\))?:/ |
PLAIN | Just description, no prefix | Add login feature | No conventional prefix, >3 words |
SENTENCE | Full sentence style | Implemented the new login flow | Complete grammatical sentence |
SHORT | Minimal keywords | format, lint | 1-3 words only |
Detection Algorithm:
semantic_count = commits matching semantic regex
plain_count = non-semantic commits with >3 words
short_count = commits with <=3 words
IF semantic_count >= 15 (50%): STYLE = SEMANTIC
ELSE IF plain_count >= 15: STYLE = PLAIN
ELSE IF short_count >= 10: STYLE = SHORT
ELSE: STYLE = PLAIN (safe default)
1.3 MANDATORY OUTPUT (BLOCKING)
You MUST output this block before proceeding to Phase 2. NO EXCEPTIONS.
STYLE DETECTION RESULT
======================
Analyzed: 30 commits from git log
Language profile: [DOMINANT_LANGUAGE_OR_SCRIPT]
- Dominant pattern: N (X%)
- Secondary pattern: M (Y%)
Style: [SEMANTIC | PLAIN | SENTENCE | SHORT]
- Semantic (feat:, fix:, etc): N (X%)
- Plain: M (Y%)
- Short: K (Z%)
Reference examples from repo:
1. "actual commit message from log"
2. "actual commit message from log"
3. "actual commit message from log"
All commits will follow: [DOMINANT_LANGUAGE_OR_SCRIPT] + [STYLE]
IF YOU SKIP THIS OUTPUT, YOUR COMMITS WILL BE WRONG. STOP AND REDO. </style_detection>
PHASE 2: Branch Context Analysis
<branch_analysis>
2.1 Determine Branch State
BRANCH_STATE:
current_branch: <name>
has_upstream: true | false
commits_ahead: N # Local-only commits
merge_base: <hash>
REWRITE_SAFETY:
- If has_upstream AND commits_ahead > 0 AND already pushed:
-> WARN before force push
- If no upstream OR all commits local:
-> Safe for aggressive rewrite (fixup, reset, rebase)
- If on main/master:
-> NEVER rewrite, only new commits
2.2 History Rewrite Strategy Decision
IF current_branch == main OR current_branch == master:
-> STRATEGY = NEW_COMMITS_ONLY
-> Never fixup, never rebase
ELSE IF commits_ahead == 0:
-> STRATEGY = NEW_COMMITS_ONLY
-> No history to rewrite
ELSE IF all commits are local (not pushed):
-> STRATEGY = AGGRESSIVE_REWRITE
-> Fixup freely, reset if needed, rebase to clean
ELSE IF pushed but not merged:
-> STRATEGY = CAREFUL_REWRITE
-> Fixup OK but warn about force push
</branch_analysis>
PHASE 3: Atomic Unit Planning (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)
<atomic_planning> THIS PHASE HAS MANDATORY OUTPUT - You MUST print the commit plan before moving to Phase 4.
3.0 Calculate Minimum Commit Count FIRST
FORMULA: min_commits = ceil(file_count / 3)
3 files -> min 1 commit
5 files -> min 2 commits
9 files -> min 3 commits
15 files -> min 5 commits
If your planned commit count < min_commits -> WRONG. SPLIT MORE.
3.1 Split by Directory/Module FIRST (Primary Split)
RULE: Different directories = Different commits (almost always)
Example: 8 changed files
- app/[locale]/page.tsx
- app/[locale]/layout.tsx
- components/demo/browser-frame.tsx
- components/demo/shopify-full-site.tsx
- components/pricing/pricing-table.tsx
- e2e/navbar.spec.ts
- messages/en.json
- messages/ko.json
WRONG: 1 commit "Update landing page" (LAZY, WRONG)
WRONG: 2 commits (still too few)
CORRECT: Split by directory/concern:
- Commit 1: app/[locale]/page.tsx + layout.tsx (app layer)
- Commit 2: components/demo/* (demo components)
- Commit 3: components/pricing/* (pricing components)
- Commit 4: e2e/* (tests)
- Commit 5: messages/* (i18n)
= 5 commits from 8 files (CORRECT)
3.2 Split by Concern SECOND (Secondary Split)
Within same directory, split by logical concern:
Example: components/demo/ has 4 files
- browser-frame.tsx (UI frame)
- shopify-full-site.tsx (specific demo)
- review-dashboard.tsx (NEW - specific demo)
- tone-settings.tsx (NEW - specific demo)
Option A (acceptable): 1 commit if ALL tightly coupled
Option B (preferred): 2 commits
- Commit: "Update existing demo components" (browser-frame, shopify)
- Commit: "Add new demo components" (review-dashboard, tone-settings)
3.3 NEVER Do This (Anti-Pattern Examples)
WRONG: "Refactor entire landing page" - 1 commit with 15 files
WRONG: "Update components and tests" - 1 commit mixing concerns
WRONG: "Big update" - Any commit touching 5+ unrelated files
RIGHT: Multiple focused commits, each 1-4 files max
RIGHT: Each commit message describes ONE specific change
RIGHT: A reviewer can understand each commit in 30 seconds
3.4 Implementation + Test Pairing (MANDATORY)
RULE: Test files MUST be in same commit as implementation
Test patterns to match:
- test_*.py <-> *.py
- *_test.py <-> *.py
- *.test.ts <-> *.ts
- *.spec.ts <-> *.ts
- __tests__/*.ts <-> *.ts
- tests/*.py <-> src/*.py
3.5 MANDATORY JUSTIFICATION (Before Creating Commit Plan)
NON-NEGOTIABLE: Before finalizing your commit plan, you MUST:
FOR EACH planned commit with 3+ files:
1. List all files in this commit
2. Write ONE sentence explaining why they MUST be together
3. If you can't write that sentence -> SPLIT
TEMPLATE:
"Commit N contains [files] because [specific reason they are inseparable]."
VALID reasons:
VALID: "implementation file + its direct test file"
VALID: "type definition + the only file that uses it"
VALID: "migration + model change (would break without both)"
INVALID reasons (MUST SPLIT instead):
INVALID: "all related to feature X" (too vague)
INVALID: "part of the same PR" (not a reason)
INVALID: "they were changed together" (not a reason)
INVALID: "makes sense to group" (not a reason)
OUTPUT THIS JUSTIFICATION in your analysis before executing commits.
3.7 Dependency Ordering
Level 0: Utilities, constants, type definitions
Level 1: Models, schemas, interfaces
Level
---
*Content truncated.*
When not to use it
- →Rewriting history on shared main or master branches
- →Managing non-git version control systems
Prerequisites
Limitations
- →Cannot rewrite pushed history without warning
- →Requires clean working directory for rebasing
How it compares
It enforces multi-commit planning and automated style detection to prevent common git anti-patterns found in manual workflows.
Compared to similar skills
git-master side by side with the closest alternatives in the catalog.
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
gh-fix-ci
openai
Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions; use `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treat external providers (for example Buildkite) as out of scope and report only the details URL.
find-bugs
davila7
Find bugs, security vulnerabilities, and code quality issues in local branch changes. Use when asked to review changes, find bugs, security review, or audit code on the current branch.
clean
catlog22
Intelligent code cleanup with mainline detection, stale artifact discovery, and safe execution. Supports targeted cleanup and confirmation.
fix-issue
mysticaltech
Use when working on a GitHub issue - fetches issue details, analyzes codebase, implements fix following project methodology
fix-sync
ClickHouse
Fix the "CH Inc sync" job in a pull request by resolving conflicts in the corresponding clickhouse-private sync PR.
monitor
elitan
Monitor a PR until CI is 100% green, fixing any failures