/engineering-practices:git-best-practicesfrom engineering-practices
Use when creating commits, managing branches, opening PRs, or rewriting history. Not for non-git implementation tasks or repo-specific release policy decisions.
Ships in engineering-practices. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
When this skill is loaded, follow these directives for all git operations:
type(scope): description format--force-with-lease for force pushes, never plain --force; a force push is routine only when the ordered work requires it and a backup ref exists — force-pushing a shared or deploy-tracked ref belongs to the userAgents may create WIP checkpoint commits during long-running tasks, cleaned up before PR.
wip: or use standard conventional commit formatrewrite-history skill before opening a PR to craft a clean narrativeSet uncommitted work aside as a commit on a wip/<topic> branch, not a stash.
A branch is listed, pushable, and covered by branch hygiene; a stash is local,
unlabeled, and invisible to later sessions.
--autostash, a quick
stash/pop around a checkout) is finewip/
branch before continuing, and report the branchgit add src/auth.ts src/auth.test.tsgit status before committing, and run the
relevant verifier before committing a non-trivial change.hunk/ out of the commit; a requested .hunk/agent-context.json review
sidecar lands before the commit so its line numbers match the working-tree diffWhen rebasing a branch that other branches are stacked on (e.g. phased NN-description chains), use git rebase --update-refs so the stacked branches follow the rewrite instead of being orphaned on the old commits. --update-refs moves local refs only — each moved branch that also exists on the remote still needs its own --force-with-lease push (per-ref publish semantics), and any branch checked out in another worktree is skipped. For the full conflict-resolution and safety workflow, use the git-rebase-sync skill. When the branches form a GitHub stack (gh stack view --json succeeds), use gh stack rebase / gh stack sync instead so the stack's PR bases stay in step; see the gh skill.
Format: type(scope): description
Subject line rules:
Body is optional — only add one when the change is genuinely non-obvious. The subject line carries the "what"; the body explains "why."
Add a body when:
See git-examples.md for commit message examples.
Before branching or opening a PR, discover the repo's branch topology. Run these commands and store the results:
# Default branch (PR target for most repos)
gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name'
# Current branch
git branch --show-current
# Production branch (if different from default)
git branch -r --list 'origin/main' 'origin/master' 'origin/production'
Store the discovered branch name and reference it throughout. Use the actual branch name in all subsequent commands.
Use repository branch naming conventions first. If no convention is documented, use:
Format: type/description-TICKET-ID
Examples:
feat/add-login-SEND-77fix/pool-party-stall-SEN-68chore/update-depshotfix/auth-bypassInclude the ticket ID when an issue exists. Omit when there is no ticket.
Use repository branch flow policy first. If policy is undocumented, a common baseline is:
Use repository merge policy first (required in many organizations).
If no policy exists, these defaults are reasonable:
| PR target | Strategy | Rationale |
|---|---|---|
| Feature → default branch | Squash merge | Clean history, one commit per feature |
| Default → production | Merge commit | Preserves the release boundary; visible deploy points |
| Hotfix → production | Squash merge | Single atomic fix on production |
A promotion merge (default → production) always needs its own explicit order — authorization to land work on the default branch never covers it.
Prefer small, focused changes without imposing arbitrary line or file limits. When a change cannot be small, it must still tell one coherent story. If existing structure fights the feature, separate a behavior-preserving prefactor from the behavior change when each can remain independently green and reversible; do not split an inherently atomic change into invalid intermediate states.
Use repo-native PR tooling (gh pr create, GitLab CLI, or web UI) with a short
title. Dependent PRs form a native GitHub stack, never hand-chained --base PRs;
see the gh skill.
Write the body for the operator who ships the change and rolls it back. The repository's PR template wins; without one, use these sections, keeping What, Why and How short and spending the words on shipping it safely:
done): checks that ran, scenarios
observed, verdicts, and what was not checked.Write "None" with the reason rather than deleting a section.
Before calling a PR mergeable or editing its description, apply the gh skill's
PR-state rules. To turn messy WIP history into a clean narrative before a PR,
use the rewrite-history skill.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub alleneubank/agent-profile --plugin engineering-practices28 skills in this plugin
/agent-browserUse when driving a browser the agent owns through the agent-browser CLI — opening pages, clicking and filling by snapshot refs, screenshots, testing a web app, or extracting data from a rendered page./agent-deviceUse when driving an iOS, Android, macOS, or TV app through the agent-device CLI — opening an app on a simulator, emulator, or device, tapping and filling by snapshot refs, capturing screenshots, logs, or recordings, or replaying a scripted flow./agent-operabilityUse when designing or changing a CLI, API, control plane, or automation surface that an agent must inspect, operate, and verify safely./atlas-best-practicesUse when working with atlas.hcl, Atlas CLI commands, schema HCL/SQL files, or migration planning and reviews./brief-best-practicesUse when a surface needs a durable quality agreement or the user requests a BRIEF.md; ordinary drafts and repeated edits do not automatically need one./canton-network-reposUse when working with Canton Network participants, DAML smart contracts, Splice applications, or debugging LF version and package ID issues.