agentleFS
affectionatecaffectionatec/agentic-engineering/skills/git-workflow/SKILL.md

git-workflow

Skill5 starsChanged 5 months agoMITView on GitHub

Use when implementation work is about to touch code (branch before the first commit), when a built task needs to ship as a pull request, when defining how branches, commits, and PRs map to plan tasks, or when parallel agents share one repository. Triggers on "create a branch", "commit this", "open a PR", "ship this task", "how do we merge", task start or completion during an implementation plan, worktree setup, or noticing commits landing directly on main.

188 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use squad-commands, ci-cd-pipelines and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • Microsoft AzureSkill

    squad-commands

    Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.

    Also in 5 projects that use this

  • harrissohail6Skill

    ci-cd-pipelines

    CI/CD pipeline design and implementation. Auto-activates when discussing deployment, automation, or pipelines.

    Also in 6 projects that use this

  • Microsoft AzureSkill

    architectural-proposals

    How to write comprehensive architectural proposals that drive alignment before code is written

    Also in 4 projects that use this

  • GitHubSkill

    e2e-template-testing

    End-to-end validation of coordinator and agent template changes

    Also in 3 projects that use this

  • GitHubSkill

    notification-routing

    Route agent notifications to specific channels by type — prevent alert fatigue from single-channel flooding

    Also in 3 projects that use this

  • frostneySkill

    native-nostalgia-stack

    Applies the user's FreePascal toolchain and its build, formatting, hook, and test contracts while leaving project-specific mechanics local. Use when scaffolding or working in a FreePascal project that follows this toolchain.

    Also in 3 projects that use this

  • +5 more from Azure
  • +1 more from github

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 165 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never reuse a branch across tasks: Never let a task branch outlive its merge.

    line 33
  2. Distinctive:

    No drive-by changes. An unrelated fix discovered mid-task becomes its own task in the plan, not a stowaway commit.

    line 39
  3. Very specific:

    After a FAIL verdict: fix commits go to the same branch, each round noted in the PR thread (round 2/3).

    line 57
  4. Distinctive:

    After merge: STATUS flips the module to ✅ with PR + verdict references, and the task branch is deleted — only after merge.

    line 69
  5. Very specific:

    Remove the worktree after merge: git worktree remove ../<repo>-<task-id>.

    line 76
  6. Distinctive:

    main is read-only for agents: No exceptions, including "trivial" fixes.

    line 80

“Common” is measured: kept by at least 6 in 10 of the 165 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Git Workflow — Shipping Through the Gate

Core constraint: main is read-only for agents. Work lands on task branches, ships as draft PRs carrying verification evidence, and merges only after the verifier's PASS and a human who has read the diff. The agent never merges its own PR.

Quick Reference

Use whenCode work starts (branch first); a task is built and needs to ship; parallel agents share a repo
Skip whenDoc-only edits the user has exempted, or repos where the user explicitly owns all git operations
OutputOne branch + one draft PR per task, the PR description carrying the done condition and verdict reference
SequenceIMPL PLAN task starts → BRANCH → build → self-check → DRAFT PR → VERIFY → PASS → ready → human gate → MERGE → STATUS ✅
Iron ruleOne task, one branch, one PR. Never commit to main. Never merge your own PR.
Sibling skills[[project-kickoff-prd]] · [[technical-specification]] · [[architecture-decision-record]] · [[implementation-plan]] · [[status-tracker]] · [[independent-verification]] · [[agents-md-template]]

Why This Exists

The rest of the chain defines what to build (IMPL PLAN), how to prove it (VERIFY), and how to remember it (STATUS) — but without a git contract, how code actually lands is left to agent defaults, and agent defaults are destructive: commits straight to main, three tasks bundled into one diff, "done" declared with nothing pushed.

Two concepts the chain repeats — merging through the verification gate and the human gate — only become operational when there is a branch to verify and a PR for the human to read. This skill is that contract.

Branch Protocol

  1. main is protected. Agents never commit to it, never push to it, never rewrite it.
  2. One branch per task, created from up-to-date main at task start (the branch is the workspace — the In-Flight Checkpoint references it):
    • Naming: task/<task-id>-<slug> — e.g. task/m1-t2-user-model
    • For long milestones, an optional integration branch milestone/<id> — task branches then fork from and PR into it
  3. Never reuse a branch across tasks. Never let a task branch outlive its merge.

Commit Protocol

  1. Small commits inside the task — each a coherent step, not an end-of-session dump.
  2. Message format: <task-id>: <imperative summary> (e.g., M1-T2: add user model with validation). Cite the spec section in the body when it clarifies intent.
  3. No drive-by changes. An unrelated fix discovered mid-task becomes its own task in the plan, not a stowaway commit.
  4. No history rewriting once verification has started. The verdict cites a commit range; force-pushing invalidates the evidence. If a rebase is unavoidable, the task drops back to 🔍 and re-verifies.

PR Protocol

  1. Producer self-check passes (lint, full suite, test ratchet) → push the branch → open a draft PR immediately. The diff becomes inspectable the moment it exists.
  2. The PR description carries the contract:

    **Task:** M1-T2 — [title] ([plan link])
    **Spec:** spec/auth.md §2.1
    **Done condition:** [the executable criteria, copy-pasteable]
    **Verification:** [link to the verdict entry in docs/verification-log.md — added when the verdict lands]
    **Caveats:** ⚠️ [anything that needs special environment / keys / follow-up]
  3. One task = one PR. A PR that needs a second task's changes is mis-scoped — fix the plan, not the PR.
  4. Draft until PASS. Flip to "ready for review" only when the verifier's PASS verdict is recorded, adding the verdict reference to the description in the same motion.
  5. After a FAIL verdict: fix commits go to the same branch, each round noted in the PR thread (round 2/3). Silent fix-ups are an anti-pattern — the PR history must match the verdict history.

Merge Gate

Merging requires all three:

  1. Verifier PASS recorded in docs/verification-log.md
  2. A human has read the diff and can explain it (the human gate)
  3. CI green, if CI exists — noting that CI green alone is neither ① nor ②

The agent never merges its own PR. In unattended loops this is absolute: the loop's output is a queue of verified, evidence-carrying PRs — merged code is always a human's move.

After merge: STATUS flips the module to ✅ with PR + verdict references, and the task branch is deleted — only after merge; until then the branch is evidence.

Worktrees — Parallel Agents

  • One worktree per agent: git worktree add ../<repo>-<task-id> task/<task-id>-<slug> — isolated working copies of the same repo, no file collisions.
  • Worktrees solve mechanical conflicts only. The real ceiling is human review bandwidth: every parallel agent emits PRs a human must read, and verdicts a verifier must produce.
  • Tasks touching the same files must not run in parallel regardless of worktrees — that is a dependency the plan missed (→ [[implementation-plan]]).
  • Remove the worktree after merge: git worktree remove ../<repo>-<task-id>.

Rules

  1. main is read-only for agents. No exceptions, including "trivial" fixes.
  2. One task, one branch, one PR. Traceability runs diff → PR → task → spec.
  3. Branch names derive from task IDs. A reviewer can find the contract from the branch name alone.
  4. PRs are born draft. Ready-for-review is earned by a PASS verdict, not by the producer's confidence.
  5. No history rewriting after verification starts. Evidence integrity outranks a tidy log.
  6. Never merge your own PR. Both gates (verifier + human) live on the merge button.
  7. Delete branches only after merge. Branches referenced by verdicts are evidence.
  8. AGENTS.md wins. Repo-specific overrides (protected branch names, PR conventions, merge strategy) live in AGENTS.md — this skill defines the defaults.

Anti-Patterns (Do Not)

Anti-PatternWhy It Fails
Committing to main "just this once"The exception becomes the workflow; one stray commit on main poisons every open branch
Multi-task PRsThe reviewer can't map the diff to a done condition; verdicts lose their object
Silent fix-ups after a FAILUnannounced commits or force-pushes decouple the PR from the verdict history
Merging because CI is greenCI is necessary, never sufficient — it is neither the verifier nor the human gate
Long-lived task branchesA task is ≤ 90 minutes by plan rule; a week-old branch means the task was mis-scoped
Deleting branches before mergeDestroys the evidence the verdict references
Agent merging its own PRThe one unguarded door that bypasses both gates at once

Relationship to Other Documents

  • IMPL PLAN supplies the task IDs that name branches and PRs ([[implementation-plan]])
  • VERIFY verdicts cite the branch/commit range; PASS is what flips a PR from draft to ready ([[independent-verification]])
  • STATUS records PR state per module and the verdict reference behind every ✅ ([[status-tracker]])
  • AGENTS.md carries repo-specific git overrides and the boundaries that enforce this contract ([[agents-md-template]])

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.