Module 5 · Industrialization

Building a team prompt library

4 min read

When a team goes from one to fifty prompts, other problems appear: three competing versions of the same summary prompt, safety rules copy-pasted with variants, nobody knows which prompt powers which feature, and the company's model change becomes a months-long project. A team prompt library is the answer: a shared registry, reusable components, contribution rules and automatic checks. This lesson, which closes the course, brings everything together into an organization.

What the library contains

prompts/
├── extraction_bon_de_commande/
│   ├── v1.md
│   ├── v2.md
│   └── v3.md          ← la version en production est la plus récente (ou épinglée dans la config)
├── resume_email/
│   └── v1.md
└── agent_back_office/
    └── v1.md
promptfoo/
├── promptfooconfig.yaml   ← les évaluations, rejouées à chaque changement
└── tests.yaml
tests/
└── test_quill.py          ← les contrôles qui bloquent une contribution invalide

(The production version is the most recent one, or pinned in the configuration; the evaluations are replayed at every change; the tests block an invalid contribution.) Three levels of content:

LevelExampleRule
Feature promptsPurchase order extraction, email summaryAn owner, an evaluation set, a history
Shared componentsThe "content between tags = data" block (lesson 4.4), the tone charter, the report formatA single source; prompts include them instead of copying them
Starter templatesAgent prompt skeleton (lesson 4.3), extraction skeletonDocumented starting points, not in production as is

Contribution rules

  1. Every change goes through review, with the prompt diff (lesson 5.1) and before/after evaluation results (lesson 5.2).
  2. No version without measurement: the changelog cites the evaluation result on the prompt's test cases.
  3. The owner decides for their prompts; shared components have a cross-cutting owner (often the platform or security team).
  4. The target model is explicit: a prompt written for one model is not assumed to work with another.
  5. Sensitive data does not enter the library: no real customer documents in the examples or test cases without anonymization.

Automatic checks

Quill's tests show the checks to run on every contribution:

def test_registry_and_rendering(tmp_path):
    prompts = registry.all_prompts()
    assert {p.name for p in prompts} >= {"extraction_bon_de_commande", "resume_email"}
    p = registry.load("extraction_bon_de_commande")
    assert p.version == 3 and "{{" not in p.render(document="BC")
    with pytest.raises(ValueError):
        p.render()
CheckWhat it catches
Loading all promptsMissing headers, incomplete metadata, inconsistent variables
Rendering with dummy valuesUnsubstituted variables, broken braces
List of allowed modelsA prompt targeting a retired or unapproved model
Promptfoo evaluationA quality regression on the test cases
Prompt sizeA prompt exceeding the set token budget (cost, latency)

These checks run in continuous integration: a contribution that fails is not merged.

Changing models without breaking everything

The day the company changes models — a new generation, a different provider, a cheaper version —, the library proves its worth:

  1. List the prompts concerned, thanks to the model field.
  2. Replay each evaluation with the new model (Promptfoo: one more provider line).
  3. Adjust the prompts that regress, starting with those that matter most. Typical gaps from one model to another: sensitivity to injunctions, verbosity, format compliance, API features (prefilling, sampling parameters, structured outputs).
  4. Publish new versions, with the new model in the metadata and the evaluation result in the changelog.

Without a library, this operation starts with a search for every string in the code that looks like a prompt.

The course in review

This course measured, on a small model that forgives nothing, the effect of each technique: format specification and examples (module 1), reasoning and its limits (module 2), information placement in a long context and caching (module 3), structured outputs, tools and injections (module 4), and industrialization (module 5). The common thread is the same everywhere: a prompt is a hypothesis, evaluation confirms or refutes it. Techniques change with models; the method — specify, measure, version, review — remains.

Key takeaways

  • A team library: feature prompts, shared components, starter templates, in a common registry.
  • Rules: review with diff and evaluation, no version without measurement, an owner, an explicit target model, no sensitive data.
  • Automatic checks in continuous integration: loading, rendering, allowed models, evaluation, token budget.
  • Changing models becomes a controlled operation: list, replay, adjust, publish.
  • A prompt is a hypothesis: evaluation confirms or refutes it.

Practice

  1. Inventory the prompts of your application and store them in a registry with their metadata.
  2. Identify a component repeated across several prompts (safety rule, tone) and factor it out.
  3. Add a budget check to your tests: no rendered prompt may exceed a set number of tokens.

Resources