One small step per prompt
You will learn
Why a plan of small steps with a check each leaves one suspect when something fails.
A big request is a chain of small ones, and the agent can get any link wrong. In small_step.t27 a plan has five steps, and each ends with a check you run before the next prompt. The list PASSED holds 1 for a step whose check passed and 0 for one that did not: 1, 1, 0, 0, 0. The earliest zero is step 3, so step 3 is the single prompt to fix. One big prompt for all five steps leaves five suspects; one small step leaves one. The lesson plants one bug: say that step 4 was the earliest to fail, and the test that reads the list catches it.
Try it
In the diagram find the earliest step whose check failed; then in the spec change FIRST_FAILED from 3 to 4 and run the tests.
A plan of five steps with a check each: the first step that fails is the only prompt to fix. One big prompt leaves five suspects, a small step leaves one. Vibecoding from zero.
specs/vibecoding/small_step.t27
// SPDX-License-Identifier: Apache-2.0
; Vibecoding, module Prompting, lesson 3: one small step per prompt.
; A big request is a chain of small ones. Each step ends with a check you run before the next
; prompt. If a step fails, you know which one: the last. This spec lists a plan of five steps,
; says which steps passed, and finds the first one that did not.
module vibecoding_small_step;
pub const STEP_COUNT : u8 = 5;
; 1 means the step's check passed, 0 means it failed or was not run yet.
pub const PASSED : [5]u8 = [1, 1, 0, 0, 0];
; first_failed walks the plan in order and returns the number of the first step that did not pass.
; It returns STEP_COUNT + 1 when every step passed.
pub fn first_failed(a: u8, b: u8, c: u8, d: u8, e: u8) -> u8 {
if (a == 0) { return 1; }
if (b == 0) { return 2; }
if (c == 0) { return 3; }
if (d == 0) { return 4; }
if (e == 0) { return 5; }
return 6;
}
; The first failed step in the plan above is step 3: that is the only prompt to fix.
pub const FIRST_FAILED : u8 = 3;
; One big prompt for all five steps: when it fails, any of the five could be the cause.
pub const SUSPECTS_ONE_BIG_PROMPT : u8 = 5;
; One small step per prompt: only the step that just ran can be the cause.
pub const SUSPECTS_SMALL_STEP : u8 = 1;
test the_first_two_steps_passed {
assert PASSED[0] == 1;
assert PASSED[1] == 1;
}
test step_three_is_the_first_to_fail {
assert PASSED[FIRST_FAILED - 1] == 0;
assert PASSED[FIRST_FAILED - 2] == 1;
}
test a_small_step_leaves_one_suspect {
assert SUSPECTS_SMALL_STEP == 1;
assert SUSPECTS_ONE_BIG_PROMPT == STEP_COUNT;
assert SUSPECTS_SMALL_STEP < SUSPECTS_ONE_BIG_PROMPT;
}
test the_last_step_is_read {
assert PASSED[STEP_COUNT - 1] == 0;
}
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.