Claude Certification
Prompt Engineering & Structured Output
Lesson 6 · 5 min

Iterating Prompts Like Code

Version, test, and review prompts.

Store prompts in version control. Pair every prompt change with eval results. Treat prompt.md like schema.sql: production-critical, reviewable, rollback-able.

Production scenario

Real-world example: Prompts-as-code at a 50-person AI team

The team treats prompts the same way they treat database schemas:

  • Every prompt lives in prompts/*.md, version-controlled.
  • Every PR that changes a prompt runs the eval harness on 50 golden tasks.
  • A bot posts the diff: "success 78% → 82%, cost +12%, p95 latency stable."
  • Rollback is one revert away.

When prompt A's success drops below B's, the merge is blocked. When it improves and cost is acceptable, it merges and ships behind a feature flag.

Why this matters: prompts have production impact. Treat them with the rigor you'd give application code, including review, testing, and rollback.

Knowledge points in this lesson
  • Treat prompts like code: version them
  • Pair prompt changes with eval results
  • Rollback should be supported
  • Don't keep prompts in admin UI history-less
  • Review prompts like schemas
Quick check
Prompt EngineeringSelect one
Where should you place the HARDEST few-shot example?