Skip to content
papuh

Building apps

From idea to a brief

One sentence of the problem, the limits and decisions before code. How I described to the AI what I wanted, and what a brief you can work with looks like.

Treatment decisions are made by a doctor. This describes building an app, not advice.

First a sentence, then code

At the start I had no specification. I had a problem in one sentence: I need a tool that converts volume from a multi-dose pen when a pen of the needed strength is not available. Plus one example with values I know from the leaflet, so the AI knew what a correct result looks like.

Right after that came the limit from the first part: only a volume calculator, no dosing. That sentence changed more code than any technical requirement.

Decisions I made

Before writing code, the AI asked me several questions, each with options to choose from. This is what I chose:

  • Who it is for: only my phone, not a product. Reason: no app store and no assessment of whether it is a medical device.
  • Technology: the choice was web technology wrapped in an app, a native Android app, or a web app in the browser first. I chose a native app in the Kotlin language. I wanted pure Android: reminders that arrive even when the app is closed, and data only on the phone, with no internet. The trade-off is that an iPhone version would be new code.
  • Development environment: I installed Android Studio myself, not through the command line.
  • Pace: build right away in the same session, not write a brief for approval first.

Decisions before code

Some rules were set before the first line of code, because in a calculation involving medicine they cannot be added later:

  • Whole numbers. The app calculates in the smallest units of weight and volume as whole numbers. Decimals only appear on the screen. With decimal numbers a computer sometimes rounds where you do not expect it, and here I did not want that.
  • No silent rounding. If the result does not land exactly on a whole step of the pen, the app does not round on its own. It shows the two nearest options and leaves the choice to me. What to do about it is a question for a doctor or pharmacist, not for the app.
  • Tests from the example. The example from the brief became an automated test. Every change to the calculation must have a test.
  • Data only on the phone. The app has no internet permission. The data is in a single file in internal storage and is excluded even from the automatic Google backup. I back up by exporting by hand.
  • Simple storage. One file instead of a database. The reason was practical: fewer tools to get running for the build.

The app as modules

We split the brief into modules, so it was clear what depends on what:

Module What it does
Calculator volume conversion and input checks
Pens several open pens, prescribed amount, pen status
Injection log confirmation, injection site, note, history
Pen drawing a pen with a scale and a plunger by what is left
Schedule next injection, pen running out, in-use period after opening, buying
Reminders notifications, also after the phone restarts
Backup export, restore, delete everything
Build first build, tests, installing on the phone

The minimum usable version was every module except a calendar in the history, which was left for later.

What a brief for the AI looks like

Every piece of work in my repository has a brief with the same sections. For the app it went like this:

  • Goal: one sentence about what must be true at the end. For example: the code builds without errors and all tests pass.
  • Context: what already exists and what is uncertain. The AI wrote the code without a compiler, so the tool versions were only a guess, and the brief said so openly.
  • Output: which files should change and where the result is recorded.
  • Constraints: limits that apply even when fixing bugs. The calculation stays in whole numbers and no text may give advice.
  • Definition of done: a command you can run and what it should print. Not “it works”, but “the tests finish successfully and an install file is produced”.
  • What not to do: do not add features from the ideas list, do not install on the phone before it is time, and do not change the meaning of the calculation to make a test pass.

The last point proved the most useful as early as the first build. That is the next part.

The full brief from this conversation is not here. A brief from which an AI builds a similar app I wrote later, working back from the finished app and with no values of a real pen. It is in part twelve. Why the app itself is not available for download is in part six.