Claude auto PR review
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executedJust shippedOur pick for the best security, implementation, and planning skills.Best skills for each job.See the picks →
Label an issue agent:spec and Claude drafts a spec file for it and opens it as a draft pull request for review.
issues: labeled == agent:spec (+ workflow_dispatch)
How it works
Setup
.github/workflows/foam-spec.ymlCLAUDE_CODE_OAUTH_TOKEN. The file reads it as secrets.NAME. Do not paste the key into the YAML.gh with github.token use the token Actions already provides. You do not create that secret.Let your agent do it
Paste it into your coding agent in this repo. It does the setup and asks before anything leaves your machine.
Runs the same job in your agent session, on the plan you are signed in with. No API key, no Action.
Do the job of the "Foam: Claude drafts a spec from an issue" workflow from AgentFlows (https://agentflows.sh/flows/foam-spec) right here, in this session, using the plan I'm signed in with. No API key and no GitHub Action. Install these agent skills first. Download each SKILL.md from its source (respect its license) into .claude/skills/<name>/SKILL.md, or wherever this agent loads skills from: - Spec-driven development: write the spec before code: https://github.com/addyosmani/agent-skills/tree/main/skills/spec-driven-development (MIT), notes at https://agentflows.sh/skills/addyosmani-spec-driven-development What it does: Label an issue agent:spec and Claude drafts a spec file for it and opens it as a draft pull request for review. The workflow normally runs on: issues: labeled == agent:spec (+ workflow_dispatch). Instead, ask me which pull request, issue, or branch to work on, then follow these instructions: ```text Label an issue agent:spec and Claude drafts a spec file for it and opens it as a draft pull request for review. ``` Use the gh CLI for anything on GitHub, and show me what you plan to post or change before you do it.
The file
Copy the file as-is. The notes beside each block explain it.
.github/workflows/foam-spec.yml
Name
The name GitHub shows in the Actions tab. The file path is under Where to paste this.
name: Spec# Label an issue `agent:spec` and Claude drafts specs/<slug>/spec.md, opening# it as a draft PR. See specs/README.md for the flow, .claude/skills/write-spec# for what it writes.Trigger
GitHub starts a run when an issue is given a label, or you run it by hand.
on: issues: types: [labeled] workflow_dispatch: inputs: issue: description: Issue number to write a spec for required: true type: stringJobs
Each job is one runner. The steps inside it run top to bottom.
jobs: spec: if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'agent:spec' runs-on: ubuntu-latest timeout-minutes: 20Permissions
This token may push commits, comment on pull requests and open them, comment on issues and change labels, and request a GitHub OIDC token. Anything not listed is not granted.
permissions: contents: write pull-requests: write issues: write id-token: writeSteps
These steps run in order on that job.
steps: - uses: actions/checkout@v6 with: fetch-depth: 0 # Never interpolate the raw input into the prompt: workflow_dispatch # takes free text. Everything downstream uses this validated number. - name: Resolve issue number id: resolve env: RAW: ${{ github.event.issue.number || inputs.issue }} run: | case "$RAW" in '' | *[!0-9]*) echo "Not an issue number: $RAW" >&2 exit 1 ;; esac echo "issue=$RAW" >> "$GITHUB_OUTPUT" - name: Set commit identity run: | git config user.name "claude[bot]" git config user.email "claude[bot]@users.noreply.github.com"Agent
Runs Claude Code with anthropics/claude-code-action@v1. Inputs: claude_code_oauth_token; prompt (the task); claude_args (Claude Code flags, including allowed tools).
- uses: anthropics/claude-code-action@v1 env: GH_TOKEN: ${{ github.token }} with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} prompt: /write-spec ${{ steps.resolve.outputs.issue }} claude_args: | --model claude-opus-5 --allowedTools "Bash(gh:*),Bash(git:*),Read,Write,Edit,Glob,Grep" --max-turns 40Keep going
Copied from the official Solutions Guide basic example (prompt shortened).
pull_request: opened, synchronize
Est. cost per run~$0.18Checked Oct 16, 2026
Not executed`track_progress: true` posts a checkbox tracking comment (per Solutions Guide).
pull_request: opened, synchronize, ready_for_review, reopened
Est. cost per run~$0.22Checked Oct 16, 2026
Not executedNo `prompt` → the action runs in tag/interactive mode and responds to the comment. `trigger_phrase` default is `@claude` (usage.md).
issue_comment / pull_request_review_comment containing @claude
Est. cost per run~$0.27Checked Oct 16, 2026
Not executed· 1 caveat