From use-git
Git and GitHub CLI conventions for Claude Code. Use when: (1) running git commands (commit, push, merge, rebase), (2) running gh CLI commands (pr create, issue create, pr review), (3) passing long content to git or gh (PR bodies, issue bodies, review replies), (4) reviewing code that uses git or gh CLI patterns. Covers tmpfile patterns, HEREDOC commits, GPG signing, safe push practices, and permission-prompt avoidance.
How this skill is triggered — by the user, by Claude, or both
Slash command
/use-git:use-gitThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Conventions for running git and GitHub CLI (`gh`) commands in Claude Code. These rules keep Bash commands short, avoid unnecessary permission prompts, and prevent destructive operations.
Conventions for running git and GitHub CLI (gh) commands in Claude Code. These rules keep Bash commands short, avoid unnecessary permission prompts, and prevent destructive operations.
--body-file. Keeps Bash commands short and avoids permission prompts.$(cat << 'EOF' ... EOF). Single-quoted 'EOF' prevents variable expansion.git commit -S. The sandbox cannot access GPG keys, so resort immediately to the unsandboxed command.--amend would modify the wrong commit.git push --force, git push -f, --no-verify, or similar override flags without explicit user instruction. If the user explicitly requests a force push, use git push --force-with-lease (add --force-if-includes when the installed Git version supports it, v2.30+). Investigate root causes rather than forcing through.; or &&, which trigger permission prompts..env, credentials.json, *.pem, *.key, or similar secret files.--no-ext-diff --no-color (and --no-pager before the subcommand) on diff-producing commands (git diff, git log -p, git show). User configs may route diffs through external tools like difftastic, producing output that is harder to parse. These flags ensure standard unified diff format.| Scenario | Pattern | Reason |
|---|---|---|
| Commit messages | HEREDOC | Short, predictable length |
PR bodies (gh pr create) | Tmpfile + --body-file | Can be long; HEREDOC triggers prompts |
Issue bodies (gh issue create) | Tmpfile + --body-file | Can be long |
| Review replies | Tmpfile + --body-file | Variable length |
| Worktree prompts | Write tool to /tmp/ | Avoids shell escaping |
| Tag messages | Inline -m | Typically one line |
references/tmpfile-pattern.mdreferences/heredoc-pattern.mdreferences/safety-rules.mdreferences/common-operations.mdreferences/diff-output.mdQuick reviews (default):
Deep dives by topic:
references/tmpfile-pattern.md - When and how to use tmpfiles for long contentreferences/heredoc-pattern.md - When and how to use HEREDOCs for commit messagesreferences/safety-rules.md - GPG signing, never amend, never force, secret exclusion, parallel callsreferences/common-operations.md - Base branch detection, push with upstream fallback, conventional commits, branch namingreferences/diff-output.md - Clean diff output flags for bypassing external diff tools, colors, and pagersCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cboone/agent-harness-plugins --plugin use-git