Back to the live walkthrough

Part 3: how I used AI

Tools

Claude Code, Anthropic’s coding agent, in my terminal, for both parts. It ran the research, drafted the Java and the tests, drew the diagram and ran the builds. I set the rules, made the decisions, and decided what was good enough to send.

I worked the way I would lead a fast team: say what matters, ask the awkward question, refuse the first answer when it is wrong, and insist on proof.

How I worked

I followed the loop that most current guidance on coding agents converges on: understand first, plan, build in small steps, and make the agent prove each claim. Here is what each step looked like on this exercise.

1. Understand the domain before any code

My first prompt was not “write the pricer”. It was a request for research on how open-loop transit payments work: what a reader on a bus does when it is offline, how a bank card is authorised when the price is not known yet, what the passenger sees in their banking app and when, and how systems differ between the Netherlands, Türkiye, the UK, the US, Australia and Japan.

The agent ran several research passes in parallel and produced a long cited report. I then tested it with pointed questions:

Those answers are why the design note separates “the reader lets you on” from “the back office prices the trip”, and why decision 6 (authorise per trip, capture once a day) is marked as something to confirm with the acquirer rather than stated as fact.

2. Plan, with my constraints written down

Before any code I had the agent write a plan and I gave it the rules for the work. The ones that mattered most:

3. Build in small steps, tests alongside

The core went up in layers: the fare table, then pairing taps into trips, then the anomalies, then versioned fares per operator (FareCatalogue, Tariff, IncompleteTripPolicy). The suite grew from 65 tests to 80 as the rules were added. The agent ran ./gradlew test after each change and showed me the result, so I was reviewing evidence, not a claim that it worked.

4. A second, independent review

An agent that wrote the code is a poor judge of it. So I had a separate review pass, with a fresh context, check the code against what the README claimed. That is where the two real bugs below were found. I ran the same kind of review on the design note and on the demo site.

What I changed or rejected

Three bugs the reviews found, each a case where the code contradicted my own README.

  1. Conflicting tap IDs. When two taps shared an ID but differed in content, the code kept the first one it received. That made the price depend on arrival order, which is the one property I was claiming it did not have. Now no copy of a conflicting ID is trusted, both are reported, and the shuffle test includes a conflicting pair.
  2. Unknown stops. A tap off at a stop missing from the fare table was silently dropped. The tap on then looked incomplete and the passenger was charged the maximum fare for a trip they had finished. Now the whole trip is reported and nothing is charged, with tests in both directions.
  3. No fare between two known stops. In a final read-through before sending, I found that a trip between two stops the fare table knows, but has no fare for, threw an exception and stopped the whole run. One odd trip should never block everyone else’s. It is now reported as NO_FARE_BETWEEN_STOPS, with a test.

Claims I made the agent take back.

Choosing the right tools and keeping the code clean

An agent will happily add a framework, a library and three layers of abstraction to a problem that needs none of them. The test I applied to every choice was the same: can I say in one sentence what it is for? If not, it stays out.

Tools

Code

How I satisfied myself it is correct

Passing tests do not prove the behaviour is right, only that it matches what I asked for. The bugs above passed every test that existed at the time. What caught them was reading the code against the claims.

What I would do differently

Where AI could help the team