The average AI-assisted engineering task lives or dies by the prompt that drives it. Yet most teams still write prompts the same way they wrote them in 2023: copy-pasted, untested, and impossible to improve systematically.

Microsoft PromptKit flips that equation. It treats prompts as engineered artifacts — composable, version-controlled components that snap together into reliable, repeatable prompts for real engineering work.

The project ships 157 components across four pipelines, with adversarial audit workflows built into every stage. This is not a prompt library. It is an engineering discipline for the prompts that do your engineering.


What PromptKit Is

PromptKit is an open-source library of prompt building blocks from Microsoft's engineering teams. It covers the full lifecycle: bootstrapping specifications from existing code, evolving them under change, and maintaining them against drift.

The core insight is simple. A good prompt for code review is not just "review this code." It is a layered composition of:

  • Persona — who the LLM is (expertise, tone, constraints)
  • Protocol — how it must reason (systematic steps, guardrails)
  • Format — what the output looks like (structure, required sections)
  • Taxonomy — how findings are classified (severity, category labels)
  • Template — the task itself (specific instructions and inputs)

PromptKit provides each layer as independent, composable components. You do not write prompts. You assemble them.


The Component Library: 157 Components Across Five Layers

The library breaks into five composable layers:

Personas (15)

Each persona is a domain expert identity with defined expertise areas and behavioral constraints.

The 15 personas span software, hardware, and protocol engineering domains:

Software Engineering Personas

  • systems-engineer — memory management, concurrency, performance, debugging
  • software-architect — system design, API contracts, tradeoff analysis
  • security-auditor — vulnerability discovery, threat modeling, secure design
  • test-engineer — specification-driven test authoring, coverage analysis
  • implementation-engineer — spec-compliant code generation, requirement tracing

Hardware and Physical Engineering

  • electrical-engineer — power delivery, signal integrity, PCB design, schematic review
  • rf-engineer — link budget analysis, antenna design, signal integrity
  • mechanical-engineer — enclosure design, thermal analysis, tolerance stacks, DFM/DFA

Specialized Roles

  • protocol-architect — protocol design, evolution, formal specification, state machines
  • reverse-engineer — specification extraction from existing code and artifacts
  • specification-analyst — cross-document traceability, coverage analysis, drift detection
  • devops-engineer — CI/CD pipelines, release engineering, infrastructure-as-code
  • promptkit-contributor — PromptKit architecture, conventions, contribution guidance
  • workflow-arbiter — multi-agent workflow evaluation, livelock detection
  • embedded-firmware-engineer — boot sequences, OTA updates, flash management, power-fail-safe

The systems-engineer persona, used for code review tasks, tells the LLM it is a staff-level engineer who thinks in terms of boundaries and contracts, not just implementations. The security-auditor persona carries explicit threat modeling constraints and vulnerability classification requirements. Each persona encodes institutional knowledge about how a senior engineer in that role approaches a problem.

Protocols (56)

Protocols define systematic reasoning approaches and behavioral guardrails. They break into three categories:

Guardrails (5) — cross-cutting constraints that apply to every task:

  • anti-hallucination — prevents fabrication, enforces epistemic labeling (every claim must cite a source)
  • self-verification — quality gate requiring the LLM to verify its own output before finalizing
  • operational-constraints — scoping, tool usage, deterministic analysis, reproducibility
  • minimal-edit-discipline — minimal, type-preserving, encoding-safe code modifications
  • adversarial-falsification — self-falsification discipline (disprove findings before reporting)

Analysis Protocols (18) — domain and language-specific checks:

  • C memory safety, C++ best practices, Rust memory safety, thread safety
  • Security vulnerability analysis, Win32 API conventions, kernel correctness
  • Embedded firmware patterns, hardware schematic compliance, PCB layout review
  • RF link budget audit, simulation validation, BOM consistency
  • Compiler diagnostics, MSVC-Clang-GCC portability patterns

Reasoning Protocols (33) — systematic reasoning approaches:

  • Root cause analysis, requirements elicitation, iterative refinement
  • Traceability auditing, code compliance auditing, test compliance auditing
  • Invariant extraction, interface contract auditing, exhaustive path tracing
  • Protocol evolution, protocol conflict analysis, specification drift detection

The cpp-best-practices protocol encodes seven research-validated C++ review patterns. The research basis is cited: MSRC data showing 70% of security vulnerabilities are memory safety issues, Lu et al. research on atomicity and ordering violations, Bloch's work on API design impact. Every pattern has a documented research basis, not just a gut feeling about what matters.

Formats (24)

Formats define output structure. The investigation-report format requires sections for findings, root cause, evidence, and remediation guidance. The structured-findings format produces severity-classified, pattern-ID-tagged outputs. The requirements-doc format enforces specific section headers and traceability requirements. Each format is a contract between the template and its consumer — downstream templates in a pipeline know exactly what they will receive.

Taxonomies (5)

Taxonomies are classification schemes for findings. The kernel-defect-categories taxonomy defines K1 through K14 for OS kernel and driver defects — lock leaks, refcount imbalances, cleanup omissions, use-after-free, integer overflow, state machine races. The specification-drift taxonomy (D1–D16) classifies drift findings: untraced requirements, orphaned design decisions, assumption drift, constraint violations, illusory test coverage. Taxonomies make findings comparable and aggregatable across reviews.

Templates (71)

Templates are the task compositions. A template references a persona, one or more protocols, an optional taxonomy, and a format. The template is the actual work to be done — review this C++ code, investigate this bug, author this requirements document.

Templates declare input and output contracts so they can be chained. The output of one template becomes the input parameter of the next in a pipeline.


The Four Pipelines

PromptKit defines four complete engineering pipelines:

Document Lifecycle Pipeline

author-requirements-doc
  → author-design-doc
    → author-validation-plan
      → audit-traceability

Each template consumes the output of the previous one. Requirements feed design. Design feeds validation. The traceability audit at the end checks all three for gaps, contradictions, and drift.

Hardware Lifecycle Pipeline

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

Full circuit-to-manufacturing pipeline for electrical engineering teams. Separate parallel tracks for schematic and PCB layout with cross-review at each gate.

Protocol Engineering Pipeline

extract-rfc-requirements → evolve-protocol → author-protocol-validation → analyze-protocol-conflicts

Designed for RFC and internet-draft work. Extracts requirements from existing protocols, evolves them under change, derives validation specifications, and detects conflicts between protocol versions.

Engineering Workflow Pipeline (Five Internal Stages)

collaborate-requirements-change
  → generate-spec-changes
    → audit-spec-alignment
      → generate-implementation-changes
        → audit-implementation-alignment

Full incremental change workflow with adversarial alignment audits at specification and implementation stages.


Three Interactive Workflows: Bootstrap, Evolve, Maintain

The workflows form a domain-agnostic engineering lifecycle that works for software, hardware, mechanical, RF, and protocol engineering.

Bootstrap: spec-extraction-workflow

Scans any repository and extracts structured requirements, design, and validation specifications from existing code and artifacts. Produces PR-ready spec files from a greenfield codebase. Complements the engineering-workflow as the starting point for maintaining legacy code.

Entry point: Read and execute templates/spec-extraction-workflow.md

Evolve: engineering-workflow

Propagates a requirements change through specs and implementation. At each stage, adversarial alignment audits verify that design faithfully represents requirements, and that implementation faithfully represents design. This is the core incremental development workflow.

Entry point: Read and execute templates/engineering-workflow.md

Maintain: maintenance-workflow

Periodic drift detection. Finds where code and specs have diverged, then corrects both. Completes the lifecycle triad by catching drift before it compounds into technical debt.

Entry point: Read and execute templates/maintenance-workflow.md

Each workflow is interactive (mode: interactive) — it runs directly in the LLM session, guiding through structured phases with built-in challenge and verification steps.


Adversarial Audit Workflows

The adversarial audit is central to PromptKit's approach. It is not a passive review. It is an active falsification discipline.

The exhaustive-bug-hunt template enforces adversarial falsification at every finding. Before reporting anything, the LLM must answer: "Why is this NOT a false positive?" with specific code references explaining why existing cleanup, retry logic, or caller guarantees do not neutralize the issue. Findings that cannot survive this challenge are rejected and documented in a false-positive rejection log.

The audit-spec-alignment and audit-implementation-alignment templates in the engineering workflow apply the same logic at the specification and code levels. They verify that requirements, design, and implementation changes faithfully represent the user's intent at each propagation step. Gaps, contradictions, and assumption drift are flagged before they reach the next stage.

The audit-traceability template audits requirements, design, and validation documents against each other using the specification-drift taxonomy (D1–D16). It classifies findings as untraced requirements, orphaned design decisions, assumption drift, constraint violations, or illusory test coverage. Each finding includes document locations, evidence, severity, and remediation guidance.


What Assembled Prompts Look Like

A one-liner like "Review this C++ file for bugs" assembles into a ~2,500-word prompt through PromptKit. The review-cpp-code template composes:

  • The systems-engineer persona (staff-level, thinks in boundaries and contracts)
  • Five protocols: anti-hallucination, self-verification, operational-constraints, cpp-best-practices, memory-safety-c
  • A format specifying investigation-report output with severity classification

The cpp-best-practices protocol adds seven research-validated patterns to check systematically. The memory-safety-c protocol adds a 4-phase analysis: allocation pairing, pointer lifecycle, buffer boundaries, undefined behavior.

The self-verification protocol requires sampling 3-5 findings and re-verifying them against the source before finalizing. Zero uncited claims are allowed.

The output is a structured investigation report where every finding is tied to a named, research-backed pattern, with specific code locations and fix suggestions.


Getting Started

Interactive mode (auto-detects your LLM CLI):

npx @alan-jowett/promptkit

List all components:

npx @alan-jowett/promptkit list --all

Search by keyword:

npx @alan-jowett/promptkit search "memory safety"

Show component details:

npx @alan-jowett/promptkit show review-cpp-code

Direct assembly:

npx @alan-jowett/promptkit assemble review-cpp-code \
  -p code="$(cat myfile.cpp)" \
  -p review_focus="memory safety and portability" \
  -p context="Network buffer parser" \
  -p additional_protocols="msvc-clang-portability, thread-safety" \
  -p audience="the code author" \
  -o review-prompt.md

Clone the repo for Copilot integration:

git clone https://github.com/microsoft/promptkit.git
cd promptkit
copilot

The /promptkit skill activates automatically, reads the manifest, and presents available templates.


What This Replaces

Most teams are running ad-hoc prompts that produce meandering lists of observations. PromptKit prompts produce structured investigation reports where every finding is tied to a named pattern with a research basis, and the LLM has verified its own work before presenting it.

The difference is not cosmetic. The difference is whether you can trust the output.

PromptKit encodes the expertise of senior engineers who have done these tasks hundreds of times — the patterns they check, the mistakes they avoid, the structure they report in. You get that expertise every time, consistently, without the senior engineer being in the room.

The project is MIT licensed at github.com/microsoft/promptkit.


PromptKit is distinct from Microsoft's Semantic Kernel project. It is a prompt engineering library, not an AI application framework. The 157 components are building blocks for assembling reliable prompts, not a runtime for executing AI tasks.