Part 2 | Practice — Building a profile page

Chapter 4. How to instruct AI, and how to get past errors

5 / 13

Key points

  • The three elements of a good instruction: what, what features and content, what it should look like
  • An error is not a failure; it is information saying "the problem is here"
  • When stuck, paste the error straight into the AI. That is the basic move

Vague instructions do not work

Applying the prompt technique from Foundations to coding. Take this instruction:

Build a profile page.

Short and simple, but the AI has nothing to work with. Just a name? Occupation and hobbies too? Plain? Bold? A page? An app? With no answers, the AI decides on your behalf, by imagination, and produces something off from what you wanted.


Three elements to include

Keep three things in mind. This is the practical form of "role, purpose, audience, output format" from Chapter 7 of Foundations.

1. What you are building. State the kind of thing plainly: a profile page, a website.

2. What features and content go in. Be concrete: "show name, occupation and hobbies", "a profile paragraph of about 120 words". Vagueness invites the AI to add features you did not want.

3. What it should look like. "Gentle feel, pastel palette." "Calm and businesslike." Say nothing about appearance and you get the safe, obviously-AI-made design. A single sentence changes the result completely.


An error is information, not a failure

Start building and you will hit errors. Red text appears, a button does nothing, the layout collapses. At that point many people conclude they are not cut out for this. So, one piece of preparation.

An error does not appear because you did something wrong. It is a sign telling you where the problem is.

Professional developers meet errors many times a day. What matters is not panicking. When red text appears, "good, a hint" is a perfectly reasonable reaction.


The basic move: paste it straight into the AI

The simplest and most effective response to an error is to paste the error message straight into the AI. It may be incomprehensible English; you do not need to read it. Let the AI read it.

I got the following error. Tell me the cause and how to fix it.

[paste the whole error message here]

When there is no error message (a button that does nothing, say), describe the situation in words. The trick is to write it as you would report to a person, with three specifics:

  • what you did (e.g. "when I pressed the submit button")
  • what happened (e.g. "the screen goes blank"; "it should have done this")
  • under what conditions (e.g. "only on a phone"; "every time")

This is structurally identical to the history-taking and case reporting a therapist already does. What was done, what happened, under what conditions. With that set of three, the AI grasps the situation accurately and the fix comes faster.

If it keeps making the same mistake: say "think about this a different way", ask a different AI tool, or take a break and look again tomorrow. The rule is do not carry it alone.


Chapter 4 summary

  • Three elements: what, what features and content, what it should look like
  • An error is information saying where the problem is; do not panic
  • Paste errors straight into the AI; describe situations as what you did / what happened / under what conditions

← Back to contents