Up to 59% offLaunch prices on every plan while spots last.See pricing
KANBANMCP
Sign inStart free

Claude Code Spec Workflow on GitHub: Specs, Branches, PRs

9 min read

Key takeaways

  • A claude code spec workflow on GitHub keeps specs as versioned markdown in the repo, with one branch per spec and every session ending in a pull request.
  • Four files carry the workflow: a specs directory with numbered files, a spec template, a CLAUDE.md contract, and a PR template with a handoff field.
  • Executable specs need scope, testable acceptance criteria, files in scope, an out-of-scope list, and a handoff note; vague criteria produce confident diffs that fail review.
  • Run parallel sessions safely with one worktree per session, one spec per session, and a CLAIMED-BY line or board so two agents never claim the same spec.
  • The first failure mode is spec drift: require every PR that changes behaviour to touch its spec file in the same diff.

A claude code spec workflow on GitHub means specs live as versioned markdown files in your repo, each spec gets its own branch, and every agent session ends in a pull request you review. This guide gives you a copy-ready repo layout and a way to run three or more parallel sessions off the same spec board without losing track of who did what.

What is a Claude Code spec workflow on GitHub?

A Claude Code spec workflow on GitHub means four things: specs live as markdown files in your repo, Claude Code reads the relevant spec before writing code, work happens on a branch named after that spec, and the pull request is where you review what the agent actually did.

The specs directory becomes your system of record. Each file describes one piece of work: what to build, constraints, and how to verify it. Claude Code picks up project conventions from your CLAUDE.md memory file, and the spec file gives it the task-specific context that a shared CLAUDE.md can't carry.

Because the spec is versioned in git, every change to requirements has a diff. Because the branch is named after the spec, you can run three or more agent sessions in parallel and tell at a glance which card each worktree belongs to. When sessions hand off mid-task, a board like KanbanMCP keeps the claim-and-note cycle on top of the same repo.

What does the repo structure look like?

Four files carry the whole workflow. Everything else stays in your head or in git history.

repo/
├── specs/
│   ├── 001-auth-rework.md
│   ├── 002-rate-limiting.md
│   └── templates/
│       └── spec-template.md
├── CLAUDE.md
└── .github/
    └── PULL_REQUEST_TEMPLATE.md

The spec file template

specs/templates/spec-template.md is the skeleton every new spec copies: a one-line goal, the context the agent needs, acceptance criteria as a checklist, and an explicit out-of-scope list. Numbered filenames (001-, 002-) give you stable IDs to reference in branches and commits. Each spec lives on its own branch, so git branch --list doubles as your board, and the branch name spec/002-rate-limiting ties the file, the worktree and the pull request together. When a spec changes mid-flight, the diff shows up in review like any other code change.

The CLAUDE.md snippet

CLAUDE.md tells every session the same rules regardless of tool: read specs/ before writing code, claim one spec at a time by checking the branch list, never touch another spec's files, and leave a handoff note at the top of the spec file when a session ends. This is the part that makes parallel sessions safe: three agents in three worktrees all inherit the same contract, and a session that dies mid-task leaves enough state for the next one to pick up the card. If you want a hosted board on top of this, KanbanMCP's Claude Code setup maps cards to the same spec files.

The PR template

.github/PULL_REQUEST_TEMPLATE.md asks three questions: which spec this closes, what changed, and what the next session needs to know. That last field is where the handoff note lands for human review, so your morning git diff tells you not just what the agents did but why.

How do you write a spec an agent can actually execute?

An executable spec has five parts: scope, acceptance criteria, files in scope, out of scope, and a handoff note. Anything else is documentation for documentation's sake.

Write acceptance criteria as testable statements: "pytest tests/test_auth.py passes", "the endpoint returns 422 on a malformed payload". An agent can run those; "make auth robust" it cannot. Keep scope to one PR's worth of work. If the spec needs two days of agent time, split it.

Files-in-scope matters most when you run three or more parallel sessions. If two specs both touch src/auth/, one worktree will clobber the other's diff. List the directories each spec owns so you can spot collisions before you launch, not after. Anthropic's docs on common Claude Code workflows cover running parallel sessions from separate worktrees against the same repo.

The handoff note is the section builders forget. When a session ends mid-task, the agent writes what it did, what failed, and what the next session should pick up first. That note lives on the card, not in chat, because chat is disposable and a project that only exists across chats is hard to recover a week later.

One honest limitation of our own setup at KanbanMCP: a spec is still only as good as your acceptance criteria. Vague criteria produce confident-looking diffs that fail review, whatever board you use.

How do you turn a spec into a branch and pull request?

Start from the spec slug. For specs/004-rate-limiting.md, create git checkout -b spec-004-rate-limiting and a matching worktree if you want the session isolated from your main checkout. The slug is the thread that ties spec, branch, and PR together.

Point Claude Code at the spec file in the first prompt: "Read specs/004-rate-limiting.md, implement it, and stop when the acceptance criteria pass." The spec file is the only brief the session needs; anything durable about conventions already lives in your CLAUDE.md. If you run Claude through a desktop client instead of the terminal, the same flow applies per the notes at https://kanbanmcp.com/agents/claude-desktop.

Require the PR to link the spec. Your PR template should open with a Spec: specs/004-rate-limiting.md line and carry the acceptance criteria as a checklist the agent ticks with evidence: which test command ran, what the output showed. Review becomes a diff against a written promise, not a vibe check.

When the checklist is green, merge and delete the branch. The spec file stays in specs/ as the record of what shipped, so any future session can read the history without excavating old chat logs.

How do you run three or more agent sessions against the same spec set?

Worktrees and spec ownership

Give every session its own worktree and its own spec. One branch per spec file in specs/, one worktree per branch, one agent per worktree. That way three parallel sessions never edit the same files, and each git diff in the morning maps cleanly to one spec.

The rule that keeps this sane: a spec is owned by exactly one session at a time. If two agents pick up specs/auth-oauth.md, you get two PRs solving the same problem. Add a line to your CLAUDE.md telling each session to check whether its spec is already claimed before starting, and to stop at the PR if it is.

Handoff notes between sessions

Parallel work eventually collides: session A refactors a helper that session B is mid-way through extending. The fix is a claim-and-handoff convention. Each agent leaves a short note in the spec file or PR description: what it finished, what it broke, what the next session needs to know before touching that area. GitHub's pull request templates give you a repeatable place for this (PR templates), so the note survives even when the chat session is long gone.

Plain files work fine up to a point. The failure mode is a stale note: a card says "in progress" but the session died two days ago, and nobody knows. A board built for this, like KanbanMCP, makes claiming explicit — an agent takes a card, does the work, and leaves the handoff note on the card itself, so you steer from one place instead of grepping spec files. Vibe Kanban takes a similar board-first approach.

If you would rather not add a tool, a minimal convention still beats nothing: a CLAIMED-BY: line at the top of each spec file, updated by the agent at session start and end.

How does this compare with backlog.md, Taskmaster and Vibe Kanban?

The spec-in-repo approach and a coordination tool solve different halves of the problem. Specs, CLAUDE.md and a PR template give each session its instructions; the tool decides which session touches what. Most solo devs start with the first half only: backlog.md files or handover prompts pasted between chats. That works until three parallel sessions claim the same card and you find out from a conflicting git diff in the morning.

Spec files in repobacklog.md / home-made boardsTaskmasterVibe KanbanKanbanMCP
Specs versioned with codeYesYesYesNoNo
Agents claim cards, leave handoff notesNoPartiallyNoYesYes
Works across Claude Code, Cursor, CodexYesYesYesYesYes
You steer from the same boardNoPartiallyNoYesYes

Taskmaster turns a PRD into ordered tasks but stays single-pipeline; it pairs well with worktrees (Git docs) rather than replacing a board. KanbanMCP is the same trade as Vibe Kanban: coordination lives outside the repo, so your specs stay versioned but card state does not. If that bothers you, keep card IDs in the spec filenames.

What breaks first, and how do you fix it?

Specs drift from code first. A spec merged six weeks ago no longer matches the branch it describes, and agents execute against the stale version. Fix: require every PR to touch its spec file if behaviour changed, and re-read the spec at session start rather than trusting the card title.

Second, agents skip the spec entirely and work from the card text alone. Fix: point CLAUDE.md at specs/ as the first read, and reject PRs whose diff references no spec.

Third, handoff notes go stale. An agent leaves a note saying "tests pass", the next session rebases and they do not. Fix: date every note and treat anything older than the last merge as suspect; rerun tests before continuing.

Fourth, parallel sessions edit the same files and produce conflicting diffs. Fix: assign file ownership per lane in the spec, one worktree per session, and rebase onto main before opening the PR. If two specs keep colliding, they belong in one spec.

FAQ

Do I need GitHub at all, or can I keep specs in a local folder?

No, any git host works; the workflow only needs versioned markdown, branches, and a review step. A local folder works if you commit to it, but you lose pull requests, which is where you review the agent's diff against the acceptance criteria. Without that, review becomes reading terminal diffs with no checklist attached.

Can Cursor or Codex sessions follow the same spec workflow with Claude Code?

Yes. The workflow is tool-agnostic: a spec file, a branch naming convention, and a CLAUDE.md contract. Any agent that can read a file and open a PR can participate. That matters for parallel sessions, where you might run Claude Code in one worktree and Codex in another, both claiming different specs and leaving handoff notes in the same format.

Should specs live in the main repo or a separate docs repo?

Main repo. The spec needs to travel with the code it describes: branches reference it, PRs link it, and a PR that changes behaviour should touch its spec in the same diff. A separate docs repo breaks that thread, so specs drift from code and agents execute against stale requirements. Keep one repo and one specs directory.

How do I stop two agents working on the same spec at once?

Assign ownership explicitly. Add a rule to CLAUDE.md telling each session to check whether its spec is already claimed before starting, and to stop at the PR if it is. For a minimal setup, keep a CLAIMED-BY: line at the top of each spec file that the agent updates at session start and end. A board makes claiming explicit instead.