commit
npx machina-cli add skill technicalpickles/pickled-claude-plugins/commit --openclawGit Commit
Preferences and best practices for interacting with a git repository.
git add
ALWAYS use git add with specific files that have been updated. NEVER use git add . or git add -A.
IF adding files that look like they are agent configuration, or adding planning documentation, ALWAYS prompt the user to confirm if they should be included or not.
git commit
PREFER writing out a commit message to the scratch/ directory, and save it to a name reflecting what is being commited. Then use use git commit -t scratch/path-to-message.txt
signing
We have git commit signing setup. If it fails due to a message like:
error: 1Password: failed to fill whole buffer
fatal: failed to write commit object
... it is because the user was being prompted to authorize signing, and didn't see it or missed it. Do not try to fix or bypass it. Stop and prompt the user about either fixing it, or confirm bypassing it.
hooks
pre-commit failures
When git precommit checks fail, analyze what the failures are, and try to autofix when possible, otherwise think through how to fix it. Ask the user how to proceed when it's unclear if how to fix.
DO NOT follow sorbet's autocorrection advice. DO NOT skip verification without confirmation from the user.
prepare-commit-msg and post-commit
If we see errors like:
git: 'duet-prepare-commit-msg' is not a git command. See 'git --help'.
it is because we previously were using git-duet. It uses a git template, with hooks that call git duet-prepare-commit-msg. We've sinced moved, but the files will still be present
In this case, check .git/hooks/ for references to these. Remove files that call it.
Source
git clone https://github.com/technicalpickles/pickled-claude-plugins/blob/main/plugins/git/skills/commit/SKILL.mdView on GitHub Overview
This skill covers how to interact with a git repo for commits, emphasizing precise staging, thoughtful commit messages, and signing. It also explains how to handle pre-commit failures and legacy git-duet/template hooks to keep history clean.
How This Skill Works
It guides you to always git add with specific files, never use git add . or git add -A. It recommends drafting commit messages in scratch/ and committing with -t to reference the message. It also explains signing failure scenarios and instructs you to stop and address the cause rather than bypass it, and how to diagnose and fix pre-commit or duet-related hook issues.
When to Use It
- When preparing to commit code changes to a git repository
- When you need to stage only updated files and avoid broad adds
- When committing with required or desired signing of changes
- When pre-commit checks fail and you need to analyze and fix it
- When cleaning up legacy git-duet/template hook references in a repo
Quick Start
- Step 1: git add path/to/updated-file.py (avoid using git add . or -A)
- Step 2: Write your commit message to scratch/path-to-message.txt and run git commit -t scratch/path-to-message.txt
- Step 3: If signing prompts appear, do not bypass; address the issue or confirm bypassing; clean up any lingering duet-related hooks if present
Best Practices
- Always use git add with specific files that have been updated; never use git add . or git add -A
- If you encounter agent config or planning docs, prompt the user to confirm inclusion
- Draft commit messages in scratch/ and commit from that file via git commit -t scratch/path-to-message.txt
- If signing fails, do not fix or bypass automatically; stop and ask the user to fix it or confirm bypassing
- When pre-commit checks fail, analyze the failures and autofix only when possible; do not skip verification without user confirmation
Example Use Cases
- Stage only modified src/main.py and commit using a scratch message with -t
- Draft a descriptive message in scratch/docs-improvement.txt and commit from it
- If 1Password signing prompts appear, stop and decide how to proceed rather than bypassing
- Encounter pre-commit failure, review errors, and apply a safe fix rather than auto-correct
- Remove obsolete references to duet-prepare-commit-msg in .git/hooks to resolve template hook issues