Prompts are the most important code most teams aren't engineering. That's the premise of PromptKit, a new open-source library from Microsoft that treats LLM prompts as version-controlled, composable artifacts rather than ad hoc text blobs you copy-paste between sessions.

The repo is at github.com/microsoft/PromptKit, currently at v0.6.0 under the MIT license. It ships 157 components across four pipelines and five layers — personas, protocols, formats, taxonomies, and templates — that snap together into complete, repeatable prompts. It includes three interactive workflows for the full engineering lifecycle: bootstrapping specs from a codebase, evolving them under change, and detecting drift before it becomes debt.

This is not another prompt-templates repo. PromptKit is an attempt to bring software engineering rigor to the layer between your intentions and the LLM's output. Whether it succeeds depends on how seriously you take that layer — and after looking at what it does, you might take it more seriously.

The Problem PromptKit Addresses

Every team using LLMs in a engineering workflow has the same set of problems, whether they recognize them or not:

Inconsistency. Two engineers ask the same LLM to review code. One gets a surface-level pass. The other gets a deep structural analysis. Not because the LLM is inconsistent — because the prompts are.

No version control. Prompts live in Slack messages, Notion docs, and shell history. When a prompt produces good results, nobody can reproduce it. When it produces bad results, nobody can diff against the last known-good version.

No composability. The reasoning you want for a C++ code review overlaps heavily with the reasoning for a security audit — but you rewrite it from scratch each time.

No drift detection. Specifications evolve. Requirements get added. Design docs get stale. Tests verify the wrong criteria. Nobody notices until something breaks in production, and even then, the root cause is often a specification that drifted from reality months ago.

PromptKit addresses all four. The first three are standard software engineering concerns applied to prompts — composability, versioning, reuse. The fourth is more interesting and more ambitious: it uses the LLM itself to audit whether your specifications, design, and tests have diverged from each other, and it classifies that divergence with a precise taxonomy.

The Architecture: Five Layers

PromptKit organizes its components into five composable layers:

Personas (15 components)

Personas define who the LLM is — its expertise, tone, and behavioral constraints. A systems-engineer persona thinks in terms of boundaries and contracts. A security-auditor persona thinks in threat models. A specification-analyst is adversarial toward completeness claims and systematic rather than impressionistic.

The key design choice: personas are not just flavor text. They encode behavioral constraints that change what the LLM prioritizes and how it reasons. The specification-analyst persona, for instance, is explicitly skeptical of claims like "all requirements are covered" — it will verify, not assume.

Protocols (48 components)

Protocols are the reasoning layer — how the LLM should think, not just who it is. They come in three categories: guardrails, analysis, and reasoning.

The guardrail protocols are the most immediately useful. anti-hallucination prevents the LLM from fabricating code paths or function behaviors. self-verification requires the LLM to sample its own findings and re-verify them against source material before finalizing. operational-constraints tells the LLM what not to do — don't refactor code during a review, don't comment on style preferences, don't invent APIs.

The analysis and reasoning protocols encode domain-specific methodology. traceability-audit implements a six-phase cross-document verification methodology: artifact inventory, forward traceability, backward traceability, cross-document consistency, classification, and coverage summary. cpp-best-practices brings seven research-validated patterns for C++ review — memory safety (CPP-1), concurrency (CPP-2), API design (CPP-3), performance (CPP-4), error handling (CPP-5), code clarity (CPP-6), and testing (CPP-7) — each tied to specific research citations.

The research grounding matters. When the memory-safety-c protocol tells the LLM to check for RAII violations and raw new/delete, it's not a hunch — it references Microsoft Security Response Center data showing 70% of security vulnerabilities are memory safety issues. The LLM isn't just checking for bugs; it's checking for the bugs that matter, in the order they matter.

Formats (21 components)

Formats define output structure. investigation-report produces severity-classified findings with pattern IDs, code locations, evidence, and fix suggestions. structured-findings produces categorized results suitable for machine consumption. requirements-doc produces a structured requirements document.

This seems simple, but it solves a real problem: without format constraints, LLMs produce narrative prose when you need structured data, and structured data when you need narrative explanation. Making the output format explicit and composable means the same reasoning protocol can feed into different consumption pipelines — a human-readable report for the engineering team, a structured findings file for a CI system.

Taxonomies (5 components)

Taxonomies are classification schemes that give the LLM precise categories for findings. The specification-drift taxonomy (D1–D16) classifies every finding into a specific drift type — untraced requirement, untested requirement, orphaned design, orphaned test, assumption drift, constraint violation, acceptance mismatch, and more. The kernel-defect-categories taxonomy (K1–K14) classifies kernel bugs into lock leaks, refcount imbalances, use-after-free, and so on.

The value of taxonomies is precision. Without them, an LLM might say "the design seems incomplete for BLE." With the D1–D7 taxonomy, it says "14 BLE pairing relay requirements (MD-0400–MD-0414) have zero representation in the design document — this is D1 (Untraced requirement)." The remediation path is immediately clear: add a BLE module to the design document. A D6 finding (constraint violation — design contradicts a requirement) has a different remediation entirely: fix the design.

Templates (64 components)

Templates compose the other four layers into task-specific prompts. A review-cpp-code template pulls in the systems-engineer persona, the anti-hallucination, self-verification, operational-constraints, cpp-best-practices, and memory-safety-c protocols, and produces a ~2,500-word assembled prompt. A fix-compiler-warnings template adds minimal-edit-discipline and compiler-diagnostics-cpp to enforce surgical fixes with specific resolution rules.

Templates declare input and output contracts, which means they can be chained. The output of author-requirements-doc becomes the input to author-design-doc, which becomes the input to author-validation-plan, which feeds into audit-traceability. Four templates, four stages, one pipeline — and each stage's output is structured enough for the next stage to consume mechanically.

The Three Workflows

The component architecture is the library. The workflows are how you use it.

Bootstrap: Spec Extraction

The first workflow scans a repository and extracts structured requirements, design, and validation specifications from existing code and artifacts. You point it at a codebase, and it reverse-engineers what the system does, what it's supposed to do, and how to verify both. The reverse-engineer-requirements template and spec-extraction-workflow template handle this.

This is the entry point for teams that have code but no specifications — which is most teams. The workflow produces three documents: a requirements document, a design document, and a validation plan. These become the inputs to the next two workflows.

Evolve: Change Propagation with Adversarial Audits

The second workflow propagates a requirements change through specifications and implementation, with adversarial alignment audits at each stage. It's the engineering-workflow template, and it runs in five internal stages:

  1. Collaborate on a requirements change
  2. Generate spec changes
  3. Audit spec alignment (adversarial — the LLM actively tries to find gaps)
  4. Generate implementation changes
  5. Audit implementation alignment (adversarial again)

The adversarial audits are the critical piece. Instead of passively checking whether changes look correct, the LLM is instructed to falsify — to find reasons why the changes might be wrong, incomplete, or inconsistent. This is the adversarial-falsification protocol, and it requires the LLM to answer "why this is NOT a false positive" for every finding, with specific code references explaining why existing safeguards don't neutralize the issue.

Maintain: Drift Detection

The third workflow is where PromptKit distinguishes itself from every other prompt library I've seen. The maintenance-workflow does periodic drift detection — it finds where code and specs have diverged, then corrects both.

The drift detection is built on the audit-traceability template, which composes the specification-analyst persona, the traceability-audit protocol, the specification-drift taxonomy, and the investigation-report format. You feed it three documents — requirements, design, and validation plan — and it runs a six-phase audit:

  1. Artifact inventory — catalog every identifier across all three documents
  2. Forward traceability — verify every requirement appears in design and tests
  3. Backward traceability — verify every design section and test traces to a requirement
  4. Cross-document consistency — check that assumptions haven't diverged
  5. Classification — categorize every finding using the D1–D16 taxonomy
  6. Coverage summary — produce a severity-classified report

The taxonomy is what makes this work. Without precise categories, drift detection produces vague observations. With it, every finding is actionable:

  • D1 (Untraced requirement): Add a design section for this requirement
  • D2 (Untested requirement): Write a test case for this requirement
  • D3 (Orphaned design): Either add a requirement for this design decision or remove it
  • D6 (Constraint violation): The design contradicts this requirement — fix the design
  • D7 (Acceptance mismatch): The test claims to verify one criterion but actually verifies another — fix the test

The Sonde Case Study: What This Looks Like in Practice

PromptKit includes a case study from the Sonde project — a programmable runtime for distributed sensor nodes running BPF bytecode on ESP32 microcontrollers. The project had 250+ requirements across five components, each with formal requirements, design, and validation documents.

The team suspected their design documents hadn't kept pace with expanded requirements (BLE pairing had been added across all components), but manually cross-checking 250+ requirements across 15 documents was impractical.

They assembled the audit-traceability prompt once and reused it across all five components, changing only the input documents. Results:

Component Requirements Reqs → Design Reqs → Tests Findings Critical/High
Modem 31 51.6% 93.5% 13 3
Node 57 68.4% 93.0% 11 0
Gateway 76 70% 93% 7 2
BLE Tool 55 100% 89.7% 15 2
Protocol 41 ~85% 67% 14 0

60 findings across 260 requirements. The striking pattern: all three of the modem, node, and gateway audits independently flagged the same root cause — BLE pairing requirements were added after the design documents were finalized, and the design docs were never updated. The modem design had no BLE module at all, meaning 45% of its active requirements had zero design guidance. The gateway was missing 30% of its requirements from the design. A manual reviewer might have noticed the design felt incomplete. They would not have systematically identified exactly 55 affected requirements, nor distinguished between requirements merely omitted from the design (D1) and requirements actively contradicted by it (D6).

The D1–D7 classification proved its value immediately. D1 says "add a design section." D6 says "fix the design." D7 says "fix the test." These are different actions with different costs and different urgency. The taxonomy turns vague unease into specific, prioritized remediation.

The drift types found:

Drift Type Count Description
D1 (Untraced requirement) 12 Requirements not referenced in design
D2 (Untested requirement) 10 Requirements with no test case
D3 (Orphaned design) 7 Design decisions with no requirement
D5 (Assumption drift) 7 Cross-document assumption conflicts
D6 (Constraint violation) 3 Design contradicts a requirement
D7 (Acceptance mismatch) 9 Test doesn't verify linked criteria

Total estimated remediation: 10–15 hours. All findings were additive — no breaking changes required. The alternative, manual cross-referencing of 260 requirements across 15 documents, would have taken far longer and produced less precise results.

The Pipeline Architecture

Templates can be chained because they declare input and output contracts. PromptKit defines four complete pipelines:

Document Lifecycle: author-requirements-doc → author-design-doc → author-validation-plan → audit-traceability

Hardware Lifecycle: author-requirements-doc → design-schematic → review-schematic → validate-simulation → review-bom → design-pcb-layout → review-layout → emit-manufacturing-artifacts

Protocol Engineering: extract-rfc-requirements → evolve-protocol → author-protocol-validation → analyze-protocol-conflicts

Engineering Workflow: collaborate-requirements-change → generate-spec-changes → audit-spec-alignment → generate-implementation-changes → audit-implementation-alignment

Each arrow represents a template whose output feeds the next template's input. The same specification-analyst persona and traceability-audit protocol run unchanged across all five Sonde components — only the input documents change. This is what composability actually means: you solve the "how should the LLM reason?" question once, and reuse it everywhere.

Beyond Software Engineering

PromptKit covers more than software. The catalog includes domain-specific components for:

  • Hardware/Electrical Engineering: schematic review, BOM audit, PCB layout review, simulation validation, manufacturing artifact generation
  • Embedded Firmware: boot sequences, OTA updates, flash memory management, power-fail-safe operations
  • Protocol Engineering: RFC authoring, protocol evolution, conflict analysis, state machine validation
  • Mechanical Engineering: enclosure design review for thermal management, environmental protection, and manufacturing feasibility
  • RF Engineering: link budget audit, path loss model validation, regulatory compliance

The cross-domain applicability is not accidental. The compositional architecture means a systems-engineer persona and an anti-hallucination protocol work equally well for reviewing C++ code and auditing a PCB layout. The domain specificity comes from the analysis protocols and taxonomies — cpp-best-practices for software, schematic-review for hardware, link-budget-analysis for RF.

Practical Implications

PromptKit raises a question that the prompt engineering community has been circling around without directly answering: should prompts be engineered artifacts or text?

The ad hoc approach — write a prompt, test it, tweak it, paste it into Slack — treats prompts as informal instructions. PromptKit treats them as specifications with version control, compositional structure, and verification protocols. The Sonde case study is the argument for the latter: 60 findings across 260 requirements, with precise classifications that enable immediate remediation, produced by a single reusable prompt that cost minutes to assemble.

The drift detection workflow is the most novel contribution. Specification drift is a real engineering problem that gets worse as systems scale. Teams add requirements, extend designs, write tests, and over time, the three documents diverge. The standard practice is to notice this during a painful incident post-mortem. PromptKit's maintenance workflow makes drift detection a routine, automatable check — something you can run on a schedule, in CI, or whenever a requirements change lands.

The adversarial audit protocol is the second notable contribution. Instead of asking "does this look right?", it asks "prove this is wrong." This is the difference between verification and validation. A passive check confirms that things look consistent. An adversarial check actively searches for inconsistencies, contradictions, and gaps — and requires evidence before accepting a finding.

Limitations and Open Questions

PromptKit is v0.6.0. It's a library, not a platform. There's no hosted service, no web UI, no integration with project management tools. You run it via npx @alan-jowett/promptkit or by pasting files into an LLM session. The CLI provides assembly, search, and listing, but the actual execution happens in your LLM session of choice.

The 157 components are comprehensive for engineering domains but thin elsewhere. There are no components for data analysis, customer support, content creation, or the other domains where LLMs are heavily used. The architecture supports extension — you can add your own personas, protocols, and templates — but the out-of-the-box catalog is engineering-focused.

The drift detection depends on having structured specifications in the first place. If you don't have formal requirements documents with REQ-IDs, the traceability audit has nothing to trace. The bootstrap workflow can reverse-engineer specifications from code, but the quality of the audit depends on the quality of the input documents. Garbage in, garbage out still applies.

The taxonomies are specific to their domains. The D1–D7 specification-drift taxonomy covers requirement/design/test divergence well, but it's not clear how it generalizes to other kinds of drift — architectural drift, API drift, infrastructure-as-code drift. The K1–K14 kernel-defect taxonomy is excellent for OS-level code but doesn't cover, say, web application security patterns. Extending these taxonomies is non-trivial work that requires domain expertise.

The Bigger Picture

PromptKit's most interesting claim is implicit: that prompts should be engineered to the same standard as the code they help produce. Not just "write better prompts" — but treat prompts as a layer of the system with its own version control, compositional architecture, verification protocols, and drift detection.

This is a significant elevation of the prompt from a tool to an artifact. If you accept that premise, PromptKit is the most complete implementation of that idea I've seen. The compositional architecture means you're not maintaining 64 monolithic prompt strings — you're maintaining 157 focused components that compose into 64 templates, and any improvement to a protocol or persona automatically propagates to every template that uses it.

The drift detection workflow is the part that could change how teams operate. If you can run a specification audit as easily as running tests, specification maintenance stops being a quarterly dread and becomes a continuous practice. The Sonde case study found that 45% of one component's requirements had no design representation. That's the kind of gap that causes production incidents. Finding it before it causes an incident is the entire point.

The question is whether teams will invest the upfront effort in structured specifications. The bootstrap workflow reduces that cost, but it doesn't eliminate it. You still need to review and validate the bootstrapped specifications before they're useful as audit inputs. That's real work — work that many teams skip because the payoff isn't immediate.

PromptKit makes the case that the payoff is measurable and the cost is manageable. The Sonde audit took minutes to set up and produced 60 actionable findings with specific remediation paths across 260 requirements. The alternative — manual cross-referencing — would have taken longer and produced less precise results. Whether that's enough to change how teams operate remains to be seen. But the library is open, the approach is sound, and the case study is compelling.


PromptKit is available at github.com/microsoft/PromptKit under the MIT license. v0.6.0, 157 components, 4 pipelines, works with any LLM.