promptdojo_

The design kit — brand bible and design tokens as structured data — step 10 of 10

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 of REQUIRED not present in the kit (in REQUIRED order)
  • "banned list is empty" if banned exists but is []

compile_prompt(kit, brief):

  • if validate_kit found 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

full-screen editor opens — close anytime to keep reading.