Describe, run, check
You will learn
Vibecoding is a loop of three steps: you describe what you want, a program runs, and a check says yes or no.
Vibecoding means you describe what you want in plain words and an AI agent writes the program. Your part does not end there. You run it, and you check the result against your description, because a program can finish without an error and still be wrong. In the spec of this lesson a cafe tab is the number of drinks times the price of one drink: 3 drinks at 4 each is 12. A run that adds instead of multiplying prints 7, finishes cleanly, and is rejected by the check. The check is a test, and the test judges the result, not the person or the program that wrote it.
Try it
Open the spec in the player and run it: 3 tests pass. Then change RAN_TAB from 12 to 7 and run it again: the test the_run_matches_the_wish turns red. Put the 12 back.
A wish in plain words, a run that prints a number, and a check that says yes or no. A run that only looks fine is rejected. Lesson 1 of the vibecoding course.
specs/vibecoding/describe_run_check.t27
// SPDX-License-Identifier: Apache-2.0
; Vibecoding lesson 1: describe, run, check.
; You describe what you want, a program runs, and a test judges the result.
; The test is the part that does not take the program's word for it.
module vc_describe_run_check;
; 1. DESCRIBE: the wish, in plain words, written before any code.
pub const WISH : str = "A cafe tab is the number of drinks times the price of one drink. Change is the money paid minus the tab.";
pub const STEPS : [3]str = ["describe", "run", "check"];
; 2. RUN: the program an agent could write from that wish.
pub fn tab(drinks: u16, price: u16) -> u16 {
return drinks * price;
}
pub fn change(paid: u16, owed: u16) -> u16 {
return paid - owed;
}
; The inputs of one example, and what the run printed for tab(3, 4) and change(20, 12).
pub const DRINKS : u16 = 3;
pub const PRICE : u16 = 4;
pub const PAID : u16 = 20;
pub const RAN_TAB : u16 = 12;
pub const RAN_CHANGE : u16 = 8;
; A run that finishes without an error and is still wrong: the sum instead of the product.
pub const WRONG_RAN_TAB : u16 = 7;
; 3. CHECK: the test says yes or no against the wish, not against the program.
test the_run_matches_the_wish {
assert RAN_TAB == DRINKS * PRICE;
assert RAN_CHANGE == PAID - DRINKS * PRICE;
}
test the_check_rejects_a_run_that_only_looks_fine {
assert WRONG_RAN_TAB == DRINKS + PRICE;
assert WRONG_RAN_TAB != DRINKS * PRICE;
}
test three_steps_in_order {
assert STEPS[0] == "describe";
assert STEPS[1] == "run";
assert STEPS[2] == "check";
}
All lessons
Module 1 · What vibecoding is
You describe, an agent writes, you run it and check. What a program is, and five myths put to a test.
Module 2 · Your desk
An editor with an agent beside it, ten terminal commands, and reading an error message.
Module 3 · Save points with git
A commit is a save point, a branch is a safe try, and a key is a pair of which one stays private.
Module 4 · Prompting
The parts of a prompt, an example in place of an adjective, and one small step at a time.
Module 5 · The working loop
Four phases from idea to ship, the loop of ask, run, read and fix, and what to do when it is stuck.
Module 6 · A test as the judge
A test says yes or no, a planted bug shows the test works, and a diff is read before it is accepted.
Module 7 · The parts of an agent
What an agent answers with, what it can do with tools, and what it keeps between messages.
Module 8 · A first bot
A bot is a message loop, a bot comes from a spec, and a secret stays out of the repository and the prompt.
Module 9 · Your own project
A spec for your own idea, one thing measured after it runs, and an honest plan for the next month.