Checkpoint
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
Full pipeline: validate the kit, then compile it into a prompt — and refuse to compile a broken kit, because a broken kit poisons every asset in the batch.
Write two functions.
validate_kit(kit) returns a list of problem strings, in this order:
"missing {field}"for each ofREQUIREDnot present in the kit (inREQUIREDorder)"banned list is empty"ifbannedexists but is[]
compile_prompt(kit, brief):
- if
validate_kitfound problems, return"REJECTED: "+ problems joined with"; " - otherwise return
f"{subject}, {medium}, featuring {motifs}, palette of {palette} --no {negatives}"where motifs =kit["motifs"]joined with", ", palette = the color names joined with", ", negatives =sorted(kit["banned"])joined with", ".
Expected output:
rooftop espresso bar at dusk, flat vector illustration, featuring halfmoon mark, steam lines, palette of terracotta, deep teal, off-white --no gradients, neon, stock-photo smiles
hands cupping a warm mug, risograph print, featuring halfmoon mark, steam lines, palette of terracotta, deep teal, off-white --no gradients, neon, stock-photo smiles
REJECTED: missing type; banned list is empty