The parts of a prompt
You will learn
What the four parts of a prompt are, and how a missing part shows up as a missing bit.
A prompt that works has four parts: a goal, the context the agent cannot see, the limits it must keep, and the check that tells you it is done. In prompt_parts.t27 each part is one bit of a number, so a prompt becomes a mask: the vague prompt Make it better is mask 0, a goal alone is mask 1, and a full prompt with all four parts is mask 15. The tests read the bits straight from the constants. The lesson plants one bug: give the check the same bit as the limit, and the four parts no longer add up to 15, so a test fails.
Try it
Open the widget and find the one prompt that is ready to run; then in the spec change CHECK from 8 to 4 and run the tests to see which one fails.
A prompt that works has a goal, context, limits and a check. Three prompts, from vague to full, and how many parts each carries. Vibecoding from zero, Prompting.
specs/vibecoding/prompt_parts.t27
// SPDX-License-Identifier: Apache-2.0
; Vibecoding, module Prompting, lesson 1: the parts of a prompt.
; A prompt that works names four parts: a goal, the context the agent cannot see, the limits
; it must keep, and the check that tells you it is done. Each part is one bit of a small number,
; so a prompt becomes a mask and "which parts are missing" becomes arithmetic.
module vibecoding_prompt_parts;
pub const GOAL : u8 = 1;
pub const CONTEXT : u8 = 2;
pub const LIMIT : u8 = 4;
pub const CHECK : u8 = 8;
pub const ALL_PARTS : u8 = 15;
; has_part asks one question: is this part present in the mask?
pub fn has_part(mask: u8, part: u8) -> bool {
return (mask / part) % 2 == 1;
}
; parts_in counts how many of the four parts a prompt carries.
pub fn parts_in(mask: u8) -> u8 {
var n : u8 = 0;
if (has_part(mask, GOAL)) { n = n + 1; }
if (has_part(mask, CONTEXT)) { n = n + 1; }
if (has_part(mask, LIMIT)) { n = n + 1; }
if (has_part(mask, CHECK)) { n = n + 1; }
return n;
}
; A prompt can be run when it says what to do and how to know it is done.
pub fn can_run(mask: u8) -> bool {
return has_part(mask, GOAL) and has_part(mask, CHECK);
}
; "Make it better" names nothing: mask 0. "Add a total line to the cart page" has a goal: mask 1.
; Add the cart file (context), "do not touch the price code" (limit) and "the test cart_total passes" (check): mask 15.
pub const VAGUE_PROMPT : u8 = 0;
pub const GOAL_ONLY : u8 = 1;
pub const FULL_PROMPT : u8 = 15;
; The tests read the same arithmetic straight from the constants: the site runner evaluates
; constants and expressions, so each assert spells out what has_part would answer.
test the_four_bits_do_not_overlap {
assert GOAL + CONTEXT + LIMIT + CHECK == ALL_PARTS;
assert CHECK == 8;
}
test a_vague_prompt_has_no_part {
assert 0 == (VAGUE_PROMPT / GOAL) % 2;
assert 0 == (VAGUE_PROMPT / CHECK) % 2;
}
test a_goal_alone_is_not_enough {
assert 1 == (GOAL_ONLY / GOAL) % 2;
assert 0 == (GOAL_ONLY / CHECK) % 2;
}
test a_full_prompt_has_all_four {
assert 1 == (FULL_PROMPT / GOAL) % 2;
assert 1 == (FULL_PROMPT / CONTEXT) % 2;
assert 1 == (FULL_PROMPT / LIMIT) % 2;
assert 1 == (FULL_PROMPT / CHECK) % 2;
assert FULL_PROMPT == ALL_PARTS;
}
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.