prompt-engineer

Installation
SKILL.md

Prompt Engineer

Comprehensive prompt and context engineering. Every non-obvious recommendation must be evidence-scoped.

Canonical Vocabulary

Use these terms exactly throughout all modes:

Term Definition
system prompt The top-level instruction block sent before user messages; sets model behavior
context window The full token budget: system prompt + conversation history + tool results + retrieved docs
context engineering Designing the entire context window, not just the prompt text — write, select, compress, isolate
template A reusable prompt structure with variable slots ({{input}}, named placeholders, or runtime arguments)
rubric A scoring framework with dimensions, levels (1-5), and concrete examples per level
few-shot example An input/output pair included in the prompt to demonstrate desired behavior
chain-of-thought (CoT) Explicit step-by-step reasoning scaffolding; beneficial for instruction-following models, harmful for reasoning models
model class Either "instruction-following" or "reasoning" — determines which techniques apply
injection Untrusted input that manipulates model behavior outside intended boundaries
anti-pattern A prompt construction that reliably degrades output quality
over-specification Adding constraints past the point where they help; too much specificity can degrade output quality and flexibility
scorecard The 5-dimension diagnostic (Clarity, Completeness, Efficiency, Robustness, Model Fit) scored 1-5
playbook Model-family-specific guidance document in references/model-playbooks.md
prefix caching Cost optimization by placing static content early so API providers cache the prefix
trust boundary The separation between trusted instructions and untrusted user, tool, retrieved, or external content
evidence class Source type behind a recommendation: official docs, peer-reviewed/preprint, community heuristic, local practice, or single-study
PromptOps Versioning, evals, rollout checks, observability, and rollback discipline for prompts in production

Dispatch

$ARGUMENTS Action
craft <description> → Mode A: Craft a new prompt from scratch
analyze <prompt or path> → Mode B: Analyze and improve an existing prompt
audit <prompt or path> → Mode B: Analyze, report only (no changes)
convert <source-model> <target-model> <prompt or path> → Mode C: Convert between model families
evaluate <prompt or path> → Mode D: Build evaluation framework
harden <prompt or path> → Mode E: Security and robustness hardening
tool <tool definition or schema> → Mode F: Design or review model-facing tool definitions
promptops <prompt or path> → Mode G: Versioning, rollout, observability, and rollback plan
Raw prompt text (XML tags, role definitions, multi-section structure) → Auto-detect: Mode B (Analyze, report only)
Natural-language request describing desired behavior → Auto-detect: Mode A (Craft)
Empty / no args Show mode menu with examples

Auto-Detection Heuristic

If no explicit mode keyword is provided:

  1. If input mentions injection, jailbreaks, untrusted content, data leakage, tool abuse, or production robustness → Harden (Mode E)
  2. If input is a tool/function schema, MCP tool description, OpenAPI fragment, or asks for tool-selection guidance → Tool (Mode F)
  3. If input mentions prompt versions, eval gates, rollout, monitoring, regression, or rollback → PromptOps (Mode G)
  4. If input contains XML tags (<system>, <instructions>), role definitions (You are..., Act as...), instruction markers (## Instructions, ### Rules), or multi-section structure → existing prompt → Analyze, report only (Mode B)
  5. If input reads as a natural-language request describing desired behavior ("I need a prompt that...", "Create a system prompt for...") → new prompt request → Craft (Mode A)
  6. If the text mixes an existing prompt with a new-use-case request, or the input is malformed enough that prompt-vs-request is unclear, ask the user which mode they want before proceeding

Example Invocations

/prompt-engineer craft a system prompt for a RAG customer support agent on Claude
/prompt-engineer analyze ./prompts/system.md
/prompt-engineer audit <paste prompt here>
/prompt-engineer convert claude gemini ./prompts/system.md
/prompt-engineer evaluate ./prompts/agent-system.md
/prompt-engineer harden ./prompts/rag-system.md
/prompt-engineer tool ./tools/search-docs.json
/prompt-engineer promptops ./prompts/support-agent.md

Empty Arguments

When $ARGUMENTS is empty, present the mode menu:

Mode Command Purpose
Craft craft <description> Build a new prompt from scratch
Analyze analyze <prompt> Diagnose and improve an existing prompt
Analyze (report only) audit <prompt> Read-only review for anti-patterns and security
Convert convert <src> <tgt> <prompt> Port between model families
Evaluate evaluate <prompt> Build test suite and evaluation rubric
Harden harden <prompt> Stress-test trust boundaries, injection resistance, and safety
Tool tool <schema> Design or review model-facing tool definitions
PromptOps promptops <prompt> Plan versioning, rollout, monitoring, and rollback

Paste a prompt, describe what you need, or pick a mode above.

Core Principles

Non-negotiable constraints governing all modes. Violations are bugs.

Context engineering, not just prompting — Prompts are one piece of a larger context system. Consider the full context window: system prompt, conversation history, tool results, retrieved documents, and injected state. Most production failures are context failures, not prompt failures. Four pillars: Write the context, Select what to include, Compress to fit, Isolate when needed.

Model-class awareness — Instruction-following models and reasoning models respond differently to the same techniques. Techniques that help instruction-followers can hurt reasoning models in some tested settings, while provider guidance can change by model and reasoning mode. Always detect model class first and verify model-specific advice against references/model-playbooks.md.

Evidence-based recommendations — Cite specific sources for non-obvious claims. Do not present anecdotal patterns as established best practice. Distinguish between: verified research, official lab guidance, community consensus, and single-study findings. Read references/model-playbooks.md before making model-specific claims — verify against current documentation.

Empirical iteration — Prompts are hypotheses, not solutions. Every prompt needs testing against edge cases. The first draft is never the final version. Recommend eval frameworks for any non-trivial prompt.

Avoid over-specification — The Over-Specification Paradox (UCL, Jan 2026) is a useful heuristic, not a law. Once intent is clear, extra constraint language can reduce output quality or flexibility. Keep the task legible, trim redundant rules, and use the references for the numeric heuristic instead of hard-coding it into the default contract.

Model-Class Detection

Mandatory first step for all modes. Determine the target model class before any analysis or generation. This affects CoT strategy, scaffolding, example usage, and output structure recommendations.

Classification

Heuristic: If the model has a native reasoning/thinking mode → Reasoning. Otherwise → Instruction-following. When uncertain → default to instruction-following (broadest compatibility).

Reasoning: Claude with extended thinking, GPT-5.5/GPT-5.x reasoning modes, Gemini thinking modes, o-series models, Llama reasoning variants Instruction-following: Claude 3.5 Sonnet/Haiku, GPT-4o/4.1, Gemini 2 Flash, Llama 4 standard

Model-Class Behavioral Differences

Dimension Instruction-Following Reasoning
Chain-of-thought Use concise reasoning scaffolding when it improves reliability Do not require hidden reasoning transcripts; use provider-supported reasoning effort or short planning/preambles when current docs recommend them
Few-shot examples Highly beneficial — provide 3-5 diverse examples Minimal benefit — 1 example for format only, or zero-shot
Scaffolding More structure improves output Excessive structure constrains reasoning — provide goals, not steps
Prompt length Longer prompts with details generally help Concise prompts with clear objectives outperform verbose ones
Temperature Task-dependent (0.0-1.0) Often fixed internally; external temp has less effect

Shared Preflight

Use this preflight for every mode before entering the mode-specific workflow.

  1. Ingest — Read the prompt from $ARGUMENTS text or file path. If a file path is provided, read the file.
  2. Model-class detection — Detect the target model from prompt content or ask the user. Run Model-Class Detection above. Flag any model-class mismatches (e.g., CoT scaffolding sent to a reasoning model).
  3. Context identification — Determine deployment context (single-turn API, chat, agent loop, RAG pipeline, multi-agent) and input trust level (trusted internal vs. untrusted external).
  4. Context-management trigger — If the work involves multi-turn, long-context, RAG, agent-loop, or cost-sensitive prompting, read references/context-management.md and surface the relevant caching, compaction, selection, or isolation decisions explicitly in the result.
  5. Evidence-class check — Classify non-obvious recommendations as official docs, peer-reviewed/preprint, community heuristic, local practice, or single-study; flag any provider recommendation older than 90 days for verification.
  6. Scope check — If the user is asking to run prompts, build agents, or perform non-prompt implementation work, refuse and redirect before doing prompt analysis or generation.

Mode A: Craft

Build a new prompt from scratch. For when the user has no existing prompt.

Craft Workflow

  1. Run Shared Preflight — Complete the shared preflight above, including scope and trust-boundary checks.

  2. Requirements gathering — Ask targeted questions:

    • What is the task? (Be specific — "summarize" is different from "extract key decisions")
    • Who is the target model? (Detect model class)
    • What is the deployment context? (Single-turn API call, chat, agent loop, RAG pipeline, task delegation / research service)
    • What format should the output take?
    • What are the failure modes to prevent?
    • Who provides the input? (Trusted internal vs. untrusted external — determines security needs)
  3. Architecture selection — Based on deployment context, select from references/architecture-patterns.md:

    • Single-turn: 4-block pattern (Context/Task/Constraints/Output)
    • Multi-turn: Conversation-aware with state management
    • Agent: ReAct with 3-instruction pattern (persistence + tool-calling + planning)
    • RAG: Grounding instructions with citation patterns
    • Multi-agent: Orchestration with role isolation
    • Task delegation: 4-block pattern with emphasis on scope definition and output structure
  4. Context-management check — If the prompt is multi-turn, long-context, RAG, agent-loop, or cost-sensitive, read references/context-management.md and decide what should be cached, compacted, selected, or isolated.

  5. Draft prompt — Write the prompt using the selected architecture. Apply model-class-specific guidance from references/model-playbooks.md. Use XML tags as a default starting point for multi-section prompts unless the target model or output contract suggests a better structure. After drafting, review against the target model's playbook section for final adjustments.

  6. Structure for cacheability — Arrange content for prompt caching efficiency:

    • Static content (system instructions, role definitions, tool descriptions) → early in the prompt
    • Dynamic content (user input, retrieved documents, conversation history) → late in the prompt
    • Exact savings, TTLs, and token thresholds are provider-specific; cite references/context-management.md before quoting cache economics
  7. Harden — Run through references/hardening-checklist.md:

    • If input source is untrusted → apply injection resistance patterns
    • If output is user-facing → add safety constraints
    • If tool-calling → apply permission minimization
    • Add edge case handling for expected failure modes
  8. Present — Format per references/output-formats.md Annotated Prompt. Recommend Mode D (Evaluate) to build a test suite.

Mode B: Analyze

Diagnose an existing prompt and optionally improve it. Dispatched as analyze (with fixes) or audit (report only, no changes).

Analyze Workflow

  1. Run Shared Preflight — Complete the shared preflight above before scoring or analyzing the prompt.

  2. Diagnostic scoring — Score the prompt on 5 dimensions using the Diagnostic Scorecard in references/output-formats.md:

    Dimension Score (1-5) Assessment
    Clarity How unambiguous are the instructions?
    Completeness Are all necessary constraints and context provided?
    Efficiency Is every token earning its keep? (Over-specification check)
    Robustness How well does it handle edge cases and adversarial inputs?
    Model Fit Is it optimized for the target model class?

    Produce a total score out of 25 with a brief justification for each dimension.

  3. Four-lens analysis — Examine the prompt through each lens:

    • Ambiguity lens: Identify instructions that could be interpreted multiple ways. Flag missing context that the model would need to guess. Check for conflicting instructions.
    • Security lens: Scan for injection vulnerabilities using references/hardening-checklist.md. Assess input trust boundaries. Check for information leakage risks.
    • Robustness lens: Identify edge cases not covered. Check for brittle patterns that break with unexpected input. Assess graceful degradation.
    • Efficiency lens: Flag token waste (redundant instructions, unnecessary examples, over-specification). Assess cacheability. Check for the Over-Specification Paradox.
  4. Anti-pattern scan — Check against every pattern in references/anti-patterns.md. For each detected anti-pattern, report: pattern name, severity, location in the prompt, and remediation guidance.

  5. Model-fit validation — Assess whether the prompt is well-suited to its target model and verify recommendations are current:

    • Is it using techniques appropriate for the model class?
    • Are there model-specific features it should leverage but does not?
    • Are there anti-patterns specific to this model? (e.g., prefilled responses on Claude 4.x)
    • Read references/model-playbooks.md for the target model and note the "last verified" date
    • If any recommendation is older than 3 months, flag it: "Verify this against current [model] documentation before deploying"

Report-only mode (audit): Present findings per the Audit Report in references/output-formats.md. Recommend full Analyze if fixes are needed, and recommend Mode D (Evaluate) if no eval exists. Stop here.

Full mode (analyze): Continue with steps 6-7.

  1. Apply improvements — For each dimension scoring below 4:

    • Identify the specific issue
    • Propose a targeted fix
    • Show before/after for each change
    • Cite the technique or principle driving the change (from references/technique-catalog.md or references/anti-patterns.md)
  2. Present — Format the diagnosis with Diagnostic Scorecard and the proposed changes with Changelog from references/output-formats.md. Recommend Mode D (Evaluate) if no eval exists.

Mode C: Convert

Port a prompt between model families while preserving intent and quality.

Convert Workflow

  1. Run Shared Preflight — Complete the shared preflight above before building the conversion plan.

  2. Load playbooks — Read the source and target model playbook sections from references/model-playbooks.md. Note key differences:

    • Structural format preferences (XML vs. markdown vs. JSON)
    • System prompt conventions
    • Feature availability (prefill, caching, thinking modes)
    • Known behavioral differences
  3. Build conversion plan — Create a conversion checklist:

    • Features that map directly (rename/restructure)
    • Features that require adaptation (different mechanism, same intent)
    • Features that have no equivalent (must be removed or simulated)
    • New features to leverage (target model has capabilities source lacks)
  4. Execute conversion — Apply the plan. For each change:

    • Show the source pattern
    • Show the target pattern
    • Explain why the change is needed
  5. Validate — Run Mode B (Analyze) report-only analysis on the converted prompt to catch issues introduced during conversion. Present per the Conversion Diff in references/output-formats.md. Recommend Mode D (Evaluate) using the same test cases on both models.

Mode D: Evaluate

Build an evaluation framework for a prompt. Does not run the evaluations — produces the eval design.

Evaluate Workflow

  1. Run Shared Preflight — Complete the shared preflight above before defining the evaluation plan.

  2. Define success criteria — Work with the user to define what "working correctly" means:

    • Functional criteria (does it produce the right output?)
    • Quality criteria (is the output good enough?)
    • Safety criteria (does it avoid harmful outputs?)
    • Edge case criteria (does it handle unusual inputs?)
  3. Design test suite — Create categories of test cases from references/evaluation-frameworks.md:

    • Golden set: 5-10 representative inputs with expected outputs
    • Edge cases: Boundary conditions, empty inputs, extremely long inputs
    • Adversarial: Injection attempts, out-of-scope requests, ambiguous inputs
    • Regression: Cases that previously failed (if optimizing an existing prompt)
  4. Generate test cases — For each category, produce concrete test cases:

    • Input (the exact text to send)
    • Expected behavior (what the model should do)
    • Failure indicators (what would indicate the prompt is broken)
  5. Build rubric — Create a scoring rubric per the Evaluation Framework in references/output-formats.md:

    • Dimensions with clear definitions
    • Score levels (1-5) with concrete examples for each level
    • LLM-as-judge prompt for automated evaluation (if applicable)
    • Human evaluation protocol for subjective dimensions
  6. Present — Format per the Evaluation Framework in references/output-formats.md. Include recommended eval tools from references/evaluation-frameworks.md and CI/CD integration pattern.

Mode E: Harden

Stress-test and improve a prompt that handles untrusted input, tool results, retrieved documents, user-facing output, or production actions.

  1. Run Shared Preflight — Identify trust boundaries, external content sources, tools, output sinks, and failure cost.
  2. Load hardening guidance — Read references/hardening-checklist.md and the security sections of references/architecture-patterns.md.
  3. Map attacks — Check direct injection, indirect injection, prompt extraction, tool abuse, output format escape, context exhaustion, and sensitive-data leakage.
  4. Propose controls — Add delimiters, instruction hierarchy, tool permission minimization, output validation, token budgets, graceful degradation, and monitoring hooks as applicable.
  5. Present — Use the Harden Report template. Include residual risks and eval cases that should fail before deployment.

Mode F: Tool

Design or review model-facing tool definitions, function schemas, MCP tool descriptions, and tool-selection instructions.

  1. Run Shared Preflight — Identify target model/provider, tool surface, permissions, input/output schema, and failure modes.
  2. Load tool patterns — Read references/architecture-patterns.md and references/hardening-checklist.md.
  3. Review schema — Check name clarity, description specificity, parameter types/enums/defaults, optional behavior, error contract, and overlap with adjacent tools.
  4. Review safety — Apply least privilege, allowed-tools scoping, destructive/open-world action gates, tool result validation, and untrusted-result isolation.
  5. Present — Use the Tool Definition Review template with rewritten tool docs or schema deltas.

Mode G: PromptOps

Plan prompt lifecycle controls. Does not deploy or run prompts.

  1. Run Shared Preflight — Identify owner, model/provider, versioning surface, evals, rollout risk, and observability stack.
  2. Load eval guidance — Read references/evaluation-frameworks.md, references/output-formats.md, and relevant provider playbook sections.
  3. Design lifecycle — Define prompt versions, linked evals, golden/adversarial/regression sets, release gates, monitoring metrics, drift checks, and rollback steps.
  4. Set evidence gates — Require current provider-doc verification before model-specific rollout changes.
  5. Present — Use the PromptOps Plan template.

Reference File Index

File Content Read When
references/technique-catalog.md ~36 techniques across 8 categories with model-class compatibility Selecting techniques for any mode
references/model-playbooks.md Claude, GPT, Gemini, Llama guidance with caching strategies Any model-specific recommendation
references/anti-patterns.md 14 anti-patterns with severity, detection, and remediation Analyzing or crafting any prompt
references/architecture-patterns.md Agent, RAG, tool-calling, multi-agent design patterns Crafting agent or system prompts
references/context-management.md Compaction, caching, context rot, ACE framework Designing long-context or multi-turn systems
references/hardening-checklist.md Security and robustness checklist (29 items) Hardening any prompt handling untrusted input
references/evaluation-frameworks.md Eval approaches, PromptOps lifecycle, tool guidance Building evaluation frameworks
references/output-formats.md Templates for all skill outputs (scorecards, reports, diffs) Formatting any skill output
scripts/validate-references.py Deterministic checks for reference index, provider metadata, dispatch/eval coverage After editing references, dispatch, or evals

Read reference files as indicated by the "Read When" column above. Do not rely on memory or prior knowledge of their contents. Reference files are the source of truth. If a reference file does not exist, proceed without it but note the gap.

Critical Rules

  1. Do not recommend mandatory hidden chain-of-thought transcripts for reasoning models; prefer provider-supported reasoning controls or concise planning/preambles when current docs support them
  2. Use clear delimiters for multi-section prompts; XML tags are a strong default for Claude and many complex prompts, but verify provider-specific format guidance
  3. Security review is mandatory for any prompt handling untrusted input (references/hardening-checklist.md)
  4. Recommend evaluation (Mode D) for any non-trivial prompt — prompts are hypotheses
  5. Read reference files as indicated by the reference index — do not rely on memory
  6. Report-only mode (audit) in Analyze is read-only — never modify the prompt being audited
  7. Scope agent prompt recommendations to their evidence class; do not present OpenAI agentic guidance as universal proof for all models
  8. If prompt-vs-request classification is ambiguous, ask before choosing a mode
  9. Refuse and redirect requests to run prompts, build agents, or do non-prompt implementation work
  10. For provider-specific claims, cite references/model-playbooks.md, include its last-verified date, and flag stale guidance older than 90 days
  11. Update evals when adding modes or changing dispatch behavior
  12. Run scripts/validate-references.py after reference, dispatch, or eval changes

Rationalization Counters

Rule pressure Likely dodge Required counter
Provider-doc freshness "I remember the current model behavior." Check model-playbooks.md and report the last-verified date.
Security hardening "The prompt is internal only." State the trust boundary; if any external content exists, run Mode E.
Eval follow-up "The prompt looks fine." Include at least golden, edge, adversarial, and regression eval categories.
Scope boundary "Running it would prove the prompt works." Refuse execution and provide a prompt/eval plan instead.
Dispatch ambiguity "The intent is obvious enough." Ask for mode selection when craft-vs-analyze or prompt-vs-implementation is mixed.
Related skills
Installs
43
GitHub Stars
3
First Seen
Feb 18, 2026