Varun Vemulapalli

Day 65 of 100 · Phase 8: OpenAI Codex

Hands-on: have Codex build and test a feature

2 min readBy Varun Vemulapalli

Four friends, one $100 dinner, an 18% tip. Who pays what, down to the cent?

Today you'll have Codex build that feature, test it, and review its own work, while you act as the product owner.

Video explainer · 1:49
Key takeaway

You write the spec and the tricky example; Codex plans, builds, tests and reviews; you approve the commit.

Day 65 visual: Hands-on: have Codex build and test a feature
The visual from the original post.

The concept

This week you met the pieces: the surfaces (Day 61), setup (Day 62), AGENTS.md (Day 63) and tests plus review (Day 64). Today you put them in one loop:

spec → plan → build → test → review → commit

The spec is your job. The rest you delegate and check.

Walkthrough: a "split the bill" feature

The spec (write it before you open Codex):

  • Input: bill amount, tip %, number of people.
  • Output: what each person pays, in dollars and cents.
  • Rule: the shares must add up exactly to bill + tip. Leftover cents go to the first people in the list.
  • Error: 0 people is rejected with a clear message.

Worked example (illustrative):
1. Bill $100.00 + 18% tip = $118.00
2. Split 4 ways: $29.50 each. Easy.
3. Split 3 ways: $39.333… can't be paid in cents.
4. Rounded down: 3 × $39.33 = $117.99, 1 cent short.
5. Rule applied: $39.34 + $39.33 + $39.33 = $118.00

Step 3 is where naive code goes wrong, so that's what your tests must catch.

The session:
1. Ask first: "Read the spec below and propose a plan and a list of tests. Don't write code yet."
2. Check the plan includes the 3-way case. If not, say so.
3. "Go ahead. Write the tests first, then the code, and run the tests until they all pass."
4. Type /diff and read the changes.
5. Type /review and decide on each finding.
6. Commit. Then ask Codex to add "money is split in cents, never rounded per person" to AGENTS.md.

Where you see it at work

  • Banking: splitting a shared payment or a loan fee across accounts.
  • Insurance: dividing a premium across monthly installments without losing cents.
  • Healthcare: splitting a bill between insurer and patient.
  • Retail: allocating a basket discount across items for refunds.
  • Product owners: the spec, worked example and acceptance tests are the deliverable you own.

Try it today (10–15 min)

1. Make an empty folder, run git init, then codex (setup: https://learn.chatgpt.com/docs/codex/cli).
2. Paste the spec above, in your own words, and follow steps 1–6.
3. Break it on purpose: ask for "rounding per person" and see whether a test catches the missing cent.
4. Optional: push to GitHub, open a pull request and comment @codex review (https://learn.chatgpt.com/docs/third-party/github).

Codex runs commands on your machine. Keep it in a practice folder and read the diff before you commit.

In one sentence

You write the spec and the tricky example; Codex plans, builds, tests and reviews; you approve the commit.

What everyday calculation would you hand to Codex as your first real feature? 👇