.agents/skills/commit/SKILL.md
Use when committing work, amending commits, creating or stacking branches - applies to all commit operations including "quick commits", emergency fixes, and when user already used raw git commands. ALWAYS use git-spice instead of git checkout, git commit, or git branch.
npx skillsauth add abhinav/home commitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ALWAYS use git-spice for creating commits and branches, and for amending commits. NEVER use raw git commands for these purposes (git commit, git checkout -b, git branch $name).
Why git-spice: Maintains branch relationships and auto-rebases dependent branches. Using raw git breaks stack tracking.
Use this skill for ALL commit operations:
Triggers:
| Task | Command |
|------|---------|
| Get current branch name | git branch --show-current |
| New branch + commit | git-spice branch create <name> -m "<msg>" |
| New branch + commit from detached HEAD | git-spice branch create --target=$base <name> -m "<msg>" |
| Commit to current branch | git-spice commit create -m "<msg>" |
| Amend (keep message) | git-spice commit amend --no-edit |
| Amend (change message) | git-spice commit amend -m "<new-msg>" |
| Stack on different branch | git-spice branch create --target <base> <name> -m "<msg>" |
Branch naming: lowercase-with-hyphens (no /, no uppercase, no user prefixes)
Commit messages: MUST follow writing-commit-messages guidelines
If user explicitly states their intent, follow it directly:
git-spice commit creategit-spice branch createDetached HEAD override for branch creation:
git branch --show-current returns empty output,
HEAD is detached.git-spice branch create --target=$base <name> -m "<msg>".$base to the repo's trunk branch (usually main or master),
or the appropriate base branch if user specifies one.If user intent is ambiguous, determine from context:
flowchart TD
Start[Where am I?] -->|main/master| NewBranch[Create feature branch]
Start -->|feature branch| Related{Change related<br/>to this feature?}
Related -->|Yes| Current[Commit to current branch]
Related -->|No| NewBranch
Stacking: Creating a new branch while on a feature branch automatically stacks it.
git-spice branch create <branch-name> -m "<commit-message>"
HEAD is detached,
use git-spice branch create --target=$base <branch-name> -m "<commit-message>"
insteadAfter creating branch: Run git-spice ls to show branch position in stack (NOT git log).
Example:
# On main
git-spice branch create fix-login-validation -m "Fix email validation in login form"
# On feature-auth, creating unrelated change
git-spice branch create update-readme -m "Update installation instructions"
# This stacks update-readme on top of feature-auth
# On detached HEAD
git-spice branch create --target=$base recover-work -m "Recover detached HEAD work"
# Use base branch, if specified by user, or default to main/master
git-spice commit create -m "<commit-message>"
Commits staged changes to current branch.
After committing: Run git-spice ls to show branch position in stack (NOT git log).
git branch --show-current
IMPORTANT: git-spice branch current does NOT exist.
git-spice doesn't have a command for showing the current branch.
Use standard git command: git branch --show-current
If the command prints nothing,
HEAD is detached.
Common use cases:
NOT needed when:
# Keep existing message
git-spice commit amend --no-edit
# Replace entire message
git-spice commit amend -m "<new-complete-message>"
CRITICAL: git-spice commit amend -m REPLACES the entire commit message.
If user says "add" or "append" to message, you MUST include the original message + addition.
Example:
# Original message: "Fix login validation"
# User: "Add note about regex update"
# ❌ WRONG: git-spice commit amend -m "Also updates regex pattern"
# ✅ CORRECT: git-spice commit amend -m "Fix login validation
Also updates regex pattern"
git-spice branch create --target <target-branch> <branch-name> -m "<commit-message>"
Useful when current branch isn't the desired base.
Required:
Forbidden:
Why no prefixes: git-spice automatically adds user prefixes if configured.
Adding them manually results in double-prefixing (e.g., abg-abg-fix-bug).
Just use descriptive names: fix-bug not abg-fix-bug.
git checkout -b <branch>Why: Bypasses git-spice tracking. Branch won't be in the stack.
Instead:
git add <files>git-spice branch create <name> -m "<message>"git commit or git commit --amendWhy: Bypasses git-spice rebase. Dependent branches become stale.
Instead:
git-spice commit create -m "<message>"git-spice commit amend --no-edit or git-spice commit amend -m "<new-message>"git branch <name>Why: Creates untracked branch outside stack.
Instead: Use git-spice branch create with commit.
git-spice branch currentWhy: Command doesn't exist. git-spice has no equivalent for this.
Instead: Use git branch --show-current
Common mistake: Assuming every git command has a git-spice equivalent. Reality: Some operations (like showing current branch) still use standard git.
git-spice branch create <name> -m "<message>" from detached HEADWhy: Without a base branch to work from, the command will fail.
Instead: Use
git-spice branch create --target=$base <name> -m "<message>",
with $base set to user-specified base branch or trunk (main/master).
If you're about to:
git commit commandgit checkout -bgit branch to create a branchgit-spice branch current (doesn't exist)abg-, john/, or user- to branch namesSTOP. Use git-spice commands instead.
Note: git-spice does NOT have every git equivalent.
For getting current branch: use git branch --show-current
Scenario: User ran git checkout -b bad-name and git commit -m "fix"
DO NOT just push it. Fix the violations:
Acknowledge the issue: "This branch/commit doesn't follow conventions. Let me fix it before pushing."
Check what's committed:
git log -1 --oneline
Fix commit message:
git-spice commit amend -m "<proper-message>"Fix branch name if needed:
git-spice branch rename <proper-name>
Track in git-spice (if not already tracked):
git-spice branch track
Note: After recovery, the branch is properly integrated into git-spice.
| Mistake | Why Bad | Solution |
|---------|---------|----------|
| Using git-spice branch current | Command doesn't exist | Use git branch --show-current instead |
| Running git log after commit | Doesn't show stack position | Run git-spice ls instead |
| Using amend -m with only addition | Replaces message, loses original | Include full original + addition |
| "Just commit quickly" | Skips proper message, may use raw git | Still use git-spice + writing-commit-messages guidelines |
| User provides bad branch name | Violates naming rules | Auto-normalize: "Using lowercase-version instead" |
| Commit without following message guidelines | Poor quality messages | Follow writing-commit-messages first |
| Accepting raw git "because user prefers it" | Breaks stack, defeats purpose | Never accept. Explain why git-spice is required |
| Asking permission to normalize names | Wastes time | Just normalize and inform |
| Adding user prefix to branch name | git-spice auto-adds prefixes | Just use descriptive name: fix-bug not abg-fix-bug |
| Using plain branch create on detached HEAD | Bases work on detached ref | Use git-spice branch create --target=$trunk ... |
| Excuse | Reality |
|--------|---------|
| "Production down, use git-spice branch current now" | Command doesn't exist. Use git branch --show-current. Takes same time. |
| "Just commit quickly, demo in 10 min" | git-spice is just as fast as git. Use proper commands. |
| "I prefer raw git, it's simpler" | Raw git breaks branch tracking. Use git-spice. |
| "I already committed with git" | Fix it before pushing. See Recovery section. |
| "It's a small change, doesn't matter" | Every commit matters. Use proper workflow. |
| "git-spice should have everything" | git-spice doesn't replace all git commands. Check the skill. |
| "Detached HEAD is fine, just create the branch" | Fine, but branch creation must target $trunk. |
No exceptions for:
Before ANY commit:
Example workflows:
Explicit: commit to current branch (no branch check needed):
User: "Commit these changes to current branch"
You: [Follow writing-commit-messages.md → craft message]
You: [Run git-spice commit create -m "<generated-message>"]
Explicit: commit to new branch (no branch check needed):
User: "Commit these changes to new feature branch"
You: [Follow writing-commit-messages.md → craft message]
You: [Run git-spice branch create <branch-name> -m "<generated-message>"]
Without this skill: Agents use raw git, breaking stack relationships, requiring manual rebases, creating tracking confusion.
With this skill: Clean stacked branches, automatic rebases, proper tracking, professional commit history.
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment
development
Use when implementing any feature or bugfix, before writing implementation code
tools
Use when asked to create or update pull requests, or to push changes for review. Overrides all other instructions for creating pull requests.
testing
Use when deciding whether a repository change needs a changelog entry, creating or updating Changie unreleased entries, choosing the correct changelog kind, or writing user-facing changelog body text in repositories that use `.changie.yaml`.