Skip to content
papuh

Building apps

Weight log: the whole brief to copy

The whole brief from which an AI built the Android app Weight log, ready to copy. Plus what each part does and a template for briefing an AI on an app of your own.

The video loads from YouTube only after you click.

A different app first

Part six explains why the pen app is not available for download. I show the whole process, including the brief, first on a different app, where it can be shown in full and without reservations. This is that app. The brief for the pen app is in part twelve, with warnings.

It is called Weight log (Denník váhy in Slovak). It is an Android app where a person records their weight and body measurements and sees them as a chart over time. An AI (Claude Code) built it in one run from one brief, which is below in full. I prepared the brief with the help of AI and checked the result. How the build went, what failed and how it was fixed is in the next part.

What the app does

Three tabs:

  • Entries: a list, newest on top. The form has a date, weight in kg, measurements in cm and a note. An entry can be edited and deleted, and a deletion can be undone.
  • Chart: a line through the numbers the person entered, for weight or one measurement. With fewer than two entries, only a sentence saying the chart needs at least two.
  • Settings: which measurements I track (waist, hips, chest, thigh, upper arm), light or dark theme, export and import of a JSON file.

The texts are in English and Slovak, following the phone’s language.

What the app does not do

It has no target weight, no BMI or other index, no calories, no pace, no comparison with a norm, no good or bad colors, no arrows, no congratulations and no reminders. The chart has no trend and no average; it is only a line.

It has no internet permission, no accounts and no analytics, and it is not backed up to the cloud. The data sits in one file on the phone and leaves it only through an export the person makes.

Why this app

Unlike the pen app, this one calculates nothing from medication. And it judges nothing: it only shows the numbers a person enters. That is why I published its brief first and without reservations.

The “judges nothing” limit is in the brief together with its reason (part 9): the app knows nothing about the person’s health, and judging their numbers is for a doctor, not an app.

There is also a difference in the process. With the pen app, the AI asked me questions with options to choose from before writing any code (part two). Here it works without questions, because the decisions are already in the brief. Both ways work, and the template at the end of this article offers both.

What you need

  • A Mac with Android Studio installed: the Android SDK, the emulator and at least one virtual device (created in Android Studio’s Device Manager).
  • Claude Code in the terminal.
  • To install it on a phone: an Android phone and a cable. The steps are at the end of part eleven.

The brief is written for a Mac and Android. For an iPhone it would be different code.

How to use the brief

  1. Copy the whole block below.
  2. In part 0, check the line with the project folder. By default it is ~/projects/weight-log. It is the only place that needs changing.
  3. Paste the brief into Claude Code as one message.

The AI then works on its own and asks nothing. Claude Code may still ask for permission to run commands (Gradle, adb, the emulator, downloads). Those are not questions about the brief, but without an answer the build stops.

Honest note: the English brief has not been tested by a build. The app in part eleven was built from the Slovak brief, which is in the Slovak version of this article; the only change in that run was the folder path in part 0. The English brief has the same features, limits and definition of done, but the interface defaults to English, Slovak is the second language, and folders, commands and code identifiers are in English.

There is no app code or APK to download here. The app is built on your own computer from this brief.

The brief

# Task for the AI: "Weight log" app for Android

## 0. Project folder (FILL IN YOURS HERE)

>>> PROJECT FOLDER: ~/projects/weight-log <<<

This is the only line to check before you start. If you want the project elsewhere, change only the path on it.
All paths below are relative to this folder. If it does not exist, create it. If it exists and is not empty,
delete nothing in it and work only in the subfolders code/ and notes/.

## 1. Goal

At the end there is a native Android app "Weight log" that builds with a single command, passes its tests, runs
on the emulator and lets the user record body weight and body measurements and see them as a chart over time.

## 2. Context

- One person uses the app on their own Android phone. They install it from their own computer over adb,
  not from an app store. There are no accounts, no server and no sync.
- The person giving this task is not an Android developer. Everything a human has to do is one command
  of start.sh, and messages are understandable for them.
- The computer is a Mac with Android Studio installed (Android SDK, emulator, at least one virtual device).
  Find out everything else yourself (part 5).
- Work on your own from start to finish and do not ask questions. Where this task says nothing, decide sensibly
  and write the decision with its reason into the build log (part 8). The only exception is "When to stop"
  in part 8.

## 3. What the app does

One activity, Jetpack Compose, Material 3, bottom navigation with three tabs: Entries, Chart, Settings.

Entries
- List of entries, newest on top. A row shows the date, weight (if any), recorded measurements and the first
  line of the note.
- The + button opens the form for a new entry: date (today by default, picked from a calendar), weight in kg,
  fields for the measurements the user has switched on in Settings (in cm), note (optional, at most
  500 characters). An entry needs at least one number: weight or at least one measurement.
- Tapping an entry opens the same form for editing. The system Back button closes the form without saving.
- Delete: first a confirmation dialog, after deleting a bar "Entry deleted" with an "Undo" button that brings
  it back.
- An empty list shows one sentence on how to add the first entry.
- An input error is shown right at the field (for example "Enter a number, for example 78.5") and the entry
  is not saved.

Chart
- A switch above the chart: Weight and each measurement the user tracks.
- A line through the points over time, drawn with your own Canvas. Y axis: lowest and highest value rounded
  outwards to whole kg or cm, plus a few labels in between. X axis: date of the first and the last point.
- If one day has several entries with that value, the chart uses the last one recorded.
- Fewer than two points: instead of the chart the text "The chart needs at least two entries."
- The chart has a description for screen readers (quantity, number of points, first and last date).
- The line uses the theme's primary color. Nothing else: no target line, trend, average, zones, colors
  or arrows.

Settings
- Which measurements I track: waist, hips, chest, thigh, upper arm (switches, only waist by default).
  Switching one off deletes nothing, it only hides it in the form and in the chart.
- Theme: follow system (default), light, dark.
- Units: kg and cm (information only, this version has no other units).
- Export: saves all entries and settings to a JSON file the user picks in the system dialog (Storage Access
  Framework, CreateDocument), suggested name weight-log-YYYY-MM-DD.json. No storage permissions.
- Import: the user picks a file (OpenDocument), the app shows how many entries it contains and after
  confirmation replaces all data. Before that it saves the current data to the internal file before-import.json.
  An unreadable or invalid file changes nothing and the app shows a clear error.
- A short "About" text: data stays only on this phone, the app has no internet access, export is the backup.

Language: all texts in res/values/strings.xml in English (source) and in res/values-sk/strings.xml in Slovak,
no hardcoded text in code. The app follows the system language and has android:localeConfig (en, sk) so the app
language can also be changed on its own. App name: "Weight log" (en), "Denník váhy" (sk). Decimal point or comma
according to language.

Icon: a simple vector adaptive icon (a chart line) in a neutral color. No figure, scale, tape measure or logo.

## 4. Data and calculations

- Weight is stored in grams, measurements in millimetres, as whole numbers (Int). Decimals exist only on screen.
- Input: accept both a decimal point and a comma, ignore surrounding spaces. Weight with at most 2 decimals
  (78.45), measurement with at most 1 (91.5). More decimals is an input error, not silent rounding. Range:
  weight 20 to 400 kg, measurement 10 to 300 cm. The date must not be in the future. These checks only verify
  that the input makes sense, they judge nothing.
- Lossless display: 78500 g is "78.5", 78450 g is "78.45", 78000 g is "78.0", 915 mm is "91.5".
  Rounding happens only on the chart axis labels.
- All logic lives in pure functions in the package model with no Android dependency: input parsing and checks,
  formatting, sorting, adding, editing, deleting and undoing an entry, preparing chart points (points mapped
  to the range 0 to 1 and axis bounds), export and import (JSON with a version field). Checks return null when
  the input is fine, otherwise the error text.
- Data model (kotlinx.serialization), stored in the file log.json in the app's internal storage (filesDir):
  - WeightLog(version = 1, settings, entries)
  - Entry(id: String (UUID), date: String (YYYY-MM-DD), created: Long (ms), weightG: Int?,
    measurementsMm: Map<Measurement, Int>, note: String)
  - Measurement = WAIST, HIPS, CHEST, THIGH, UPPER_ARM; Settings(trackedMeasurements, theme)
  - every field has a default value and JSON is read with ignoreUnknownKeys, so a newer app version can read
    an older file.
- Storage (data/Storage.kt) works with java.io.File, not with Context, so it can be tested on the JVM. Writes go
  to a .tmp file which is then renamed. An unreadable file is never overwritten: it is moved aside as
  log-corrupted-<time>.json and the app starts empty.
- One ViewModel holds the state as an immutable object in a StateFlow; every change creates a new state and
  saves it. File writes run off the main thread.
- Tests (JUnit 4 on the JVM, app/src/test/) for every pure function, at least: input parsing (comma, point,
  spaces, empty, text, negative number, too many decimals, range limits), formatting, sorting and several entries
  on one day, delete and undo, chart points (none, one, two on the same day, all values equal), export and import
  round trip (including a note with accents, quotes and a line break), invalid JSON, unknown field, storage with
  a corrupted file (in a temporary folder). At least 20 tests in total, made-up values only.

## 5. Technology and versions

- Kotlin, Jetpack Compose, Material 3, one activity, enableEdgeToEdge() and Scaffold so nothing sits under the
  system bars. Navigation through state in the ViewModel, no navigation library.
- Allowed libraries: AndroidX core, activity-compose, lifecycle (viewmodel-compose, runtime-compose),
  Compose BOM (ui, material3, core icons), kotlinx-serialization-json, JUnit 4. Nothing else.
- applicationId and namespace eu.papuh.dennik, minSdk 26, compileSdk and targetSdk the highest that is installed
  on the machine and supported by the chosen Android Gradle Plugin (AGP) version.
- Do not guess versions from memory. First find out what is on the machine: the SDK in ANDROID_HOME, otherwise
  ~/Library/Android/sdk (folders platforms, build-tools, platform-tools, emulator); JDKs in JAVA_HOME, in Android
  Studio (/Applications/Android Studio.app/Contents/jbr/Contents/Home) and in ~/Library/Java/JavaVirtualMachines,
  with java -version for each; downloaded Gradle versions in ~/.gradle/wrapper/dists. Then check official sources
  (developer.android.com, gradle.org, kotlinlang.org, Google Maven, Maven Central) for the current stable versions
  of AGP, Gradle, Kotlin, the Compose BOM and kotlinx-serialization and their compatibility tables (AGP with
  Gradle, JDK and compileSdk). Pick the newest stable combination that fits what is on the machine. Put all
  versions in one place: gradle/libs.versions.toml.
- Follow the documentation of the chosen version, not habits from older ones. For example, newer AGP versions
  have Kotlin support built in and the separate plugin org.jetbrains.kotlin.android is not combined with them;
  check how it works for yours.
- Gradle wrapper: if an unpacked Gradle is on the machine, generate the wrapper with it; otherwise download the
  official distribution from services.gradle.org into a temporary folder and run gradle wrapper from it.
  Install nothing globally.
- Gradle may download a missing SDK package (platform, build-tools) on its own during the build. Otherwise
  do not change the SDK.

## 6. Privacy

- The manifest has no INTERNET permission and no other permission the app does not need, and the app has no
  notifications. If a library adds INTERNET through manifest merging, remove it (tools:node="remove").
- android:allowBackup="false" and android:dataExtractionRules with a file that excludes everything from cloud
  backup and from device-to-device transfer.
- No accounts, analytics, crash reporting, ads, WebView or outgoing links. Data leaves the phone only through
  an export the user makes.

## 7. Output

  code/
    start.sh              the single entry point for a human
    README.md             short: what it is, start.sh commands, chosen versions
    .gitignore            build/, .gradle/, .kotlin/, local.properties, *.apk, *.jks, *.keystore
    settings.gradle.kts, build.gradle.kts, gradle.properties, gradle/libs.versions.toml
    gradlew, gradlew.bat, gradle/wrapper/
    app/build.gradle.kts
    app/src/main/AndroidManifest.xml
    app/src/main/java/eu/papuh/dennik/   MainActivity.kt, LogViewModel.kt, model/, data/, ui/
    app/src/main/res/                    values/, values-sk/, xml/, mipmap-anydpi-v26/, drawable/
    app/src/test/java/eu/papuh/dennik/
  notes/
    build-log.md
    screenshots/          emulator screenshots from the check

start.sh (zsh, set -euo pipefail, executable, no absolute paths containing the user name):
- ./start.sh or ./start.sh test: unit tests on the JVM.
- ./start.sh apk: builds the debug APK, prints its path and the list of permissions in the APK (aapt2 dump
  permissions from the newest build-tools) and fails if android.permission.INTERNET is among them.
- ./start.sh install: builds, installs over adb and launches the app. If no device is connected, it says what
  to do (connect a phone with USB debugging or start the emulator). If there are several, it uses
  ANDROID_SERIAL, otherwise it lists them and exits.
- The script finds the JDK itself (order: JAVA_HOME, the JDK in Android Studio, ~/Library/Java/JavaVirtualMachines;
  it takes the first one the chosen Gradle runs on) and the SDK (ANDROID_HOME, otherwise ~/Library/Android/sdk),
  creates local.properties if missing and prints at the start which Java and SDK it uses.

Code, identifiers and comments in English, UI texts only from strings.xml.

## 8. Way of working and build log

1. Before each bigger step, say in one sentence what you are about to do.
2. Create notes/build-log.md right at the start and update it after every step, not only at the end. Each entry:
   time (HH:MM), what was done, the exact command, the result (passed or failed), for a failure a short excerpt
   of the message (at most 10 lines) and what fixed it. At the end a table of chosen versions with the reason,
   the number of tests, the APK size, what was checked on the emulator and what was not, and a section
   "Ideas for later".
3. The log is truthful: do not write that something passed unless you saw it pass, and do not leave out errors
   or dead ends. It is the material for a video about the build.
4. No path containing the user name in the log, code, README or screenshots: write the home folder as ~.
5. Order: inspect the machine and versions, Gradle skeleton and wrapper, the model package with tests,
   ./start.sh test, storage and ViewModel, screens, ./start.sh apk, check on the emulator.
6. When the build fails because of a version, change one thing at a time and log it. After three failed attempts
   with the newest combination, go back to a combination the compatibility tables list explicitly.
7. Check on the emulator: $ANDROID_HOME/emulator/emulator -list-avds lists the devices. If no emulator is running,
   start the first device with its window, in the background, and wait until adb shell getprop
   sys.boot_completed returns 1 (at most 5 minutes). Use only the emulator, never a physical phone, even if one
   is connected (set ANDROID_SERIAL to the emulator). Then ./start.sh install and drive the app over adb:
   uiautomator dump to find elements, input tap, input text (plain ASCII only, space as %s), hide the keyboard
   with input keyevent 111. So elements can be found regardless of language, put
   Modifier.semantics { testTagsAsResourceId = true } on the root of the UI and give important elements a testTag
   (for example add, field_weight, save, tab_chart, chart). Record two weight entries with different dates, open
   the chart and save screenshots (adb exec-out screencap -p) to notes/screenshots/: list, form, chart. Check the
   data with adb shell run-as eu.papuh.dennik cat files/log.json. Leave the emulator running at the end.
8. When to stop: if the Android SDK is missing or there is no virtual device, do not improvise. Write into the log
   what is missing and what the human has to do (for example open Device Manager in Android Studio and create
   a device), and finish with a message containing the same text.

## 9. What not to do (and why)

- The app gives no advice and makes no judgement. No target weight, no BMI or other index, no calories, no pace,
  no "left to go", no comparison with a norm, no good or bad colors, no up or down arrows, no congratulations,
  badges, challenges or reminders.
  Reason: the app knows nothing about the person's health, and judging a number would be health advice, which
  belongs to a doctor. The chart is only a line through the numbers the user entered.
- Nothing about medication, food or exercise: no field, no text, no example. Reason: the app is a log of
  numbers, not a health tool.
- No internet, accounts, analytics, ads or cloud. Reason: weight and body measurements are sensitive data and
  stay only on the phone.
- No chart library, Room, Hilt, KSP, kapt or navigation library. Reason: every extra dependency is one more
  version that can clash; the chart is a few lines on a Canvas.
- Do not edit a test to make it pass and do not change the meaning of a calculation to match a test. When a test
  fails, first find out whether the error is in the code or in the test's expected value, fix what is actually
  wrong and write in the log why.
- Install nothing globally (no Homebrew, no changes to ~/.zshrc) and do not change system, Android Studio or SDK
  settings beyond what Gradle downloads during the build.
- Do not use a physical phone and do not delete data of other apps. The human installs the app on the phone
  with ./start.sh install.
- Do not create a git repository, do not commit and do not publish anything. The human decides that.
- Add no features beyond this task. Write ideas into the log under "Ideas for later".

## 10. Definition of done

Done means everything below holds at once in the folder code/ and the log contains the output of every command:
1. ./start.sh test ends with BUILD SUCCESSFUL, at least 20 tests pass, none fails or is disabled.
2. ./start.sh apk prints the path to app-debug.apk and a permission list without android.permission.INTERNET.
3. On the emulator the app installs and starts via ./start.sh install, it contains two weight entries,
   run-as ... cat files/log.json shows them, the Chart tab shows a line and the screenshots are in
   notes/screenshots/.
4. grep -riE "(^|[^a-z])bmi([^a-z]|$)|kalóri|calori|cieľov|goal|gratul|congrat" app/src/main/res finds nothing.
5. grep -rn "/Users/" . ../notes --exclude=local.properties --exclude-dir=build --exclude-dir=.gradle
   --exclude-dir=.kotlin finds nothing.
6. notes/build-log.md has all steps, versions and the summary.

At the end write a short message: what is done, chosen versions, number of tests, what failed or was not checked,
and how to get the app onto the phone (Developer options, USB debugging, ./start.sh install).

What each part does

Part What it does What happens without it
0 Folder the only place you change; everything else is relative to it the AI picks a place itself, often where nobody will look
1 Goal one sentence on what has to be true at the end the AI does not know when to stop and keeps adding
2 Context for whom (one person, one phone), which computer, work without questions the AI proposes accounts or a server, or stops and waits for an answer
3 What the app does screens and behaviour that can be checked by eye an app that is “similar” but not what you wanted
4 Data and calculations whole numbers, an exact data model, pure functions and a list of tests decimal errors, data a new version cannot read, tests only for show
5 Technology and versions the stack and an instruction to find versions on the machine and in official sources the AI writes versions from memory that may no longer hold, and the first build fails
6 Privacy no internet, no cloud backup data leaves the phone without you knowing
7 Output folder structure and the start.sh commands every project starts differently and a month later you do not remember how
8 Way of working and log order of steps, a truthful build log, the emulator check, when to stop you do not know what happened and why; errors vanish from the story
9 What not to do limits with reasons: the app gives no advice and judges nothing, no needless libraries, never change a test to get green the AI “helps” with a target weight or BMI and the app starts giving advice
10 Definition of done commands that can be run and what they should print “done” only means the AI stopped writing

Two things worth noticing:

  • A reason with every prohibition. A prohibition with a reason also covers situations the brief did not foresee. Knowing the reason, the AI will not add even a “weekly average”, although the list of prohibitions does not mention it.
  • The definition of done is commands. Not “the app works”, but “./start.sh test succeeds, the APK has no internet permission, the emulator has two entries and a chart”. The same approach as with the pen app in part two.

You can safely change the folder (part 0), the package name eu.papuh.dennik to your own (everywhere at once) and the list of measurements. I would not drop parts 8 to 10. Those are what turn an AI run into something that can be checked.

Template: how to brief an AI on your own app

The Weight log brief is a filled-in template. The same skeleton works for your own app; what is in square brackets is what you fill in. Parts 8 to 10 are the ones people most often leave out, and they are exactly what makes the difference between “the AI wrote something” and “the app runs and I know how it came about”.

# Task for the AI: app "[name]"

## 0. Project folder
>>> PROJECT FOLDER: [~/projects/name] <<<
All paths are relative to it. If it exists and is not empty, delete nothing in it.

## 1. Goal
[One sentence: what has to be true at the end. Not "an app for X", but "the app builds, passes its tests and lets me do Y".]

## 2. Context
- Who uses the app and on what: [one person, their own Android phone / iPhone / computer].
- Who gives the task: [I am not a programmer; everything I do should be one command].
- What is on the computer: [installed tools]. Find out the rest yourself.
- [Work on your own and do not ask; write decisions with their reasons into the log.]
  or [Before writing code, ask me at most 5 questions, each with options to choose from.]

## 3. What the app does
[Screens, and for each 3 to 6 sentences on what is on it and what happens on a tap. Empty state, input errors,
deleting with confirmation and undo. Language of the texts.]

## 4. Data and calculations
- [What data the app keeps and where: a file on the phone, not a server.]
- [Numbers: in which units they are stored (whole numbers in the smallest unit), when rounding happens (only on display).]
- [What is a pure function with tests: everything that calculates or changes data.]
- [Examples with a known result that become tests: input → output.]

## 5. Technology and versions
- [Language, framework, platform; allowed libraries, nothing else.]
- Do not guess versions from memory: find out what is on the machine and what is current and stable, and pick a combination that works together.

## 6. Privacy
[What the app must not do: internet, accounts, analytics, cloud backup. How data leaves the device: only through an export.]

## 7. Output
[Folder structure. One script with the commands test, build, install. A README on how to run it.]

## 8. Way of working and log
- Before each step, one sentence on what you are about to do.
- A running build log: time, command, result, error, fix. Truthfully, including dead ends.
- [Order of steps: calculations with tests first, then screens.]
- [How the app is checked on the emulator or in the browser and what gets a screenshot.]
- When to stop: [what has to be on the machine; if it is missing, write down what and stop].

## 9. What not to do (and why)
- [What the app must not do, even if it would "help". A reason for each point.]
- Do not edit a test to make it pass and do not change the meaning of a calculation because of a test.
- Add no features beyond the task; write ideas down separately.
- [What the AI must not do with the computer: install globally, commit, publish.]

## 10. Definition of done
1. [Test command] succeeds and at least [N] tests pass.
2. [Build command] produces [file] and [check, for example the permission list].
3. [On the emulator or in the browser X and Y can be done; screenshots are the proof.]
4. The build log is complete.
At the end a short message: what is done, what is not and what I have to do.

Four things are worth keeping to when filling in the template:

  • First one sentence of the problem and a limit on what the app does not do. Only then screens. The limit shapes more code than any feature.
  • Describe what you see and what happens, not how to program it. “After deleting, a bar with an Undo button” is better than “use a Snackbar”.
  • Every number with an example. An example with a known result becomes a test, and the test makes sure the AI does not break it later.
  • Less is more. The first version should be small and finished; more comes later in short briefs, based on use.

How the brief held up in a real build, and what I would change in it afterwards, is in part eleven. The whole process is also in a video on YouTube, in Slovak; the voice in it is AI-generated from my own.

I prepared this text with the help of AI from my own notes and the build log.