Improving a developer workflow with an agent is four decisions: how much to plan before Claude edits, what check lets the loop close without a human, where independent review and CI automation sit, and how you will know any of it helped. The Claude Code best-practices guide builds most of its advice on one constraint: the context window fills quickly and quality degrades as it fills. That is the lens for the trade-offs below.
Plan mode versus direct execution
Plan mode makes Claude research and propose without editing your source: it reads files, runs exploratory commands and writes a plan, and edits stay blocked until you approve. Enter it with Shift+Tab, claude --permission-mode plan, or a /plan prefix on one prompt. Approving the plan leaves plan mode so Claude starts editing. The built-in Explore and Plan subagents are read-only and keep their reading in a separate context window, so discovery output does not crowd the session (Explore also skips your CLAUDE.md files).
The decision criterion is ambiguity and blast radius, not difficulty. Plan when the approach is uncertain, the change spans several files, or the code is unfamiliar. Skip planning when you could describe the diff in one sentence: a typo, a log line, a rename, or a hard bug whose stack trace already names one function. A useful hybrid for larger features is to have Claude interview you, write a spec to a file, then start a fresh session to implement it, so the implementation runs on clean context. The cost of planning is time and tokens; the cost of skipping it is solving the wrong problem across many files.
Plan mode is a workflow, not a security boundary
In plan mode Claude is instructed not to edit, and edits are blocked pending approval, but the permissions docs note that in interactive terminal sessions where bypass permissions is available Claude Code does not enforce those blocks. If read-only behaviour must be guaranteed, use permission rules or the dontAsk mode, not plan mode alone.
Iterative refinement: close the loop, then pick the technique
Give Claude a check it can run: tests, a build exit code, a linter, a script that diffs output against a fixture, or a screenshot comparison. Without one, “looks done” is the only signal and you become the verification loop. The strength of the gate is a design choice: ask in the prompt, set a session-long /goal condition, run the check from a Stop hook that blocks the turn from ending until it passes, or use a separate verifier so the agent doing the work is not the one grading it. Ask for evidence (test output, the command and its result) rather than an assertion.
Then match the technique to the failure mode:
- Claude reads a prose description differently each run: give two or three concrete before/after examples, including one edge case.
- A transformation with many edge cases: write the tests first and feed back the failures.
- Unfamiliar domain: have Claude interview you before it builds.
- Feedback items that interact (error shape, logging, client types): send them together. Independent issues: send them one at a time.
Manage context actively. After two failed corrections on the same issue, /clear and restart with a sharper prompt instead of stacking corrections on a polluted context; use /rewind to undo; send investigations to subagents.
Code review and CI: choose the layer, then harden it
- Local
/code-reviewreviews your branch diff in a background subagent with its own context before you push;--fixapplies findings and--commentposts them to a PR. - Managed Code Review (a research-preview feature for Team and Enterprise plans, not available with Zero Data Retention) reviews pull requests on Anthropic infrastructure (when opened, on each push or on request, per repository setting) and posts severity-tagged inline comments. It does not approve or block; its check run always completes neutral, so gate merges by parsing its output in your own CI.
REVIEW.mdtunes severity, nit caps and skip rules. It is billed by tokens, and reviewing on every push multiplies cost. - The GitHub Action (
anthropics/claude-code-action@v1) runs in your workflow. With nopromptinput it answers@claudementions; with apromptit runs in automation mode on any event. You control triggers, model and tools throughclaude_args, and keep credentials in repository secrets. - Your own pipeline (GitLab or anything else) calls
claude -p.
For a scripted claude -p gate: pass -p so the run is non-interactive; use --output-format json with --json-schema and read the structured_output field; scope permissions with --allowedTools or --permission-mode dontAsk; cap work with --max-turns; and branch on the exit code. --bare skips hooks, MCP servers, plugins and CLAUDE.md for reproducible runs (you then pass context with flags such as --append-system-prompt-file). Without it, a -p run executes the hooks in the project's .claude/settings.json and connects its .mcp.json servers even in a folder you never trusted, which matters when a pipeline checks out an untrusted branch.
Review only helps if it is independent. A reviewer in a fresh context sees the diff and your criteria, not the reasoning that produced the change; telling it to flag only correctness or stated-requirement gaps stops it inventing findings to please you. For repeat runs, pass prior findings and ask for new or still-open issues only, so developers are not shown the same comments on every push.
Measuring productivity honestly
The Teams and Enterprise analytics dashboard reports adoption (daily users, sessions), lines of code accepted, suggestion accept rate and, once GitHub is connected, PRs with Claude Code and PRs per user. Anthropic's own notes describe these as deliberately conservative: attribution matches merged-PR lines against session activity in a window from 21 days before to 2 days after the merge, ignores generated files, and does not credit code a developer substantially rewrote. Accepted lines do not track later deletion. Per-invocation cost figures (total_cost_usd in JSON output, the claude_code.cost.usage metric) are client-side estimates that can differ from the bill.
Treat those as activity and adoption signals. Judge value with outcome metrics you already trust (lead time, review turnaround, change failure rate and other DORA measures), compared against a baseline captured before rollout or against a comparable team. Track the cost side too: reviewer time, rework, escaped defects, token spend. Be wary of leaderboards, which reward volume; and report ranges and caveats rather than a single ROI number.
Common exam distractor
“Lines accepted rose 40%, so productivity rose 40%” is the wrong inference. Accepted lines and PR counts measure activity, not delivered value, and the attribution is an estimate. The defensible answer pairs adoption metrics with outcome and quality metrics against a baseline, and states the limits.