promptdojo_
Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Final drill. Synthesize the 5-knob rubric into one function: score_prompts(prompts) that takes a list of prompt-audit dicts and returns a list of tuples sorted by score descending.

Each input dict has six fields:

  • name: string (an identifier for the prompt)
  • has_role: bool
  • has_task: bool
  • has_context: bool
  • has_format: bool
  • has_examples: bool

Score each prompt: every present knob adds 20 points (max 100).

Return a list of tuples (name, score, missing) where missing is a list of the knob field names that are False, in this exact knob order: has_role, has_task, has_context, has_format, has_examples. Sort the returned list by score descending. On a tie, preserve the input order (Python's sort is stable).

Five prompts run. Expected output:

('support-triage-v1', 100, [])
('contract-summary-v2', 80, ['has_examples'])
('marketing-blurb-draft', 60, ['has_context', 'has_examples'])
('deposition-summary-v0', 40, ['has_role', 'has_format', 'has_examples'])
('tell-me-everything', 20, ['has_role', 'has_context', 'has_format', 'has_examples'])

this step needs the editor

on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.

open this same url on a laptop to keep going today.