StepGleam logoStepGleam
Coding guide

Ship a feature with a coding agent: spec, tests first, then review the diff

The loop experienced developers describe on r/ExperiencedDevs: write the spec, plan the smallest steps, have tests written from the spec, implement, then review against the spec before anything merges.

~60 minIntermediate 78/100 6 steps Updated Oct 26, 2026
Claude CodeCodex CLICursorGitHubGit
Ship a feature with a coding agent: spec, tests first, then review the diff — illustration for this Coding guide

Tools used

  • Claude CodeCoding agent that reads, edits and tests the repo
  • Codex CLITerminal agent with /plan and /review
  • CursorEditor agent with Plan Mode
  • GitHubPull requests and CI
  • GitCheckpoints and small commits
Step navigator0/6 done
0 of 6 steps done
What you'll get

A merged feature with a written spec, a saved implementation plan, tests that came from the spec, and a diff you reviewed yourself.

Who this is for

Working developers using Claude Code, Codex or Cursor on a real codebase who want fewer "it compiles but it's not what we meant" merges.

Read this first

Before you start

In a thread about heavy agentic engineering, one developer who leads an AI platform team said "Half the effort is in writing the spec. The other half is in ensuring the agent follows the spec." This guide follows that loop, plus a ticket-driven version from another thread, using any of Claude Code, Codex or Cursor.

Step-by-step instructions

Step 1 of 6 · Coding

Write a ticket with background and acceptance criteria

Before opening the agent, write the ticket: background, business value, acceptance criteria and links to relevant docs. One commenter describes exactly this as step 1 of their team's workflow (they use Linear). OpenAI's Codex guidance boils it down to four parts: Goal, Context, Constraints and Done when.

Where this comes from: u/metaphorm in r/ExperiencedDevs: "Claude Autonomous Coding: Discussion".

Ship a feature with a coding agent: spec, tests first, then review the diff — guide thumbnail
Why this works

The agent can only check its work against criteria that are written down.

Step 2 of 6 · Coding

Discuss the design with the agent and save the plan

Feed the ticket to the agent in plan mode and talk through whatever is still ambiguous. Claude Code: Shift+Tab to plan mode. Codex: /plan. Cursor: Shift+Tab to Plan Mode. Get an implementation plan, then save it with the ticket. The commenter says "future agent sessions will see the implementation plan and immediately have much more context".

Where this comes from: u/metaphorm in r/ExperiencedDevs: "Claude Autonomous Coding: Discussion".

Copy-ready promptClaude Code
Here is the ticket: <paste>. Ask me about anything ambiguous, then write an implementation plan broken into the smallest steps that can each be tested.
Why this works

A saved plan anchors later sessions and makes debugging easier.

Step 3 of 6 · Coding

Have tests written from the spec before the implementation

Ask for tests that encode the acceptance criteria first, and confirm they fail. One developer runs this as separate steps: a subagent writes tests from the spec, then an implementation agent writes the code, then a review agent checks spec adherence. Anthropic's docs make the same point: give the agent "a check it can run" so it can iterate until it passes.

Where this comes from: u/nachoaverageplayer in r/ExperiencedDevs: "For folks heavily using agentic engineering, what does your workflow look like?".

Copy-ready promptClaude Code
Write tests for the acceptance criteria in the plan. Don't implement the feature yet. Run them and show me that they fail for the right reason.
Why this works

Tests written before the code can't quietly be bent to match whatever the code ended up doing.

Step 4 of 6 · Coding

Implement against the plan and the tests

Now let the agent implement, run the suite and fix failures. Watch the diff as it works. Cursor's docs suggest clicking Stop and redirecting as soon as it heads the wrong way rather than waiting until it finishes. If it drifts badly, revert, tighten the plan and rerun. That is usually faster than patching.

Where this comes from: u/nachoaverageplayer in r/ExperiencedDevs: "For folks heavily using agentic engineering, what does your workflow look like?".

Why this works

Early correction is cheap; untangling a finished wrong implementation is not.

Step 5 of 6 · Coding

Open the PR and run review bots, CI and your own QA together

Push a PR. Let review bots do a first pass (the commenter's team uses CodeRabbit; GitHub Copilot code review works the same way via Reviewers → Copilot → Request). At the same time, manually QA the change in your local environment while CI runs unit and integration tests. Feed review comments and QA findings back to the agent until the change is acceptable.

Where this comes from: u/metaphorm in r/ExperiencedDevs: "Claude Autonomous Coding: Discussion".

Why this works

Bots catch obvious issues quickly, but only your QA tells you whether it behaves as intended.

Step 6 of 6 · Coding

Review the diff yourself before merging

Final review gets human eyes. One developer has the agent wait for them to review the diff in their IDE, where they "inevitably make changes and fix things", and recommends manual reviews "early and often" because catching a spec mistake early is much cheaper. Merge only after that.

Where this comes from: u/nachoaverageplayer in r/ExperiencedDevs: "For folks heavily using agentic engineering, what does your workflow look like?".

Why this works

Most AI slop comes from letting the agent run unchecked, according to the same commenter.

End of guide · Reviewed Oct 26, 2026

Pro tips3
  • If you could describe the diff in one sentence, skip plan mode. Anthropic says planning adds overhead for small, clear changes.
  • After two failed corrections in one session, clear the context and restart with a better prompt.
  • Ask for evidence: the test command and its output, not "done".
Common mistakes3
  • Letting the agent change the acceptance criteria as it goes.
  • Reviewing only the final diff of a long session instead of checking in early.
  • Treating passing tests as proof that the feature matches the ticket.
FAQ3
Which agent should I use?
The thread participants used Claude Code mainly, but the loop is tool-agnostic. Plan mode exists in Claude Code, Codex and Cursor.
Do I need subagents?
No. Separate sessions work too. Anthropic's docs note that a fresh context improves review because it isn't biased toward code it just wrote.
What if the team has no ticket system?
Write the spec as a markdown file in the repo and reference it in every prompt.
Sources7