Lab 3 · intermediate · About two hours

Build a simple useful web app with a coding agent

One narrow job, a simple stack, tests that specify behaviour, a real review of the diff, and a deployment with no secrets in it.

You finish with

A small deployed application that does one thing correctly, with tests you wrote and a review you performed.

Before you start

  • Git and a terminal.
  • A coding agent.
  • A static or small server host.

Material: Your own repository. Start from an empty one.

  1. Write the one-sentence job

    No "and". If you need one, you have two projects. Example: "Lets me save events from a list and see them sorted by date."

    Checkpoint One sentence, one verb, no conjunction.

  2. Initialise and branch

    Create the repository, commit an empty starting point, and work on a branch. This is what makes everything after it recoverable.

    Checkpoint Clean starting commit exists on a branch.

  3. Write the tests first

    Three tests: the normal case, the empty case, the awkward case. These are your specification and the agent's instruction at the same time.

    Checkpoint Three tests exist and all fail.

  4. Let the agent build against them

    Give it the tests, the constraints and the file scope. Ask it not to change the tests.

    Checkpoint Tests pass.

  5. Read the whole diff

    Not the summary. The diff. Look for files you did not expect, dependencies you did not ask for and error handling that is missing.

    Checkpoint You can explain every changed file.

  6. Try to break it yourself

    Empty input, very long input, the wrong type, a double submission. Tests cover what you thought of; this covers the rest.

    Checkpoint It fails gracefully rather than crashing.

  7. Deploy without secrets

    Confirm no key is in the code or the history. Deploy. Open it on another device.

    Checkpoint It works for someone else and no secret is in the repository.

The agent brief
On the current branch only.

Goal: make the three failing tests in tests/events.test.js pass. Do not modify the tests.

Constraints:
- work only in src/
- no new dependencies
- vanilla JavaScript, no framework
- the UI must be keyboard operable and work at 320px

When you are done: show me the complete diff, list anything you did not handle, and name the riskiest line you wrote.

What finished looks like

A small repository with a working page, three passing tests and a diff you have read. It should be unimpressive and correct.

Test criteria

  • All three tests pass, and fail again when you deliberately break the behaviour.
  • No dependency was added.
  • Keyboard operable end to end.
  • No secret in the code or in git history.

If it goes wrong

Tests pass but the app does not work.
The tests assert implementation rather than behaviour. Rewrite them around what a user gets.
The agent added a framework.
Constrain dependencies explicitly and revert. This is why you are on a branch.
A key ended up committed.
Rotate it. Removing the file does not remove it from history.

Privacy and safety

If the app stores anything about a person you have data-protection duties from the first user. Browser-local storage avoids most of them, which is a good reason to start there.

Sources3 referenced
  1. Claude Code documentation

    Anthropic · official product documentation · link checked 2026-09-06

  2. Guidelines for secure AI system development

    National Cyber Security Centre · security guidance · link checked 2026-09-06

  3. Web Content Accessibility Guidelines 2.2

    W3C · standard · link checked 2026-09-06

Links are checked at build time. If one has moved, tell us.

Read alongside

Next lab: Create a source-backed research workflow