git-flow¶
Git and GitHub, the way every repository here uses them: commits in the repository's convention, issues and epics with sub-issues, pull requests that ask the AI reviewers once, an overview of the open ones, and watching one through CI and AI review until it is green. SPEC.md §4.2 lists what follows (rules, templates, labels); epic #20 tracks the skills.
workflow builds on this plugin: its work-on and coordinator hand a pull request to
babysit-pr. The Tech-Stack page for plugins and skills is
docs/stacks/claude.md.
Skills¶
commit¶
Commits the current work in the repository's convention. It builds on Anthropic's /commit from
commit-commands — the same context: status, diff, recent log — and adds what that command
leaves out: the subject format, read from CLAUDE.md / AGENTS.md or the newest subjects in
git log (Conventional Commits when neither gives one); a body from the repository's commit
template or a default (why, what changed, the issue line, the session's co-author trailer); and
three checks before committing:
- Identity.
git config --get user.name/user.emailmust be set. A missing one is reported, pointing todev-env:dev-doctor; the skill never sets one, never with-c, and never copies one fromgit log. - Staging. Files are staged by name (
git add -- <paths>); backups,*.env, local settings and anything the user did not mention stay out.git add -Aonce committed asettings.local.json.bak. - Secrets. Two
git diff --cached -Gscans — known token formats, and long values assigned to secret-sounding names — stop the commit on a real value in an added line.
The message is written to a file outside the repository with the Write tool, a fresh name per
commit, and goes in through git commit -F <file> — never -m, and never a heredoc: dcg scans
a heredoc body as embedded code and can fail to verify it in time, which stops the session for a
person's answer (#742). It does not
wrap or fork /commit: that command stages with git add:* and has no checks, so the skill is
the variant to use where a convention exists; /commit keeps working beside it.
allowed-tools pre-approves only reads — git status, git diff, git log and the three
git config --get reads; git add and git commit go through the permission prompt (SK-5).
When: "commit this", "commit the fix and keep going", and before any git add or git commit of
finished work. Example: /git-flow:commit. The skill: plugins/git-flow/skills/commit/SKILL.md.
github-issues¶
Reads issues — lists, single issues with comments, and an epic's sub-issue tree with
gh-issues tree — and writes them through a plan: the bodies and a plan.json are written to a
scratch directory, gh-issues check validates them against the repository (labels exist, bodies
are not empty, no open issue has the title, parents and {{key}} references resolve), the user
confirms, and gh-issues create creates the issues in order, links sub-issues to their parents
and fills the epic's checklist with the new numbers. Only reading and checking are pre-approved;
every write asks.
The conventions — title prefixes, labels, body sections — are read from the repository at run
time, so the skill works the same in every repository. workflow:workstream creates and links
an epic's sub-issues through it.
When: "what is in epic 20?", "file this as an issue", "split this plan into tickets". The skill:
plugins/git-flow/skills/github-issues/SKILL.md.
pull-request¶
Opens the pull request of the current branch, or updates an existing one. The title follows the
repository's commit subject format; the body follows its pull request template, or a default with
Summary, Changes, How it was checked, AI suggestions corrected or rejected, and Open points for
the owner. The open points go on the owner's decision page (workflow:owner-feedback) and the
body only links it; without the workflow plugin they stay in the body. It links the issue with Closes #n, and a branch cut from another open PR's branch is
based on that branch and says so. The body is written to a file and always sent with
--body-file. Only reading is pre-approved; the push, the create, every edit and every review
request are shown to the user first.
A pull request opens as a draft. The required checks run on every push, unless the repository's CI skips drafts; the AI reviews come once, when it is marked ready, so their findings arrive in one batch instead of one review per push.
The Claude review workflow reviews a pull request once: it has no synchronize trigger and stops
once Claude has commented. The skill restarts it (rerun, or close and reopen) only while Claude
has not commented, and says so otherwise. It ends by suggesting babysit-pr.
When: "open a PR", "update the PR description", "ask Copilot again", "mark the PR ready". The
skill: plugins/git-flow/skills/pull-request/SKILL.md.
open-prs¶
Lists the open pull requests of the current repository, or of another one with --repo, and names
the next step for each: failing or pending checks, unresolved review threads, a push Copilot has
not reviewed yet, a failed claude-review, or ready to merge. It only reads.
It runs pr-watch list: one GraphQL query for the newest 20 open pull requests and one more for
which of their checks are required — the same isRequired flag gh pr checks --required uses,
which also sees organisation rulesets that the rules API does not show.
When: "what PRs are open?", "is anything ready to merge?". The skill:
plugins/git-flow/skills/open-prs/SKILL.md.
babysit-pr¶
Watches one pull request until it is green and mergeable — CI, Copilot and the claude-review workflow — and fixes, rejects or escalates each finding. It merges only when the user has consented in the same session.
It pre-approves only reads (pr-watch snapshot, wait, plain git and gh reads). Its writes —
fix commits, pushes, replies, review requests, reruns — go through the session's permission mode:
invoking the skill is consent to the loop's writes on that PR, and the permission prompt confirms
each one. In the default mode the first round prompts once per command; "don't ask again" keeps
later rounds quiet, and an auto-mode worker is not prompted at all.
After 5 fix rounds the watcher stops. pr-watch extend --rounds N --by WHO --reason TEXT allows
more — at most 10 extra in all — and records in that state who allowed them and why; the skill
runs it only on the coordinator's or the owner's approval.
The owner can waive an AI reviewer — Copilot while its quota is used up, say:
pr-watch waive --reviewer copilot|claude-review --by WHO --reason TEXT records it, with
who and when, in <git-common-dir>/babysit-pr/waivers.json, which every worktree of the
repository shares; unwaive lifts it and waivers lists what is in force. While it holds, wait
neither asks for nor waits on that review, request-review skips the reviewer and snapshot
shows waived (<reason>, <date>). The skill sets a waiver only on the owner's word.
AI review rounds have a cap of their own, the owner's: 3 per pull request, counted as
Copilot's reviews. The watcher counts them from the reviews on GitHub, not from
its state file, so a new worktree, a push not recorded with pushed or a re-review of an
unchanged head cannot get past it. That is
how one pull request once got 10 Copilot reviews past a fix-round cap of 5. From the 4th review
on, and from the 2nd on once the checks are green, the watcher returns defer_to_ledger: new AI
findings go to a follow-up issue, the ledger, instead of into a fix round. A deferral
(reply --verdict deferred) must name that issue, a fixed verdict on an AI finding is refused,
and extend does not lift the cap.
A Copilot review body can list "Previously missed" findings that have no thread. pr-watch ack
refuses such a body until each finding has a verdict — --finding N fixed|rejected|deferred TEXT
— and posts the verdicts to the pull request as a comment, the way a thread reply records one.
The rules for judging a finding — section "Fix, reject or escalate" of the skill — are shared with
workflow:ready.
When: "babysit PR 42", "get the PR green", "deal with Copilot", and right after a pull request
was opened. The skill: plugins/git-flow/skills/babysit-pr/SKILL.md.
Hooks¶
The commit guard¶
Prose and allowed-tools hold only when the skill runs, and Haiku rarely invokes it (#122). So
the plugin also ships hooks/guard-commit.sh (plugins/git-flow/hooks/guard-commit.sh), a PreToolUse hook on
every Bash call, which holds two of the rules in every session with git-flow enabled, skill or
not:
- Stage by name.
git add(orgit stage) with-A,--all,-u,--update(or a prefix git accepts, such as--al),--pathspec-from-file,., a directory, a glob or a:pathspec,git commit -a, andgit commitwith such a pathspec (it commits the working-tree state of what it matches), are refused with exit 2 and the hint to stage by name. git matches a pathspec with*,?or[as a glob even when a file has that very name, so such a name is staged as':(literal)src/[id].tsx'. An alias (git ciforcommit -a) is resolved first. - No secret in a commit. Before
git commit, it scans the lines the commit would add: the staged diff, the files named on the commit line, and the files agit addearlier in the same command is about to stage. A known token format (GitHub, GitLab, Anthropic, Slack, AWS, Google API keys), a private key or a staged*.envfile refuses the commit. A long value with a digit in it, assigned to a secret-sounding name (api_key: 7f3c…), turns the call into a permission prompt ("permissionDecision": "ask"): the pattern cannot tell a key from a hash, and only the user can say it is not secret. The hook prints file and line, never the value.
It splits the command into words the way the shell does (quotes, $'…', heredocs and
here-strings), so a commit message that mentions git add -A is not a command. It follows
git -C <dir> and a cd <dir> earlier in the same command, and checks as commands of their own
what $( … ), backticks, bash -c, eval and a shell alias (!git add -A) run. It runs before
the user has approved the command, in a repository the command may name, so it runs nothing that
repository configures: no core.fsmonitor program, no external diff, textconv driver or pager,
no fetch from a promisor remote, and no clean filter (a named file is compared with its committed
version by diff, not git diff). A refusal runs no git at all, and the scan runs only reads
that take no optional lock, so the hook never leaves an index.lock behind; the commit skill
says what to do about a stale one. A staged diff it cannot read refuses the commit. Every other
command passes silently in a few milliseconds. It does not duplicate the destructive command
guard (dcg), which guards against data loss, not against what goes into a commit. Tests:
tests/guard-commit-test.sh, run by scripts/ci/check-plugins.sh on Linux and Windows.
Restoring the executable bit¶
hooks/restore-exec-bit.sh (plugins/git-flow/hooks/restore-exec-bit.sh), on SessionStart, makes the launchers
in bin/ executable again. A Desktop session on a remote host ships the client's copies of the
plugins without their file mode (docs/setup/desktop-remote.md).
Putting bin/ on the PATH¶
hooks/bin-on-path.sh (plugins/git-flow/hooks/bin-on-path.sh), on SessionStart, appends bin/ to the Bash
PATH through CLAUDE_ENV_FILE. Claude Code does not do that on Windows, where pr-watch and
gh-issues were otherwise "command not found" in Git Bash (#265). Where bin/ is on PATH
already, it writes nothing. Tests: tests/bin-on-path-test.sh.
Commands on the PATH¶
Claude Code puts the plugin's bin/ on the Bash PATH (on Windows, the hook above does). Both
commands are bash launchers: by full path they run as bash <plugin>/bin/pr-watch, never
through python. Both commands need gh (logged in) and
Python 3; on Windows they skip the Microsoft Store python3 stub.
| Command | Used by | Does |
|---|---|---|
gh-issues |
github-issues, workflow:coordinator |
tree (an issue's sub-issues, two levels), check and create (a plan of issues), link (sub-issues to a parent) |
pr-watch |
pull-request, open-prs, babysit-pr, workflow:coordinator |
list, snapshot, wait, edit, check-body, request-review, reply, ack, pushed, extend, waive, unwaive, waivers |
Two pr-watch subcommands carry the rules that must hold every time:
pr-watch edit --body-file Frefuses a missing or empty file, so an update cannot blank the description, as an empty shell variable once did. It also refuses what the claude-review workflow's hidden-text step refuses in a title or body — raw HTML such as a bare<repo>placeholder, a link reference definition, alt or title text, invisible characters — and names each token with its line.pr-watch check-body --body-file Fruns the same check beforegh pr create. The patterns are the workflow's; a test runs both on the same texts.pr-watch request-reviewasks Copilot only once the PR shows the localHEADas its head (polled every 10 s, up to 5 minutes); asked earlier, Copilot reviews the previous commit. It refuses a draft and a 4th AI review round.
pr-watch keeps its state in <git-dir>/babysit-pr/<n>.json, per worktree, never committed. A
read that fails with HTTP 502, 503 or 504, a timeout or a reset connection is tried three times,
5 and 15 s apart; when it still fails, pr-watch exits with code 75, and starting it again is
safe. Writes are never retried: a write that got a 502 may have happened. Run outside a git
repository, every subcommand but check-body (and list --repo) exits with code 2 and one line
naming the folder.
Configuration¶
None of its own. The conventions — commit subject format, commit and pull request templates,
issue title prefixes and labels — are read from each repository at run time. gh must be logged
in; dev-env:dev-doctor checks and signs it in.
Installation¶
claude plugin install git-flow@<owner>
The marketplace and how updates reach a machine: docs/setup/marketplace.md.
Limits and gotchas¶
- Haiku and the commit skill. Haiku invoked
commitin 1 of 9commit-*eval runs with the earlier description (#122), which led with what the skill does. Leading with when to use it — "Use whenever the user asks to commit", the phrases users type, and "before running git add or git commit for finished work, even when the commit looks simple" — raised that to 7 of 9 (3 runs per case,--model haiku). Sonnet and Opus invoked it in 9 of 9, and no model invoked it on the near miss. Haiku follows the skill less closely than the larger models once it runs; the hook's two rules hold either way. - The commit guard guards against mistakes, not against a session set on getting round it: a
command built from variables (
$cmd,${opt}) is not followed. A commit refused for a value the user knows is not secret, the user makes in their own terminal. - Each skill's own gotchas: commit (
plugins/git-flow/skills/commit/SKILL.md), github-issues (plugins/git-flow/skills/github-issues/SKILL.md), pull-request (plugins/git-flow/skills/pull-request/SKILL.md), open-prs (plugins/git-flow/skills/open-prs/SKILL.md), babysit-pr (plugins/git-flow/skills/babysit-pr/SKILL.md).