Git Workflow
Agents never commit or push: you do. The shared git-workflow skill (config/skills/git-workflow/) splits the work around that rule. The agent prepares the branch name, the commit message and the pull request's title and description; you run the steps that publish them, from the chat itself. /next-issue, /next-task, the manual steps and /pr all hand their commands over this way.
Runnable commands
Every command the agent leaves to you is a one-line bash block, complete (real paths, branch, issue and PR numbers, the whole message), in the order to run:
| Where | How to run it |
|---|---|
| Claude desktop app | the Run button on the block |
| Claude Code CLI | ! followed by the command |
| any terminal | paste it at the repository's root |
Text is quoted with single quotes, or $'…' when it holds a newline, so neither bash nor zsh expands anything in a commit message or a title. A command that prompts (git add -p, git rebase -i) cannot run from the chat: the agent marks it in a terminal.
The sequence
Branch, when you are on a shared branch —
main,master,dev,developor the remote's default (you):bashgit checkout -b fix/42-retry-uploadsCommits already made there and not pushed move along; the agent then hands
git branch -f main origin/main, which puts the shared branch back where the remote has it (the commits stay on the new branch).Stage and commit (you), one
-mper paragraph of the message:bashgit add src/upload.ts tests/upload.test.ts && git commit -m 'fix(upload): retry on 503' -m $'- retry three times with backoff\n- log each retry' -m 'Fixes #42'Push (you):
git push -u origin fix/42-retry-uploadsthe first time,git pushafter.Pull request: you open a new one, after the push; the agent syncs an open one itself with
gh pr edit, or hands you that command.bashgh pr create --base main --title 'fix(upload): retry on 503' --body-file "$(git rev-parse --absolute-git-dir)/PR_BODY.md"
- Branch:
<type>/<slug>, the type the commit will take (commit-typesskill), or<type>/<number>-<slug>for an issue.git checkout -btakes the uncommitted changes along, so the agent hands it as soon as it knows what the work is, and you can run it at any point before the commit. - Title: a Conventional Commit header covering the whole branch. A title GitHub cut at 72 characters (it ends in
…) is put back whole. - Description: the repository's or the account's pull request template when there is one, its sections filled in place, with its comments and a
pr-descriptionblock left as they are; otherwise the template of themattpocock-skillsprskill when it is installed, or a summary and the evidence (checks run). Then oneFixes #<number>line per issue the branch closes, and no AI attribution. The agent writes it toPR_BODY.mdin the git directory (git rev-parse --absolute-git-dir): out of the working tree, never committed, one per worktree. - Base: the open pull request's, the one you name, or the branch the work was cut from among the default branch and
dev/develop.
/pr
| Invocation | Effect |
|---|---|
/pr | Hands the first missing step (branch, commit, push), then the PR step |
/pr dev | The same, with dev as the base of a new pull request |
The pull request step syncs an open pull request, or hands the gh pr create command when there is none.
An open pull request already in step with the branch is left alone: the agent gives its URL. When it does not match, the agent keeps what you added by hand (screenshots, links, notes) and rewrites the rest.
A pull request that conflicts with its base runs no check until it is rebased. You start the rebase (git rebase origin/main), which stops at the conflicts before making a commit; the agent resolves them and runs the checks; you finish with the two commands it hands you:
git add AGENTS.md README.md && GIT_EDITOR=true git rebase --continuegit push --force-with-leaseAutomatic nudges
In Claude Code, three hooks (see Claude Code) keep the sequence going without a command:
- a session that opens on a shared branch is told to hand you the branch command before the first commit (
skill-context.sh); - a
git commitorgit pushyou run from the chat that goes through gets its next step (skill-router.sh): the branch command when the commit landed on a shared branch, otherwise the push, then the pull request sync. A failed one, or another command that only names them (git stash push), gets none; - the end of each turn shows what is left (
next-steps.sh):Branch firston a shared branch with changes or unpushed commits (never a push there, unless the remote has no branch yet), the push command with-uon a branch's first push, andPull request: /pronce everything is committed and pushed.
Guardrails
git commit and git push are denied to agents in every tool (see Claude Code). gh pr edit has no allow rule: whether the agent runs it at once depends on the session's permission mode, and when it cannot, it hands you the same command. gh pr merge always asks.