sina_codes
فا
docs/
Outline

---

title: Review code like a tech lead

slug: review-setup

lang: en

published: 2026-11-22

words: 431

lines: 38

size: 2.6 KB

read: 3 min read

reel: Review code like a tech lead

---

Review code like a tech lead

Review code like a tech lead

A useful review starts with a written description of the expected behavior. Give the same spec to the agent building the change and the agent reviewing it. Then run the scenarios in the spec against the version deployed in dev. This is episode 3 of Production Ready.

1. Write a spec the reviewer can test

Write down what the user should see, where the change belongs, which existing behavior the feature depends on, and what happens if a request is repeated or a dependency fails. Give each acceptance criterion an ID. The reviewer should be able to point to the criterion, the implementation, and the test that proves it.

2. Give implementation and review to separate agents

Implementation agent. Build to the spec and report the files changed, the checks run, and any decision the spec leaves open.

Review agent. Read the spec and the diff first. Check each criterion against code and test evidence. Apply the rules for that stack. For Python, that can include Ruff, mypy, test coverage for the changed paths, and keeping persistence and business logic in their proper layers. When behavior differs from the spec, report the criterion, the code location, and a specific scenario that shows the difference.

3. Split the test scenarios in dev

Give each runner a separate dev account or scoped dev credential and a distinct scenario. Run through the same entry points the application uses. Record the commit, the inputs, the expected result, and the observed result. Treat skipped or untested criteria as open items. Fix mismatches and rerun the affected scenarios before approval.

A sample spec you can copy

This example uses a fictional bookmark feature. Use the same format for your own change.

output
Feature: Save an article
Entry point: PUT /bookmarks/{article_id}
Rules: Store one bookmark per (account_id, article_id).
       Use the signed-in account from the request.
A1  First save of an existing article returns 204 and creates one row.
A2  Repeating the save, including two concurrent requests, returns 204
    and leaves exactly one row for that account and article.
A3  A missing article returns 404 and creates no row.
A4  A signed-out request returns 401 and creates no row.
A5  Two accounts can save the same article independently.
A6  A failed database write returns an error and leaves no new bookmark.

Checks: Link the tests for A1 through A6 and the lint and type check results.
Dev evidence: Criterion, commit, test account, expected result, actual result.

For the project rules and planning step that come before review, see Use AI like a tech lead.

A useful review starts with a written description of the expected behavior. Give the same spec to the agent building the change and the agent reviewing it. Then run the scenarios in the spec against the version deployed in dev. This is episode 3 of Production Ready.
## 1. Write a spec the reviewer can test
Write down what the user should see, where the change belongs, which existing behavior the feature depends on, and what happens if a request is repeated or a dependency fails. Give each acceptance criterion an ID. The reviewer should be able to point to the criterion, the implementation, and the test that proves it.
## 2. Give implementation and review to separate agents
**Implementation agent.** Build to the spec and report the files changed, the checks run, and any decision the spec leaves open.
**Review agent.** Read the spec and the diff first. Check each criterion against code and test evidence. Apply the rules for that stack. For Python, that can include Ruff, mypy, test coverage for the changed paths, and keeping persistence and business logic in their proper layers. When behavior differs from the spec, report the criterion, the code location, and a specific scenario that shows the difference.
## 3. Split the test scenarios in dev
Give each runner a separate dev account or scoped dev credential and a distinct scenario. Run through the same entry points the application uses. Record the commit, the inputs, the expected result, and the observed result. Treat skipped or untested criteria as open items. Fix mismatches and rerun the affected scenarios before approval.
## A sample spec you can copy
This example uses a fictional bookmark feature. Use the same format for your own change.
```text
Feature: Save an article
Entry point: PUT /bookmarks/{article_id}
Rules: Store one bookmark per (account_id, article_id).
Use the signed-in account from the request.
A1 First save of an existing article returns 204 and creates one row.
A2 Repeating the save, including two concurrent requests, returns 204
and leaves exactly one row for that account and article.
A3 A missing article returns 404 and creates no row.
A4 A signed-out request returns 401 and creates no row.
A5 Two accounts can save the same article independently.
A6 A failed database write returns an error and leaves no new bookmark.
Checks: Link the tests for A1 through A6 and the lint and type check results.
Dev evidence: Criterion, commit, test account, expected result, actual result.
```
For the project rules and planning step that come before review, see [Use AI like a tech lead](/en/docs/ai-setup).
Markdown UTF-8 en 431 words 38 lines 3 min read
esc
↑↓Move ↵Open