Your bug investigation prompt is a copy-paste from a Slack thread. Your design review prompt is a half-remembered system message from a blog post you read six months ago. When the model changes, when the task shifts, when a new teammate joins, you rewrite everything from scratch. No version control. No tests. No reuse.

Microsoft PromptKit exists to fix this. It is not another prompt library. It is a framework that treats prompts as composable, version-controlled engineering artifacts. Personas, protocols, formats, taxonomies, and templates snap together into task-specific prompts that are reproducible, auditable, and maintainable.

Here is how it works for the two workflows that matter most to engineering teams: bug investigation and design review.

The Five Layers of a PromptKit Prompt

A PromptKit prompt is not a single text block. It is an assembly of five component types, each with a defined role and interface.

Personas define who the LLM is. The systems-engineer persona specifies a staff-level engineer who thinks in terms of boundaries, contracts, and research-backed patterns. The test-engineer persona focuses on spec-driven validation and coverage mapping. The electrical-engineer persona reasons about signal integrity and power budgets. Each persona is independent of task and format.

Protocols define how the LLM reasons. Anti-hallucination rules forbid fabricating code paths or inventing function behaviors. Self-verification requires sampling findings and re-checking them against source code. Adversarial-falsification forces the LLM to disprove every finding before reporting it. The cpp-best-practices protocol enumerates seven research-validated check patterns with specific citations. The compiler-diagnostics-cpp protocol provides exact resolution strategies for specific warnings.

Formats define what the output looks like. The structured-findings format requires severity-classified results with pattern IDs, code locations, evidence, and fix suggestions. The investigation-report format mandates a summary, methodology, findings, and confidence assessment. The exhaustive-review-report format adds per-file coverage ledgers and falsification proofs.

Taxonomies define how findings get classified. The kernel-defect-categories taxonomy lists 14 defect classes (K1 through K14) for OS kernel and driver code. The cpp-review-patterns taxonomy labels 19 patterns across 6 C++ review categories. The specification-drift taxonomy classifies 16 types of drift (D1 through D16) between requirements, design, and validation documents. These give the LLM a precise vocabulary so findings are comparable across sessions.

Templates define the task itself. Each template composes a persona, one or more protocols, an optional taxonomy, and a format into a complete task prompt. Templates also declare input and output contracts. The output of one template becomes the input to the next. This is how PromptKit builds pipelines.

Bug Investigation: From "Find Bugs" to Forensic Review

The difference between an ad hoc bug hunt and a PromptKit bug hunt is the difference between asking a colleague to "look at this" and handing a forensic analyst a structured protocol.

The Exhaustive Bug Hunt Template

The exhaustive-bug-hunt template is PromptKit's most rigorous review mode. It composes four protocols and one taxonomy into a ~4,000-word prompt.

The systems-engineer persona sets the expertise baseline. The LLM is a staff-level systems engineer with deep knowledge of memory management, concurrency, and kernel internals.

The adversarial-falsification protocol is the critical addition. It requires the LLM to try to disprove every finding before reporting it. For each candidate bug, the LLM must answer: "Why is this NOT a false positive?" It must reference specific code showing that existing cleanup, retry logic, or caller guarantees do not neutralize the issue. If the LLM can disprove the finding, it documents the rejection with reasoning. If it cannot, it reports the finding with the falsification attempt included.

The exhaustive-path-tracing protocol gives every file a coverage ledger. The ledger tracks which code paths were traced, which were skipped, and why. High-risk functions (lock acquire, resource allocate, goto-cleanup, arithmetic on untrusted input) are identified and traced through every control flow path. This prevents the common failure mode where an LLM reviews the obvious paths and ignores the tricky ones.

The kernel-defect-categories taxonomy provides 14 specific defect classes. Lock leaks (K1). Reference count imbalances (K2). Cleanup omissions (K3). Use-after-free (K4). Integer overflow (K5). State machine races (K6). Double-free (K7). And seven more. Each class has specific patterns and risk descriptions. The LLM classifies every finding against this taxonomy.

The output follows the exhaustive-review-report format. Every file gets a coverage ledger. Every finding includes a falsification proof. Every rejected candidate is documented with the safety mechanism that made it a false positive.

The result is not a list of observations. It is a forensic report where every finding survived adversarial challenge, every file has a coverage proof, and the absence of a finding in a specific category is as informative as its presence.

The Investigate-Bug Template

For runtime bugs rather than static code review, the investigate-bug template uses a different composition. The systems-engineer persona pairs with the operational-constraints protocol, which enforces a mandatory execution protocol: read all instructions, analyze all context, discover all tests, integrate all context before generating output. This prevents the failure mode where the LLM starts suggesting fixes before it has read the full bug report.

The template produces an investigation-report with a structured methodology section, a findings section with confidence levels, and a recommendations section with risk-ranked options.

The Find-and-Fix-Bugs Template

When investigation turns to remediation, the find-and-fix-bugs template adds the minimal-edit-discipline protocol. This protocol forbids cosmetic changes, refactoring, or formatting shifts. Every fix must preserve types, encoding, and formatting. The template runs a build-verify-iterate loop: apply the fix, build, verify the build passes, and if it fails, roll back and try again. Progress tracking shows which bugs are fixed, which remain, and which failed remediation.

Design Review: From "What Do You Think?" to Structured Audit

Design reviews suffer from the same ad hoc decay as bug investigation. "Can you review this design doc?" produces a different quality of feedback every time. PromptKit fixes this by composing review prompts from the same component layers.

The C++ Code Review Template

The review-cpp-code template is the canonical example of PromptKit's power. You type "review this C++ file for bugs." PromptKit assembles a ~2,500-word prompt.

The systems-engineer persona sets the expertise level. The cpp-best-practices protocol enumerates seven research-backed patterns:

  • CPP-1: Memory Safety (RAII violations, raw new/delete, exception-unsafe code) — cites MSRC data showing 70% of security vulnerabilities are memory safety issues.
  • CPP-2: Concurrency (data races, deadlocks, atomicity violations) — cites Lu et al. showing 31% atomicity violations and 30% ordering violations.
  • CPP-3: API Design (type confusion, ownership ambiguity) — cites Joshua Bloch's design principles.
  • CPP-4: Performance (O(n²) algorithms, cache-hostile access) — cites Hennessy & Patterson.
  • CPP-5: Error Handling (unchecked returns, exception-unsafe paths) — cites Weimer & Necula.
  • CPP-6: Code Clarity (magic numbers, misleading names) — cites Kemerer & Slaughter.
  • CPP-7: Testing (happy-path-only tests, missing edge cases) — cites Kuhn et al.

The memory-safety-c protocol adds a four-phase analysis: allocation pairing, pointer lifecycle, buffer boundaries, and undefined behavior.

The anti-hallucination protocol forbids fabricating code paths, inventing function behaviors, commenting on style preferences, or refactoring code.

The self-verification protocol requires the LLM to sample 3 to 5 findings and re-verify them against the source before finalizing. Zero uncited claims.

The output follows the structured-findings format: severity-classified results with pattern IDs, code locations, evidence, and specific fix suggestions.

Your one-liner prompt produces a meandering list of observations. PromptKit's assembled prompt produces a structured investigation report where every finding is tied to a named, research-backed pattern, and the LLM has verified its own work.

The Schematic Review Template

For hardware design review, the review-schematic template uses the electrical-engineer persona and pairs it with the link-budget-audit and component-selection-audit protocols. The component-selection-audit protocol catches hallucinated part numbers, stale specification sheets, and sourcing errors. The review produces a structured report with component-level findings, each classified by risk category and verified against the selected fab house's requirements.

The Traceability Audit Template

The audit-traceability template reviews the alignment between three documents: requirements, design, and validation. It uses the specification-drift taxonomy (D1 through D16) to classify every gap. Untraced requirements (D1). Orphaned design decisions (D4). Assumption drift (D7). Constraint violations (D9). Illusory test coverage (D12). Each finding comes with a severity, a classification label, and remediation guidance.

This template is useful even if you never use PromptKit for anything else. Paste your three documents into the audit and find out how much silent drift has accumulated.

The Three Workflows That Cover the Lifecycle

Composition handles the structure of individual prompts. The three workflows handle the lifecycle of prompt-based work.

Bootstrap. The spec-extraction-workflow scans any repository and extracts structured requirements, design, and validation specifications from existing code, docs, tests, and CI configuration. You get structured specs even if you never had them. This is the starting point.

Evolve. The engineering-workflow propagates a requirements change through specs and implementation with adversarial alignment audits at each stage. Change a requirement. Walk it through the design doc, the validation plan, and the code. At each stage, run an adversarial audit that challenges whether the change landed correctly.

Maintain. The maintenance-workflow runs periodic drift detection. It finds where code and specs have diverged, then corrects both. When drift is detected, the cycle loops back to bootstrap.

These workflows are interactive. They run directly in your LLM session with built-in challenge and verification steps. You do not just get a drift report. You get a structured workflow that walks you through each divergence, challenges the findings, and proposes corrections.

Why Composability Matters for These Workflows

Three practical problems disappear when you decompose prompts into components.

Reuse. A well-tested persona component serves dozens of templates. The systems-engineer persona works for code review, bug investigation, test planning, and protocol analysis. Without decomposition, every prompt is a one-off.

Isolation. When a prompt fails, you need to know which part failed. In a monolithic prompt, debugging means reading through hundreds of lines of text. In a composed prompt, you test each component independently and pinpoint the failure. If the cpp-best-practices protocol produces wrong pattern IDs, you fix the protocol. You do not rewrite every template that uses it.

Governance. Compliance teams cannot review 500 monolithic prompts. They can review 15 personas, a handful of protocols, and a dozen formats. Component boundaries create natural review checkpoints.

Getting Started

PromptKit runs with any LLM. No Azure dependency. No OpenAI lock-in.

Install Node.js 18+, then run:

npx @alan-jowett/promptkit

This launches an interactive session. Describe your task. PromptKit selects the components and assembles the prompt.

Browse the catalog:

npx @alan-jowett/promptkit list --all
npx @alan-jowett/promptkit search "memory safety"
npx @alan-jowett/promptkit show review-cpp-code

For scripted use:

npx @alan-jowett/promptkit assemble review-cpp-code \
  -p code="$(cat myfile.cpp)" \
  -p review_focus="memory safety and concurrency" \
  -p context="Network buffer parser" \
  -o review-prompt.md

If your LLM does not support CLI skills, copy the bootstrap prompt and manifest into a chat session. The LLM reads the manifest, understands which components to compose, and assembles the prompt.

The Bottom Line

Most teams treat prompts like scripts: write once, pray it works, copy-paste when it breaks. PromptKit treats prompts like code: composable, versioned, tested, and maintained across a full lifecycle.

For bug investigation, this means forensic reports where every finding survived adversarial challenge and every file has a coverage proof. For design review, this means structured audits tied to research-backed patterns with self-verification built in.

The era of pasting prompts into notebooks and hoping for the best is ending. PromptKit is one signpost. The direction is clear.


Citations

Suggested Title

Microsoft PromptKit: Composable Prompts That Actually Work for Bug Investigation and Design Review

Word Count

2,147