Skip to main content

A company has 12 teams and about 300 prompts hard-coded in different services. A small edit last month broke a customer-facing feature. Design a system for versioning, testing and rolling out prompts.

System design · Pro 1

Short answer

Treat prompts as versioned artefacts. Store each as a template with variables, model and settings, owner and history. Every change gets review and an automatic evaluation run against that prompt's test set. Roll out by environment and then to a share of traffic, log the prompt version on every request, and make rollback one step.

Deeper answer

Clarify who edits prompts (engineers only, or product and domain experts too), how fast changes must ship, and what audit rules apply.

Design: a registry where each prompt has an ID, immutable versions, variables with types, the model and parameters it was tested with, an owner, and a linked test set. A prompt and its model belong together, because the same text behaves differently on another model. A change opens a review, and CI runs the evaluation and compares with the current version. Labels such as staging and production point to versions. Services fetch by label with a local cache and a pinned fallback, so a registry outage does not stop the product. Rollout goes to a small share of traffic first, with online metrics, and rollback means moving the label back.

Trade-offs: prompts in code get the same review and deploy as code, which is safe but slow for non-engineers. A registry allows fast changes without a deploy, but needs its own gates or it becomes a way to skip review. Log the prompt version in every trace, so a quality drop can be tied to a change.

What a strong answer covers

Answer it out loud in the mock interview about 2.5 min

Follow-ups to expect

Common mistakes

Learn it

Regression tests for prompts

Practice System design questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.