Design a prompt you can evaluate
State an observable outcome, identify the available inputs and show how you will decide that an answer is correct. Add examples when a name or term has more than one interpretation.
Give the model an observable contract
Imagine a shipping parser that receives strings like BX-003 and must preserve leading zeros. Asking for an ID parser leaves the crucial rule implicit. Provide the function signature, two valid input-output pairs, one invalid input and the required error behavior. A zero-shot prompt gives instructions without demonstrations; a few-shot prompt includes worked examples that exhibit the rule. Include a counterexample so that a model cannot satisfy the examples by always trimming punctuation.
Break a large change into explanation, plan, small edit and verification. Keep the relevant code and constraints near the request. When a later request concerns a different subsystem, replace stale examples or start a fresh chat. Compare outputs on the same fixtures, recording correctness separately from concision. A reusable prompt can capture the evaluation steps for the next maintainer.
A prompt for the parcel exercise might say: accept BX- followed by exactly three ASCII digits, return a Boolean and avoid coercing the suffix to an integer. State whether bx-003 is allowed. When a reviewer asks for a faster parser later, carry forward these constraints and test the same unseen cases.
Worked case 1
Try two prompts for a day/month parser. The first asks for a date parser. The second specifies that 04/05 means 4 May and asks for an error on 31/02.
Check your reasoning
Run both proposals on those fixtures and add an unseen one such as 13/04. Write the expected dates yourself before reading the responses. An implementation that passes the examples by swapping every field can still fail a boundary case.
Worked case 2
A request contains a 200-line unrelated build log and a one-line failing assertion.
Check your reasoning
Keep the assertion, the function it exercises, the actual input and expected output. Add a linked interface only if it resolves ambiguity. Irrelevant context makes competing explanations harder to evaluate.
Compare a prompt against a contract
Run this example with Python 3. Treat the cases as the contract for a parcel ID. Draft a no-example prompt for the same task, then a second prompt using only the first two examples. Reserve the last two cases for evaluation. You can compare answers on paper or with an approved assistant in a disposable workspace.
import re
def valid_parcel(text):
return re.fullmatch(r"BX-[0-9]{3}", text) is not None
cases = [("BX-003", True), ("BX-3", False),
("bx-003", False), ("BX-1234", False)]
for text, expected in cases:
assert valid_parcel(text) == expected
print("4 parcel cases passed")
Check your output
The printed count is four. Try a proposed implementation that converts the suffix to an integer and ignores its length. BX-3 should expose why the contract requires exactly three digits.
GitHub documentation · GH-300 skills outline
Related lesson in GitHub Foundations. Move a support conversation through issue and review.
Practice with the recording
A generated migration script mishandles empty values. What should a second prompt contain?
Check your reasoning
Provide the source and destination shapes, one example with an empty value, the expected result and the constraint on existing records. Ask for the smallest change and a test. Examples make the ambiguous case observable.
Current GH-300 course · 46:03 · Lionel Gurret · GH-300 Study Cram · 12:32
Apply the current exam objectives
Turn a working troubleshooting prompt into a reusable prompt file. Keep stable constraints and acceptance checks in the file. Pass the changing stack trace or failing test as task context. Start a fresh conversation to check that the prompt still works without the previous chat history.
Zero-shot and few-shot prompts
Write one request with a schema and acceptance rules. Then add two examples with different edge cases. Compare the outputs against a third, unseen case. Keep the validation independent of examples already shown to the model.
Design a prompt you can evaluate quiz
Answer 3 questions. Check each answer for an explanation.