PrologueThe gate before the bet
Before I trusted an AI with a medical device, I made it pass a few tests. It passed most of them. The one it failed taught me more.
In 2025, I asked Claude to build the same FHIR server three times. FHIR is the standard healthcare systems use to exchange data. One version was pure microservices, with a database per service; one was split by domain, with a database per domain; the third was close to a monolith. Forty-eight hours later, I had all three, with clean code and the same conventions across every published endpoint.
I had come to that test sceptical of vibe coding, the practice named in early 2025: describe what you want, accept what comes back, and don't look too closely at the code. In the short term it looks like speed. Over the life of a product, code accepted without being understood is technical debt: nobody knows why it is the way it is, and every change to it is a gamble. A product that must stay in service, and stay safe, for ten years or more pays that debt in full, which is why I hold vibe coding unsuitable for anything critical or long-lived. IEC 62304, the standard for medical device software, asks for every requirement to be traced, every change verified and every line owned. I wanted to know whether a language model, properly steered, could produce code that meets that bar.
The test was the second of three gates before the project. The first was to take an informed position on generative AI, which became GenAI Beyond the Hype; the third, a method to make up for its shortcomings, is the subject of chapter 04. Only when all three were green did I start something of substance.
What did 48 hours teach me?
Given instructions written like acceptance criteria, clear, unambiguous and testable, Claude met them on every run, even though the code differed from one run to the next. It filled the database with plausible data, which in healthcare means testing without a single real patient record, and the database could be rebuilt at will, so every test was repeatable.
The larger lesson was about architecture. Comparing three designs cost two days instead of months, so I could judge them on evidence. For a simulated medical device, the single database won, because only it could guarantee the integrity of the data. I come back to that choice, and to its price, in chapter 08.
What it got wrong
I had not asked for Hibernate. Claude chose it. The FHIR model is complex, Hibernate struggled with it, and each of its many bugs was fixed with another annotation or another library, each one a dependency I had not chosen and could not control. Left to its own devices, Claude makes questionable decisions, and it does not advertise them. From then on, one rule held: every decision is mine, or explicitly approved by me.
Hibernate, revisited
Hibernate, the best-known Java library for mapping objects to a relational database, generates most of the SQL, and many teams accepted that trade-off because writing it by hand for a large data model is tedious and error-prone. An AI changes the terms: it can write every statement as ordinary code, to be read, reviewed, tested and measured before the product ships. With Hibernate, nobody can list in advance every statement it will generate, and for a medical device that leaves an open question: what if it generates the wrong one in production?
So I had Claude rewrite the persistence layer of one implementation with no library other than JDBC, Java's plain database interface, and every SQL statement a constant string. The tests passed, every statement the application could ever issue could be run and measured on its own, and with values always bound as parameters, a whole class of security flaws disappeared. The rule became a permanent constraint of the product. When one of its components was later moved off Hibernate, its deployable package shrank from about 25 MB to under 4 MB.
Still at the coding level
These servers were stepping stones, never meant for production, and a FHIR server needs little product thinking, because the standard has already decided what it must do. Nothing in these experiments said what a product should be, or how to turn its definition into requirements, architecture and stories without losing anything on the way. That gap is what led me to BMAD.