The workflow Claude Code’s docs recommend
- Exploreplan mode: read, ask questions, no edits
- Plana written plan you can edit
- Implementcode, then run the check
- Verifytests, build, screenshot pass?
- Commit + PRhuman reviews the evidence
check fails → Claude reads the output and fixes it
Verification is the multiplier
Claude Code’s best-practices guide opens with one constraint and one lever. The constraint: the context window fills fast, and performance degrades as it fills. The lever: give Claude a way to verify its work. Claude stops when the work looks done. Without a check it can run, “looks done” is its only signal, and a developer becomes the verification loop, catching every mistake by hand. With a test suite, a build exit code, a linter, or a screenshot to compare, Claude does the work, runs the check, reads the result and iterates until it passes.
The guide lays out how hard that check can gate the finish. A prompt can ask Claude to run the check and iterate. A /goal condition has a separate evaluator re-check after every turn. A Stop hook runs your check as a script and blocks the turn from ending until it passes. A verification subagent has a fresh model try to refute the result. The further along that list, the more a run can finish correctly without anyone watching. It also asks Claude to show evidence — test output, the command and its result — because reviewing evidence is faster than re-running it.
The same request, with and without a check
No way to verify
fix the login bugSymptom, location, check
users report login fails after
session timeout. check the auth
flow in src/auth/, especially
token refresh. write a failing
test that reproduces it, then
fix it. run the auth tests and
show me the output.Match the mode of work to the task
Anthropic’s write-up of how its own teams use Claude Code shows three distinct modes. Product engineers treat Claude as the first stop for any task, asking it which files matter before they build: that is synchronous pairing. The security team moved from “design, janky code, refactor, give up on tests” to test-driven development with Claude, and reports diagnosing production issues about three times faster. Designers and others set up autonomous loops with periodic human checkpoints, and the post names that pattern among the fastest. A fourth mode, running Claude in CI without anyone at a terminal, is covered below.
Choosing how Claude works on a task
- Unclear approach, many filesPlan mode firstexplore, plan, then build
- Small, one-sentence diffDo it directlyskip the plan
- Clear goal, runnable checkAutonomous loopcheckpoints + evidence
- Repeats on every PR or issueCI automationGitHub Actions,
claude -p
| Stage of work | AI-assisted practice | Claude Code support |
|---|---|---|
| Onboarding to a codebase | Ask the questions you’d ask a senior engineer | Codebase Q&A; a concise CLAUDE.md |
| Specifying a feature | Have Claude interview you, then write a spec | AskUserQuestion; a fresh session to build it |
| Implementing | Explore → plan → implement → verify | Plan mode, tests, /goal, Stop hooks |
| Reviewing | A fresh context reviews the diff | Writer/reviewer sessions, /code-review, review subagent |
| Large migrations | Fan the work out, test on a few first | /batch, or a loop over claude -p with --allowedTools |
| Repeated team chores | Run on events, not by hand | GitHub Actions, scheduled workflows |
Turn repetition into tooling
Most workflow gains come from noticing what a team does repeatedly and moving it out of ad-hoc prompts. Claude Code’s features guide gives the triggers. If Claude gets a convention wrong twice, add it to CLAUDE.md. If you keep typing the same prompt, save it as a skill. If you paste the same playbook a third time, capture that as a skill too. If something must happen every time without asking, write a hook. If a second repository needs the same setup, package it as a plugin (distribution is covered in 7.1).
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
}
]
}
]
}
}Hooks are the right home for anything that must happen every time, because they run deterministically rather than depending on Claude choosing to follow an instruction. A hook that exits with code 2 blocks the action, and for some events its message goes back to Claude so it can adjust. Hooks cost no context unless they return output. The trade-off runs the other way for judgement: a hook can’t decide how to apply a playbook, but a skill can.
Bring Claude into the pipeline
Some improvements belong in CI rather than on a laptop. The Claude Code GitHub Action runs in two modes. In interactive mode, with no prompt input, it waits for someone to mention @claude in an issue or pull request and replies there. In automation mode, with a prompt, it runs on any GitHub event, including a schedule. Quick setup is /install-github-app from inside Claude Code. Runs start only for users with write access, and bots are rejected unless you list them, which keeps bots from triggering Claude in a loop.
name: Nightly audit
on:
schedule:
- cron: "0 2 * * *"
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 20 # workflow-level cap on runaway jobs
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} # never committed
prompt: "Summarise outdated or vulnerable dependencies and their risk."
claude_args: |
--max-turns 10
--allowedTools "Read,Grep,Bash(npm outdated *),Bash(npm audit *)"The docs name the cost levers for CI: each run spends GitHub Actions minutes and API tokens. Write specific requests so fewer turns are needed, keep CLAUDE.md concise because it is read on every run, set --max-turns, set workflow timeouts, and use concurrency controls to limit parallel runs. Grant the workflow only the permissions it needs, and have a human review Claude’s changes before merging. For large one-off migrations, the best-practices guide suggests having Claude list the files, then looping claude -p over them with --allowedTools restricting what each run can do, refining the prompt on the first two or three files before running the rest.
Traps the wrong answers are built from
| Tempting but wrong | Do this instead |
|---|---|
| Letting Claude finish when the code “looks done”, with no check it can run | Give every task a test, build, lint or screenshot check, and ask for the evidence. |
| Typing the same long prompt or playbook repeatedly | Capture it as a skill; make always-run steps hooks; share across repos as a plugin. |
| Planning every change, including one-line fixes | Plan when the approach is unclear or the change spans files; do small, clear fixes directly. |
| Running Claude in CI with broad permissions and no limits | Scope --allowedTools, set --max-turns and timeouts, store keys as secrets, keep human merge review. |
| Judging adoption by lines of code generated | Track cycle time, review load, first-pass CI rate and defects alongside usage analytics. |
You should now be able to
- Design an explore–plan–implement–verify workflow with a check Claude can run.
- Choose between direct execution, plan mode, autonomous loops and CI automation for a task.
- Convert repeated prompts and rules into CLAUDE.md entries, skills, hooks or plugins.
- Configure the Claude Code GitHub Action safely, with scoped tools, turn limits and secrets.
- Structure a large migration as a piloted, permission-scoped fan-out with per-unit checks.
- Select outcome metrics that show whether AI-assisted workflows actually improved delivery.