Code Literacy

Unit 8 · Vibe coding with guardrails

How to write an AI coding prompt like a spec

An AI tool only sees the words you typed and fills every gap with the most common answer. Write the prompt as a short specification: the goal, who uses it, the inputs, the limits, and how you will know it is done.

The mix-up

What people often think

“"Modern and clean" is a clear design instruction.”

What the tutor says

Ask ten people what modern means and you get ten answers. The AI picks one at random. Name the colours, fonts or an example site instead.

If the AI gave you two different designs, how would you decide which one is "modern"?

How it works

“Modern and clean” means something different to everyone, so the tool picks one at random. Name the colours, fonts or an example site instead. “Whatever is best” hands decisions about your users, budget and deadline to a guess you never see.

Limits are some of the most useful lines. Without “no payments on this page”, an eager tool may add a checkout you never asked for. And do not count on it to stop and ask: most of the time it just builds.

Side by side

The mix-upExample
Make a modern sign-up page for my swim club.
Every important choice is left to a guess.
What worksExample
Goal: parents sign a child up for Saturday lessons.
Users: parents on phones.
Fields: parent name, email, child name, age (4 to 12).
Limits: no accounts, no payments, one page.
Done when: a valid form shows a thank-you, and age 3 or 13 is refused.
Goal, users, inputs, limits, done.

Close cousins of this mix-up

The tutor watches for these in the same lesson.

  • “The AI knows the best choice, so leaving it open is smart.”

    The AI does not know your users, your budget or your deadline. "Whatever is best" hands those decisions to a guess you never see.

  • “The AI understands what I mean even when I do not say it.”

    The AI only sees the words you typed. Everything you leave out, it fills with the most common answer, which may not be yours.

  • “Saying what not to do is extra detail, not part of the spec.”

    Limits are some of the most useful lines in a prompt. Without "no payment here", an eager AI may add a whole checkout you never asked for.

  • “If a prompt is unclear, the AI will stop and ask.”

    Some tools ask, most of the time they just build. Assume it will guess, and write the prompt so it does not have to.

Practise it with a tutor watching

A prompt is a specification

Turn a vague request into a prompt with a goal, users, inputs, limits and a clear test for done.

15 minutes See it Build it Break it Say it
Start the lesson

Free with an account. The first two units need no account.

© 2026 webfaCeMEdia. Code Literacy™ is a trademark of webfaCeMEdia.