Projects & coding · Tutorial 02

Vibe coding: decide what needs to be tested

Use a small prototype to explore an idea, then define the checks it needs before anyone relies on it.

A taped cardboard prototype passes through an inspection rig and becomes a braced production mechanism.
Reading time
6 min
Last updated
November 2026

0 of 3 complete

Complete & next →

Essentials · Step 1 of 3 · View the route

Last checked and updated: November 27, 2026. Editorial and official-source review; exercises below are authored practice, not reported benchmark runs.

The easiest expense app to build is one that always displays 35.00. It can look perfect and still do no arithmetic. A useful brief tells you how to catch that before you spend an afternoon polishing the layout.

Your deliverable here is a one-page brief. No installation is needed yet.

Vibe coding versus AI-assisted coding

For this lesson, use a practical distinction: vibe coding means steering by what looks right while leaving the implementation largely unexamined. AI-assisted coding means using an agent to write code while taking responsibility for the requirements, changes, and checks. The same tool can support either habit.

I would happily explore a disposable layout by feel. For a calculation, I want an answer I worked out independently and a way to make the program fail if it gets that answer wrong. Typing every line yourself is not the dividing line; knowing why you trust the result is.

Pick one job, one input, one result

Use this practice project through the next two lessons: a local page that turns a small list of sample expenses into a total by category. Use fictional amounts. Leave accounts, payments, uploads, and public deployment out of the first version.

The useful question is: “Can I see where these sample expenses went?” That is specific enough to build and check.

If you already have a project, choose one equally narrow flow. “Build a finance platform” is too broad for a first task. “Group these four sample expenses by category” is small enough to inspect.

Decide how much checking the work needs

SituationUseful check
Exploring two layouts with fixed sample textOpen both layouts at phone and desktop widths and compare whether the information is easy to find.
Calculating totals from sample dataRecalculate the expected values independently and check the program against them.
Renaming a folder of real filesPreview the exact renames and try them on copies before changing the originals.
Building something people will rely onCheck the full user flow, failure cases, data handling, and recovery appropriate to that use.

How long the code lives is only one factor. A one-off script can destroy files in seconds. A throwaway prototype should still have limits appropriate to what it can touch.

Write the brief before adding features

Save this as SPEC.md, a plain text file written in Markdown:

Purpose: Show totals by category for a small set of fictional expenses.
User: Me, inspecting a local prototype.
Input: Four fixed sample rows, each with category and amount.
Output: A visible total for each category and a grand total.
Scope: One local page. No login, payment, upload, network calls, or deployment.
Checks:
- food 12.50 + food 7.50 gives food 20.00.
- travel 5.00 gives travel 5.00.
- supplies 10.00 gives supplies 10.00.
- Grand total is 35.00.
- Change only the food amounts to 1.25 and 2.75: food becomes 4.00,
  and the grand total becomes 19.00. Other categories stay unchanged.
- Empty input shows a useful empty state and total 0.00.
- A non-numeric amount shows an error; it is not silently counted as zero.

These are acceptance checks: observable conditions for deciding whether the result is ready for its intended use. You can give an agent this file and compare its work against it.

The changed-input check is the important extra step. A page with hard-coded totals can pass the first example; it cannot pass both examples without changing its output. These fictional expected values match the exercise in the build lesson.

Make an error requirement precise

“Reject bad data” still leaves decisions to the agent. Add these rules to your brief for this practice project:

  • A missing amount or a non-numeric amount identifies the affected row and blocks the total until corrected.
  • A blank category identifies the affected row and asks for a category.
  • A negative amount is rejected with an explanation that refunds are outside this prototype’s scope.
  • An empty list is valid: show an empty state and 0.00, rather than an error.

Those are product choices for this exercise, not universal accounting rules. If your own project needs refunds, define their expected effect before asking the agent to implement them.

Keep exploration separate from release decisions

It is reasonable to ask an agent for several visual options before you know what you want. Use fixed sample data and keep that experiment local. Once you choose an option, bring the checks back into the build.

A passing test is evidence about what the test covers. It is not a promise that every untested case works. For the expense example, inspect the page as well as the calculation: can a person find the grand total, read it on a phone, and understand an error?

Anthropic’s Claude Code guidance recommends giving the agent an executable check and reviewing the resulting evidence. The principle also applies when you use another coding tool.

Ask for evidence you can repeat

Once you reach the build lesson, give the agent this handoff alongside SPEC.md:

Keep the acceptance values in SPEC.md unchanged.
For each check, report the input, expected result, actual result,
and the command or manual steps used to check it.
Mark checks you could not run as NOT RUN, with the reason.
Review the changed files for additions outside the stated scope.
If a check fails, fix the implementation and rerun the affected checks.
Do not replace a calculated total with a fixed display value.

Keep the expected and actual columns separate. A copied requirement is not a test result. If the agent cannot open the page, a passing calculation test still leaves the visible error messages and phone layout for you to check.

When an attempted fix makes things worse, return to the last working copy or commit in your practice project, then describe one mismatch with its input and expected output. Save unfinished work separately before reverting anything. Smaller failures are easier to explain than a request to “fix everything.”

Your brief is ready when…

Someone else can read it and tell you the expected result without asking the AI. For this project, that means they can name the category totals, the grand total, and the required behavior for missing or invalid input.

If the brief still says “handle errors gracefully,” replace that phrase with an example of the error and what the person should see.

Next, set up a coding-agent session. Then build the expense summary and check it. You do not need to pick multiple models, install a team of agents, or buy hosting to complete the project.

Source and exercise scope

Anthropic: Best practices for Claude Code, checked November 27, 2026, supports providing runnable verification, asking for command/output evidence, and reviewing work against a written specification. The expense fixtures, error policy, and handoff above are authored teaching examples. No agent build or model comparison was run for this refresh.

Check your understanding

Q1.A script runs only once but renames important files. Does it need checking?
Q2.Which acceptance check is specific enough?
Q3.The sample expense list is empty. What should this prototype show?
Q4.Which first-project scope matches the lesson?