Git Workflow Skill
Use this skill whenever the task involves git.
When to Activate
- Creating or renaming branches
- Staging changes
- Writing commit messages
- Creating commits
- Pushing branches
- Preparing pull requests
- Reviewing branch names or commit message format
Required Delegation
When git work is needed: if the git-specialist agent is installed, delegate to that agent via the /git command. Otherwise the main agent does the work inline by following this skill.
- If
git-specialistis installed, do not handle substantive git workflow in the main agent when/gitcan handle it. Otherwise the main agent does that git work inline. - If
git-specialistis installed, that agent owns branch naming, commit message drafting, staging, commits, and pushes. Otherwise the main agent does those inline. - Keep non-git implementation work in the main agent. If
git-specialistis installed, switch to/gitfor repository operations. Otherwise stay in this session and follow this skill. - If you are already the
git-specialistagent, execute the git task directly and do not re-delegate it. Follow the Canonical spec section below.
Commit provenance
Claude Code and OpenCode agent-shell Git commits receive Harness, Harness-SHA, and Session-Id trailers from the installed session hooks. The SHA identifies the installed source checkout; -dirty means the source was dirty, the prior installation or overlay could not be proven clean, or installed managed files changed since capture. Do not remove or invent these trailers. Human shells outside agent sessions are unaffected.
Before creating or updating a PR, run agent-harness pr-provenance list origin/<base> HEAD and paste its output into the PR body. Run it again after new commits. The PR body check rejects missing records. Use agent-harness ship-merge for squash merges: it copies the checked PR body into the squash message. Direct agent-shell gh pr merge requires --rebase or --merge and the current --match-head-commit.
Known limits: GitHub website/API merges, Git hook overrides such as core.hooksPath, agent commits made with the guard bypassed, and OpenCode builds without shell.env are outside this best-effort guarantee. Human commits are not blocked.
Commit Convention
Every commit message must follow this format:
<type>(<scope>): <short summary>
[optional body]
[optional footer(s)]
When scope is not useful or not clear, this no-scope form is also valid:
<type>: <short summary>
Allowed Types
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect behavior, such as formattingrefactor: Code changes that neither fix a bug nor add a featuretest: Adding or correcting testschore: Maintenance tasks such as tooling or build updates
Commit Rules
- English only: subject and body MUST be English, even when the diff or conversation is French.
- Prefer including a meaningful
scopewhen the affected area is clear - Omit
scopeinstead of inventing one when it is not clear - Use a concise present-tense summary
- Keep the summary focused on intent, not a file-by-file changelog
- Match the type to the actual purpose of the change
Examples
feat(api): add user authentication endpointfix(auth): prevent empty login submissionchore(settings): sync opencode configuration
Branch Convention
Every branch name must follow this format:
<type>/<scope>-<short-description>
Branch Rules
- Reuse the same allowed
typevalues as commits scopeis required for branchesscopemust be a single lowercase token with letters and numbers only- The first
-after/separatesscopefromshort-description - Use a short kebab-case description
- Keep the branch name specific to the actual change
- If branch scope is ambiguous, ask one short question before creating the branch
Examples
feat/auth-login-formfix/api-token-refreshchore/settings-git-workflow
Git Specialist Expectations
If the git-specialist agent is installed, it must follow this list. Otherwise the main agent follows the same list inline.
- inspect repository status before acting
- draft compliant branch names and commit messages
- stage only relevant changes
- avoid destructive git commands unless explicitly requested
- push only when requested or clearly part of the delegated git task
- detect the host from
git remote get-url originand use the matching CLI for PR work:ghfor GitHub,az repos prfor Azure DevOps - preserve repository history hygiene
Azure DevOps work item lifecycle
For Isagri_Dev_GC_GestionCommerciale Feature, User Story, Enabler, and Enabler Story work, run agent-harness ado-state start "$(git branch --show-current)" "$ARGUMENTS" when work starts. Pass the request or PR text containing an AB#<id> reference when the branch does not carry the ID. If references disagree, the helper skips the update. Include the AB#<id> in the PR body when the branch has no ID. At PR creation keep the item Active; after confirming a merge, run agent-harness ado-state merged "<head-branch>" "<PR body>". /ship runs the start and merge updates through its CLI. For other workflows the agent runs these commands explicitly. The helper only runs for the SAIsagri/gc.platform GitHub repository or a repository in the named Azure DevOps project. It only advances New → Active and Active → Resolved, checks the project and work item type, uses a revision check, and never modifies board columns. Missing IDs are silent; an unavailable Azure CLI or failed update warns without blocking work. It skips Bugs, security-tagged items, and security-named branches; do not use it for other security-specific flows.
Pull Request Rules
When the task includes PR creation or inspection:
- Follow the
pr-visual-reportskill before opening or updating the PR. Runagent-harness kpi featurebefore rendering the HTML (Conductor and Monolith). Commitdocs/pr-reports/<branch-slug>.html,.png, and.metrics.json, and include## Visual reportplus the metrics table in the body.agent-harness pr-report-checkchecks the body and warns when metrics are missing or partial. The hook blocksghandazwhen the visual section is missing. A docs typo or a version bump only may skip, with the reason on the skip line. - detect the host from
git remote get-url origin: github.com→ useghdev.azure.com/visualstudio.com→ useaz repos pr(Azure CLI +azure-devopsextension)- otherwise → stop and report an unsupported host
- push the current branch with upstream tracking first if needed
- if a PR already exists for the current branch, return that URL instead of creating a duplicate
- choose the base branch from the repository default branch when available, otherwise prefer
main, thenmaster - use a concise PR title aligned with the branch purpose and commit intent (conventional commit format)
- include a short
## Summarysection in the PR body - Azure DevOps defaults: reviewers = group
PIXELS;--draftis not supported byaz repos pr(ignore the flag for Azure)
Output Expectations
For git tasks, return:
- the branch name used or proposed
- the commit message used or proposed
- whether the branch was pushed
- the pull request URL when a PR exists or was created
- any blockers, such as ambiguous scope or unstaged unrelated changes
Canonical spec
Applies to git-specialist when that agent is installed, and to the main agent when it is not, and to any agent about to run git commit or git push. This is the canonical spec for commit cohesion and staging discipline. The agent doing the git work operates against these rules and does not restate them. If git-specialist is installed, other agents delegate to that agent. Otherwise they follow this spec inline.
Commit Message Format
<type>: <description>
<optional body>
Types: feat, fix, refactor, docs, test, chore, perf, ci
Note: Attribution disabled globally via ~/.claude/settings.json.
Language (mandatory)
Every commit message MUST be written in English — subject, body, and footers — regardless of
the user's language, the orchestrator's language, or the conversation language. French (or any
other non-English) commit messages are a hard violation; do not commit until rewritten.
When the user describes a change in French, translate the intent into an English summary —
never quote or transliterate the French. Conventional Commits format and the type/scope/length
rules above are unchanged. The same English requirement applies to PR titles and PR bodies.
Precedence (mandatory)
This is the canonical spec. If git-specialist is installed, that agent operates against these exact rules. Otherwise the main agent does. Do not restate the full spec elsewhere; reference this section instead.
Logical cohesion is the hard rule; commit size is a signal, never a blocker. A commit is one coherent logical set of changes. Size never justifies breaking a coherent set apart. When cohesion and a size number conflict, cohesion wins.
Counting Scope
The size signal below counts only review-weight changes: application source code and application configuration.
Exempt from the count: test fixtures and test data (Bruno .bru, .http, seed files, test JSON/CSV/XML), snapshots, documentation and markdown, generated migrations, generated/scaffolded code, lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lock), binaries/assets, pure renames detected as R100.
Commit Size Signal (non-blocking)
More than ~15 counted files or ~400 counted lines in a commit → look for a legal split (see Legal-Split Test below) and report the observed counted numbers. This is a signal to check for a natural split — never a reason to refuse, block, unstage, or delay a commit.
Legal-Split Test
A split is legal only if every resulting commit has:
- (a) a distinct
type(scope) - (b) a one-line raison d'être that does not mention size, count, or volume
If no candidate split passes this test, commit the coherent set as a single commit and report the observed numbers. That is a normal, acceptable outcome — not a failure.
Forbidden Split Patterns
Never produce, no matter the size pressure:
- a commit subject with
partie 1/partie 2,part 1/part 2,(1/2),suite,bis, or any numeric/continuation suffix - two consecutive commits sharing the same
type(scope)produced by cutting one coherent change in half - a split whose only justification is fitting under a threshold
Mandatory Pre-Commit Self-Check
Before every git commit, in order:
- Run
git diff --cached --shortstatandgit diff --cached --name-only. - Apply the Counting Scope above and compare the result against the Commit Size Signal thresholds.
- Apply the Legal-Split Test. If a legal split exists, restage into the split commits. Otherwise keep the coherent set as one commit — do not force a split to fit the numbers.
- Report the observed counted file/line numbers for each commit, plus a one-line reason whenever a threshold was exceeded and no legal split existed.
Disciplined Staging
- Never
git add -A,git add .,git add --all,git commit -a, orgit commit -am. - Stage by explicit path only — one command per coherent group of files.
- Run
git statusbefore and after staging to confirm no unintended file rode along.
Canonical Split Order (bottom-up)
When a change spans layers, split commits in this order. Each commit should stay as close to compilable as its layer allows:
chore/cross-cutting infra (project files, packages, configuration)- domain (entities, value objects, rules)
- application (ports, handlers, use cases)
- infrastructure (adapters, persistence, HTTP clients)
- api/presentation (endpoints, DI wiring,
Program.cs) - tests (or co-commit with the layer under test when doing TDD)
- docs/ADR
Atomicity Rules
- One commit = one
type(scope):. If the subject needs an "and", or the body lists 3+ heterogeneous bullets, split into 2+ commits. - Never mix a mass rename/move with a behavior change.
- Never mix docs and code in the same commit, except an ADR directly tied to the change.
- Conventional Commits, subject ≤ 50 characters, types: feat, fix, refactor, docs, test, chore, perf, ci.
Commit Sequencing (commit-as-you-go)
- Each logical unit is committed immediately and atomically. If
git-specialistis installed, that agent makes the commit. Otherwise the main agent makes it inline. - When a change spans multiple logical units, sequence it into multiple atomic commits, in compilability order (see Canonical Split Order above). If
git-specialistis installed, that agent does the sequencing. Otherwise the main agent does. No separate planning agent is involved. - Every split produced this way MUST pass the Legal-Split Test above — cohesion defines a "logical unit", not a size threshold.
Pull Request Workflow
The /create-pull-request command owns the PR body contract (## Content / ## QA tests / ## Locked decisions / ## Non-blocking follow-ups). When that command is not used, the agent doing the git work falls back to a minimal template (short ## Summary section) and drops empty sections. If git-specialist is installed, that agent owns the fallback. Otherwise the main agent does. Either body also includes ## Visual report, from the pr-visual-report skill. Run agent-harness kpi feature before that HTML. A docs typo or a version bump only may skip, with the reason stated.
In all cases:
- Analyze full commit history (not just the latest commit)
- Use
git diff [base-branch]...HEADto see all changes - Push with
-uflag if new branch
Feature Implementation Workflow
- Plan First
- If
planneris installed, dispatch to that agent to create the implementation plan. Otherwise the main agent loads theplannerskill and writes the plan inline. - Identify dependencies and risks
- Break down into phases
- TDD Approach
- If
tdd-guideis installed, dispatch to that agent. Otherwise the main agent loads thetddskill and follows RED, GREEN, IMPROVE inline. - Write tests first (RED)
- Implement to pass tests (GREEN)
- Refactor (IMPROVE)
- Verify 80%+ coverage
- Code Review
- Use code-reviewer agent immediately after writing code
- Address Important issues
- Fix Nit issues when they are trivial in the same change
- Commit & Push
- Detailed commit messages
- Follow conventional commits format
Cursor plugin version
From plugin 0.4.1 on, a PR that touches plugin sources bumps the patch number only and adds a CHANGELOG heading for that version. scripts/cursor-plugin/config.json field version is the source of truth. The build copies it into plugins/fmflurry-harness/.cursor-plugin/plugin.json. node scripts/cursor-plugin/check.mjs requires a strictly greater version when plugin sources differ from the base branch.