Git workflow

From fmflurry/settings-opencode · View interactive version

Git workflow is an AI agent skill from the GitHub repository fmflurry/settings-opencode. Use this skill for any git work such as creating branches, staging changes, writing commit messages, pushing branches, or preparing pull requests. If the `git-specialist` agent is installed, delegate to that agent. Otherwise the main agent does the work inline by following this skill.

How to use this skill

Skill file

Git Workflow Skill

Use this skill whenever the task involves git.

When to Activate

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.

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

Commit Rules

Examples

Branch Convention

Every branch name must follow this format:

<type>/<scope>-<short-description>

Branch Rules

Examples

Git Specialist Expectations

If the git-specialist agent is installed, it must follow this list. Otherwise the main agent follows the same list inline.

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:

Output Expectations

For git tasks, return:

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:

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:

Mandatory Pre-Commit Self-Check

Before every git commit, in order:

  1. Run git diff --cached --shortstat and git diff --cached --name-only.
  2. Apply the Counting Scope above and compare the result against the Commit Size Signal thresholds.
  3. 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.
  4. 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

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:

  1. chore/cross-cutting infra (project files, packages, configuration)
  2. domain (entities, value objects, rules)
  3. application (ports, handlers, use cases)
  4. infrastructure (adapters, persistence, HTTP clients)
  5. api/presentation (endpoints, DI wiring, Program.cs)
  6. tests (or co-commit with the layer under test when doing TDD)
  7. docs/ADR

Atomicity Rules

Commit Sequencing (commit-as-you-go)

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:

  1. Analyze full commit history (not just the latest commit)
  2. Use git diff [base-branch]...HEAD to see all changes
  3. Push with -u flag if new branch

Feature Implementation Workflow

  1. Plan First
  1. TDD Approach
  1. Code Review
  1. Commit & Push

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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.