skills/git-best-practices/SKILL.md
Use when creating commits, managing branches, opening PRs, or rewriting history. Not for non-git implementation tasks or repo-specific release policy decisions.
npx skillsauth add awfixers-stuff/opencode-config git-best-practicesInstall 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.
When this skill is loaded, follow these directives for all git operations:
type(scope): description format--force-with-lease for force pushes; confirm with the user before any force pushgit status and git diff HEADgit add path/to/file for each file; verify with git statustype(scope): description with optional bodygit push --force-with-lease origin {branch} only for rewritten history after user confirmationAgents may create WIP checkpoint commits during long-running tasks, cleaned up before PR.
wip: or use standard conventional commit format/rewrite-history before opening a PR to craft a clean narrativegit add src/auth.ts src/auth.test.tsgit status before committing.env files, credentials, and large binaries out of commits — warn the user if staged files look sensitiveUse --force-with-lease exclusively to protect against overwriting upstream changes:
git push --force-with-lease origin feat/my-branch
Always confirm with the user before any force push, regardless of branch.
Format: type(scope): description
Subject line rules:
Common types:
| Type | Use for |
|------|---------|
| feat | New functionality |
| fix | Bug fix |
| docs | Documentation only |
| refactor | Restructuring without behavior change |
| perf | Performance improvement |
| chore | Maintenance, dependencies, tooling |
| test | Adding or updating tests |
| ci | CI/CD pipeline changes |
| build | Build system changes |
| style | Formatting, whitespace (no logic change) |
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'
If gh is unavailable or the repo has no remote, see the fallback commands in git-examples.md.
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:
{production-branch} (production deploys)
└── {default-branch} (staging/testnet deploys, PR target)
├── feat/add-feature-TICKET
├── fix/bug-description-TICKET
└── hotfix/* (branches off production branch for hotfixes)
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 |
Pragmatic sizing over arbitrary limits. Each commit tells a clear story regardless of PR size. A PR should be reviewable as a coherent unit — if a reviewer cannot hold the full change in their head, consider splitting.
Use repo-native PR tooling (gh pr create, GitLab CLI, or web UI) with:
For branches with messy WIP history, use /rewrite-history to:
Each rewritten commit introduces one coherent idea, building on the previous — like a tutorial teaching the reader how the feature was built.
development
Use when starting dev servers, watchers, tilt, or any process expected to outlive the conversation. Provides zmx session management patterns for long-lived processes.
development
Zig testing skill for writing and running tests. Use when using zig build test, writing comptime tests, using test filters, working with test allocators to detect leaks, or using Zig's built-in fuzz testing (0.14+). Activates on queries about Zig tests, zig test, zig build test, comptime testing, test allocators, Zig fuzz testing, or detecting memory leaks in Zig tests.
development
Zig debugging skill. Use when debugging Zig programs with GDB or LLDB, interpreting Zig runtime panics, using std.debug.print for tracing, configuring debug builds, or debugging Zig programs in VS Code. Activates on queries about debugging Zig, Zig panics, zig gdb, zig lldb, std.debug.print, Zig stack traces, or Zig error return traces.
tools
Zig cross-compilation skill. Use when cross-compiling Zig programs to different targets, using Zig's built-in cross-compilation for embedded, WASM, Windows, ARM, or using zig cc to cross-compile C code without a system cross-toolchain. Activates on queries about Zig cross-compilation, zig target triples, zig cc cross-compile, Zig embedded targets, or Zig WASM.