Reviewing and testing code
Agent output is draft until you say otherwise — same as code from a fast teammate. This lesson covers two jobs every developer needs with 4RGE:
- Review what the agent wrote — skim diffs, catch scope creep, reject bad shortcuts.
- Test with intent — name behaviors and commands so "done" is provable, not persuasive.
You can also ask the agent to review your diff as a second pair of eyes. None of that replaces your merge decision or your team's bar.
What this page is for
Day-to-day review habits — Working with agents. After a fix — Finding and fixing bugs. Prompt templates — Prompting.
Who this page is for
Two jobs: review and test
Review catches wrong scope and risky edits. Tests catch wrong behavior. You need both — polished chat text is not proof — Hallucination & limitations.
Agents don't replace your review
4RGE is built for reviewable diffs and approvals — not silent merges.
Polished summaries can hide wrong assumptions — Hallucination & limitations.
Treat the agent like a fast reviewer or test author — not an autopilot. Your CI and team standards still apply — Agent security.
Review the diff
Review as changes land, not only at the end.
Same habits as reviewing a human PR — the agent is just faster at producing the first draft.
Ask for a second pass
After you have a diff (agent-written or your own), ask for a focused review — not "is this good?"
Attach the diff or @ the changed files. Ask for findings ranked by severity, not a rewrite
unless you want one.
For PR comment follow-ups, give a numbered list and file scope — see Prompting (code review follow-up pattern).
Example review prompts
Copy and adapt — attach changed files with @ when you can:
Review the diff in @apps/web/src/app/api/checkout/ for:
- auth bypass or missing checks
- injection or unsafe defaults
- error responses that leak internal details
Return findings ranked by severity. Do not rewrite code unless I ask.List edge cases this PR does not handle: empty input, null, concurrent requests, invalid IDs.
Point at the file/line for each gap.Address PR #412 review comments only:
1. Use retry helper in lib/http.ts (not inline loops)
2. Add error boundary around ChartPanel
Do not scope outside files already in the branch.Write and run tests
"Add tests" is too vague. Name behaviors the agent should cover.
If the repo already has patterns (table-driven cases, factory helpers), point at an example file
with @.
Example test prompts
Add table-driven cases in checkout.test.ts:
- empty cart → 400 empty_cart
- valid discount code → lower total
- invalid code → inline error, no crash
- total never below zero
Run: pnpm test apps/web -- checkout
Fix failures without changing the public API.Make auth.test.ts pass. JWT refresh must invalidate the old token.
Do not skip or delete existing tests to green the run.The verify command in the prompt is what makes "done" objective — for you and the agent.
Before you merge
Use the same checklist you would for any PR:
The agent can run checks you specify; it does not replace your judgment on merge.
What good review looks like
Catching scope creep on diff three is cheaper than reverting twenty files at the end — Working with agents.
Review cloud and PR output
When work finishes in the cloud or on a branch you did not watch live:
You still merge when satisfied — cloud extends reach; it does not bypass your bar.
Habits that work
- Review each diff before accept — catch scope creep early.
- Ask for ranked findings — security and edge cases on the actual change.
- Name behaviors and test files — table-driven when it fits your repo.
- One verify command in every feature or fix brief — Developing features.
- Reject skipped or deleted tests — same as a human contributor.
- Use rules for team conventions — Customizing agents.