Skip to content
Committer logo

Committer

This skill should be used when the user asks to "commit", "create a commit", "make a commit", "git commit", "commit these changes", or wants to stage and commit changes to git. Handles staging files, drafting commit messages, following commit conventions, and managing git commits safely.

SKILL.md

Full skill instructions

Committer

This skill provides comprehensive guidance for creating git commits safely and effectively.

Core Principles

Git Safety Protocol

CRITICAL - Always follow these rules:

  • NEVER update the git config
  • NEVER run destructive/​irreversible git commands (push --force, hard reset, etc.) unless the user explicitly requests them
  • NEVER skip hooks (--no-verify, --no-gpg-sign, etc.) unless the user explicitly requests them
  • NEVER run force push to main/​master, warn the user if they request it
  • Avoid git commit --amend. ONLY use --amend when ALL conditions are met:
    1. User explicitly requested amend, OR commit succeeded but hook auto-modified files
    2. HEAD commit was created by you in this conversation (verify: git log -1 --format='%an %ae')
    3. Commit has NOT been pushed to remote (verify: git status shows "Your branch is ahead")
  • CRITICAL: If commit FAILED or was REJECTED by hook, NEVER amend - fix the issue and create a NEW commit
  • CRITICAL: If you already pushed to remote, NEVER amend unless user explicitly requests it (requires force push)
  • NEVER commit changes unless the user explicitly asks for it
  • NEVER commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request committing those files
  • NEVER include any sign, footer, or attribution (like "Co-Authored-By: Claude") in commit messages

When to Create Commits

Only create git commits when the user explicitly asks, such as:

  • "commit these changes"
  • "create a commit"
  • "make a commit"
  • "stage and commit"

Do NOT create commits proactively without user permission.

Commit Creation Workflow

Step 1: Analyze Current State

Run these commands in parallel to understand the current state:

# Check working tree status
git status

# View unstaged changes
git diff

# View staged changes (if any)
git diff --staged

# Check recent commit history for message style
git log --oneline -10

Step 2: Stage Files

Stage the relevant files for commit. Common patterns:

# Stage all changes
git add .

# Stage specific files
git add path/​to/​file1 path/​to/​file2

# Stage by pattern
git add *.js

Important: Only stage files that are part of the intended commit.

Step 3: Draft Commit Message

Analyze the staged changes and draft a commit message following these guidelines:

  1. Summarize the nature of the changes:

    • new feature - Adding wholly new functionality
    • enhancement - Improving existing functionality
    • bug fix - Fixing a bug or issue
    • refactoring - Restructuring code without behavior change
    • test - Adding or modifying tests
    • docs - Documentation changes
    • chore - Maintenance tasks
  2. Format:

    • Use present tense ("add" not "added")
    • Use imperative mood ("add" not "adds")
    • Focus on "why" rather than "what"
    • Be concise (1-2 sentences for summary)

Good examples:

  • "Add user authentication with JWT tokens"
  • "Fix memory leak in image processing pipeline"
  • "Refactor database connection handling for better error recovery"

Bad examples:

  • "Updated some code" (too vague)
  • "Added function to handle clicks" (focuses on what, not why)
  • "Fixes bug" (doesn't say which bug or what it did)
  1. Check for sensitive files:
    • Look for .env, .secrets, credentials.json, keys, etc.
    • Warn user before staging these files

Step 4: Create the Commit

Use the HEREDOC format for proper message formatting:

git commit -m "$(cat <<'EOF'
Add user authentication with JWT tokens

Implements secure login using JWT with refresh token rotation.
Includes password validation and session management.
EOF
)"

After commit completes, verify success:

git status

Step 5: Handle Commit Failures

If a commit fails due to pre-commit hooks:

  1. DO NOT amend the failed commit
  2. Read the hook output to understand what failed
  3. Fix the issue identified by the hook
  4. Stage the fixed files
  5. Create a NEW commit with the original message

If hooks auto-modify files after a successful commit:

  1. Check if the commit just succeeded
  2. Check if the HEAD commit was created by you
  3. Check if the commit hasn't been pushed yet
  4. If ALL conditions are met, you may amend to include the hook changes

Pull Request Creation

When the user asks to create a pull request:

Step 1: Analyze Branch State

Run these commands in parallel:

# Check branch status and untracked files
git status

# View unstaged changes
git diff

# View staged changes
git diff --staged

# Check if branch tracks remote and is up to date
git branch -vv

# View commit history since divergence from base branch
git log --oneline $(git symbolic-ref refs/​remotes/​origin/​HEAD | sed 's@^refs/​remotes/​origin/​@@')..HEAD

# View full diff from base branch
git diff $(git symbolic-ref refs/​remotes/​origin/​HEAD | sed 's@^refs/​remotes/​origin/​@@')...HEAD

Step 2: Create PR Summary

Analyze ALL commits in the branch (not just the latest one) to create a comprehensive summary:

  1. List main changes across all commits
  2. Identify the primary purpose of the PR
  3. Note any breaking changes or migration considerations

Step 3: Push and Create PR

# Create branch if needed (use current branch name)
git push -u origin HEAD

# Create PR with proper formatting
gh pr create --title "PR title here" --body "$(cat <<'EOF'
## Summary
- First major change
- Second major change
- Third major change

## Test plan
- [ ] Test 1
- [ ] Test 2

EOF
)"

Important Notes

  • Do NOT use the TodoWrite or Task tools during git operations
  • Do NOT run additional commands to read or explore code besides git bash commands
  • NEVER use git commands with the -i flag (interactive mode is not supported)
  • DO NOT push to the remote repository unless the user explicitly asks for it
  • Return the commit hash or PR URL when done so the user can verify

Common Git Operations

# View recent commits
git log -5 --oneline

# View commit details
git show <commit-hash>

# Unstage files
git restore --staged <file>

# Discard unstaged changes
git restore <file>

Additional Resources

Reference Files

  • references/​conventions.md - Commit message conventions and examples, including Conventional Commits format and writing guidelines

Scripts

  • scripts/​analyze-changes.sh - Analyze current changes and show commit style reference

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View