Codex is building Slice 1. In this guide you learn how to review what an agent writes while it writes it: the database migration first, then the API and its tests, then the written design record. Then you open Part 2 in Chrome and send your first follow-up change.
GRILL.md, the written record of your grilling decisions, and check it against what you actually answered.http://localhost:5102 and try the user switcher.code command works (set up in guide 1).You do not have to wait for Codex to finish before you start reviewing. While it works, a line like Step 1/4 · 9 files changed +108 -56 appears under its to-do list. The +108 is lines added, the -56 lines removed. Click the words files changed. A Review panel opens on the right side of the Codex window, with one entry per file.
A diff shows the difference between two versions of a file, line by line. Lines Codex added are marked with + and shown in green; lines it removed are marked - and shown in red; unchanged lines are grey context. Reading diffs instead of whole files is how professional engineers review each other's work, because it shows only what changed. With an agent it matters even more: you did not type this code, so the diff is your first and best view of what actually happened.
The Review panel, labelled Last Turn at the top, lists files like AGENTS.md, GRILL.md, README.md, package.json and 001_marketplace.sql, each with a mostly green diff because they are new. The file list and the counts keep growing while Codex works, so do not worry if your numbers are different from mine.
Why review while it runs? Because if the very first file, the migration, is wrong, you can stop Codex with the ■ button and correct it before it builds an API and a UI on top of a wrong foundation. Ten minutes of agent time is cheap; ten minutes of agent time spent on the wrong design is not.
In the Review panel, click server/migrations/001_marketplace.sql. I always check the database first, because so much goes wrong at the database level, and everything else depends on it. If a column is missing or a price is stored as a decimal, the API and the UI inherit that mistake. Compare each table with your grilling answers from guide 8.
SQL is the language you use to talk to a relational database like PostgreSQL. A migration file is just SQL statements run in order. CREATE TABLE users (…) defines a new table and its columns, each with a type (TEXT, INTEGER, TIMESTAMPTZ for a timestamp with time zone). A column like seller_user_id that points at a row in another table is a foreign key: it links an auction to the user who posted it, and the database refuses to save an auction whose seller does not exist. CREATE INDEX builds a lookup structure so that searching by that column is fast. INSERT INTO users (…) VALUES (…) adds rows; that is how the seed data gets in.
Something similar to:
CREATE TABLE users with columns id, display_name, handleCREATE TABLE auctions with slug, seller_user_id, title, category, starting_price_cents, ends_at, location, condition, description, specs and moreCREATE TABLE bids with auction_id, bidder_user_id, amount_cents, created_atINSERT INTO users with 10 people (Avery Chen, Maya Thompson, Theo Brooks, Priya Shah, Jordan Lee, Sam Rivera, Nora Williams, Eli Martin, Zoe Patel, Marcus Green) and INSERT INTO auctions with the 6 catalog itemsMap it back to your decisions: three tables because you asked for users, auctions and bids; ends_at as a timestamp with time zone because you chose UTC closing times; the _cents suffix on every price because you chose integer cents.
My run used integer IDs (1, 2, 3…). In another run Codex used GUIDs, long random identifiers like 3f9a…. Either is fine for us. What is not fine is a price column without _cents or with a decimal type; if you see that, stop Codex and point at your Q6 answer.
Still in the Review panel, open server/src/app.ts and then server/src/app.test.ts. You are not reading every line; you are checking two things: that the routes match the slices you approved, and that the code follows the project's rules. Part 2's AGENTS.md asks for plain SQL through the pg library (the standard Node.js Postgres driver) with no ORM, and Zod for checking inputs.
An ORM (object-relational mapper) is a library that hides SQL behind language objects: you call Auction.find() and it writes the query for you. Convenient, but you stop seeing what hits the database, and that is exactly where our concurrency bugs will live later. So this project writes SQL directly. Direct SQL must be parameterized: the query uses placeholders like $1 and the values are passed separately, never glued into the string. If a user's search text were pasted straight into the SQL, a malicious search like '; DROP TABLE users; -- would run as a command. That attack is called SQL injection, and placeholders make it impossible.
In app.ts: routes like GET /api/users, GET /api/auctions (with a Zod schema that validates the search query parameters) and GET /api/auctions/:slug, where :slug is a placeholder for one auction's URL-friendly name. All reads, no writes yet; posting and bidding are Slices 2 and 3. In app.test.ts: tests with names such as “lists the ten seeded users” and “lists and searches the six database-backed auctions”.
Test names are the fastest way to check an agent's understanding. Read them as a list of sentences. If a sentence describes behaviour you did not ask for, or an important behaviour is missing from the list, you have found a gap before you have run anything.
The Review panel is good for diffs but awkward for moving around a project. I find VS Code much easier for that, so from here on we read code there and keep Codex for the conversation. Close the Review tab in Codex, then open the workshop in VS Code. Skip the command if VS Code is still open on the workshop from guide 8.
code ~/codex-course/workshop
In the Explorer, expand part-2-create-auction-and-bid, then server and web. The split is the same in every part: server/ is the Fastify API (backend), web/ is the React app (frontend). Each has its own src/ folder with the source code.
Inside part-2-create-auction-and-bid: server/migrations/ with the SQL file from Step 2; server/src/ with app.ts (routes), index.ts (starts the server), migrate.ts (runs migrations), otel.ts (tracing setup we use in guide 25); and web/src/components/UserSwitcher.tsx, the new footer switcher component, among others. Red squiggly underlines in the editor are normal until npm install has run in this folder and Codex has finished; they mean VS Code cannot find packages yet, not that the code is wrong.
Now the most important document of the slice. GRILL.md in the Part 2 folder is the grilling session written down: every decision from guide 8, in the form Codex must follow while it builds. It is also what future chats read, so if it is wrong today, every later slice inherits the error. Open it and check it line by line against your round 1 and round 2 answers.
code ~/codex-course/workshop/part-2-create-auction-and-bid/GRILL.md
Giving code a file path instead of a folder opens just that file in the existing VS Code window. Press Cmd+K then V for the formatted preview.
Sections similar to Actors (ten predefined users, footer switcher, no login), Auctions (required fields, category illustrations, live on creation, UTC closing), Money and bidding (USD integer cents, $1 minimum increment, no self-bidding, ended auctions reject bids), Reset behavior (only db:reset wipes auction_part_2) and Delivery slices (the three slices you approved). Every item should be something you consciously decided in guide 8.
The domain-modeling skill usually also writes a CONTEXT.md glossary (what “auction”, “bid” and “active user” mean in this project), and sometimes docs/adr/ files. In my run it did not; everything went into GRILL.md, and that is fine. If yours created CONTEXT.md or ADRs, read those too. If anything in these files contradicts what you answered, tell Codex in the chat with one sentence, for example “GRILL.md says bids need $5 increments; we agreed $1. Fix the doc and the code.”
Go back to the Codex chat and let it finish. Near the end of Slice 1 it does four things in order: resets the Part 2 database, runs the migration, runs the tests and the TypeScript type checks, and then opens the app in a real browser to click through it. I want to stress this part. An agent will tell you “done” very confidently whether the code works or not. Confidence is not evidence. The only defence is to give it tools that produce evidence: tests that pass or fail, a compiler that accepts or rejects, a browser that renders or throws errors.
An automated test is a small program that runs part of your app and checks the result: “call GET /api/users, expect 10 rows”. You run all tests with one command and get a pass/fail list in seconds, every time anything changes. A type check is different: TypeScript reads the code without running it and verifies that every value is used the way its type allows, so passing a string where a number is expected is caught before the app even starts. “Strict” TypeScript, which our AGENTS.md demands, turns on the toughest version of these checks. Tests catch wrong behaviour; type checks catch wrong plumbing. Together they are how Codex proves a slice to you, and how you will later prove your fixes to Codex.
A message similar to: “Database reset, migration, all six tests, and both strict TypeScript checks pass. I'm using the Chrome control skill now because the project requires real browser verification…” followed by a Chrome window opening on the Part 2 site. In my run the browser check found a real bug: the dev server kept restarting because tsx watch (the tool that restarts the server when files change) was also watching OpenTelemetry files inside node_modules. Codex noticed the restarts, worked out the cause and fixed the watch configuration on its own. Tests alone would never have caught that; the browser check did.
With an API key, Codex's built-in browser is not available. Your Codex will most likely use Playwright with Chrome instead, as in guide 6, and it may ask to install it: approve that. If it says it cannot check in a browser at all, do not worry; you do the check yourself in Step 8.
When Codex stops (about 9 minutes after you approved the slices, in my run), read its final message from top to bottom. Do not skip to the URL. The summary is structured so you can verify each claim, and that is what the next step does. Click the diagram to enlarge it and compare it with the one from guide 8: it should be the same architecture, now built.
Something like: “Slice 1 is complete and verified. The app remains running at http://localhost:5102…”, then four blocks:
auction_part_2 database and ports 3102/5102, the 001_marketplace.sql migration, 10 users and 6 auctions seeded, database-backed read APIs in app.ts, the footer switcher in UserSwitcher.tsx, and the decisions recorded in GRILL.mdNotice that Codex has stopped and is waiting. That pause between slices is the AGENTS.md rule in action; it will not start Slice 2 until you say so.
Codex leaves the app running and tells you the URL, http://localhost:5102. Its reply may also show a Web preview card, but that built-in preview does not work with an API key, so open the URL in Chrome yourself. Part 1 is still on 5101 if you left it running; the two do not interfere.
http://localhost:5102
Then follow Codex's To review list. This is your browser checkpoint for Slice 1:
localStorage decision from Q10.memory in the search bar. The search now runs as a SQL query on the server, not as a filter on a hard-coded list.If the page does not load at all, the app is not running. Start it yourself from the Terminal app with the command below; it installs the packages for Part 2 and starts everything, exactly like npm start did for Part 1 in guide 7.
cd ~/codex-course/workshop/part-2-create-auction-and-bid && npm install && npm start
The Auction House homepage (“Serious hardware. Less serious prices.”) with a 10 Demo users label at the top right and Browsing as … (@handle) in the footer, for example Jordan Lee (@jordan). After a reload, the user you picked is still selected. Searching memory returns the DDR5 memory kit.
Also open http://localhost:5102/api/users in a new tab. You get raw JSON with the ten users straight from the API, the same data the footer switcher uses. Looking at API responses directly is a habit that will save you hours of guessing whether a bug is in the frontend or the backend.
The slice works, but one detail bothers me: the “10 Demo users” label at the top right is meaningless to a visitor, and every new window starts as the same first user. I want each window to start as a random user, with that user's name shown at the top right. The reason is practical: in guides 11 and 12 we open several browser windows and make them bid against each other, and we need to see at a glance who is who in each window. Send this follow-up in the same chat:
randomly assign the user on page load AND put the user's name on the top right, not "10 demo users"
Notice the prompt is short, specific and names the exact text to replace. Two concrete changes, nothing vague. You do not need to re-grill for a tweak like this; grilling is for design decisions, not for every edit. This is also a change to a decision recorded in GRILL.md (Q10 said “start with the first seeded user”), so watch whether Codex updates the document as well as the code. It should.
Codex replies with a short plan similar to: “I'll make the initial user random per browser tab, then keep that identity stable through navigation and reloads in the same tab; the footer switcher can still override it… replacing “10 Demo users” with the selected user's actual name. This updates the earlier localStorage decision in GRILL.md.” Then it edits a few files, mostly under web/src/, and runs the tests again before it stops. Guide 10 starts by checking the result in the browser.
Even a small change ends with tests. “Never stop without running tests” is, in my experience, a big part of why this workflow produces code you can trust. If you ever see Codex finish an edit without running anything, ask it to run the tests before you look at the result.
If Slice 1 failed or looks very different from what I describe, first tell Codex what you see, in the same chat, with the exact error text or a description of the wrong behaviour. That fixes most problems. To catch up instead, replace your Part 2 with the reference copy's version. Be aware that it is the end state of the whole part: all three slices done, the random user per tab, and a bidding-war test that we add in guide 12. In guide 10 you would then skip the build steps and only do the browser checks.
cd ~/codex-course/workshop && rm -rf part-2-create-auction-and-bid && cp -R ../reference/part-2-create-auction-and-bid ./ && git add -A && git commit -m "Catch up: part 2 from reference"
That line deletes your Part 2, copies the reference Part 2 in its place, and commits it so the catch-up is recorded in your Git history.
cd ~/codex-course/workshop/part-2-create-auction-and-bid && npm install && npm start
_cents suffix tell you in thirty seconds whether the agent understood your design; everything else is built on top of them.GRILL.md (or CONTEXT.md and ADRs) keeps the grilling decisions next to the code, so Codex keeps following them in later chats, and so you can catch a misunderstanding before it spreads.AGENTS.md plus the docs from grilling save you from answering the same design questions again and again.