agentsclimarketplace

Prompt engineering

Skill viktorbezdek/skillstack/prompt-engineering/skills/prompt-engineering

Skills I use and develop to deliver better outcomes faster and with less effort.

Install
npx -y skills add viktorbezdek/skillstack --skill prompt-engineering

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Design, evaluate, and iteratively improve prompts for LLMs — system prompts, few-shot examples, reasoning structures, and instruction templates. Use when the user asks to improve a prompt, write a system prompt, optimize LLM instructions, reduce hallucinations through prompt structure, test prompt variants, or apply prompting techniques (structured reasoning, ReAct, few-shot, structured output). NOT for building MCP tools or server implementation (use mcp-server). NOT for creating Claude Code SKILL.md files (use skill-foundry). NOT for building a full agent (use build-ai-agent workflow).

SKILL.md

12.6 KB, as published. Nobody here has run it

Prompt Engineering Skill

When to Use

Activate this skill when:

  • Optimizing an existing prompt that produces inconsistent or low-quality output
  • Creating a new prompt from scratch (system prompt, instruction template, few-shot)
  • Evaluating prompt quality across dimensions (clarity, specificity, structure)
  • A/B testing prompt variants for measurable improvement
  • Migrating a prompt between LLM platforms (Claude ↔ GPT-family models ↔ Gemini)
  • Applying specific techniques: structured reasoning, Few-Shot, Role Assignment, Output Specification
  • Reducing hallucinations through prompt structure and constraints
  • Designing multi-stage prompt pipelines

When NOT to Use

  • Building MCP servers or implementing MCP protocol → use mcp-server
  • Creating Claude Code SKILL.md files → use skill-foundry
  • Building a full agent system → use agent-project-development workflow
  • Generating creative content directly → this skill optimizes the prompt, not the output
  • Fine-tuning or training models → prompt engineering operates at inference time

Decision Flow

Assess the request and pick the right mode:

User request arrives
  │
  ├─ Has existing prompt + describes problem?
  │   └─ OPTIMIZE MODE
  │       1. Deconstruct: What's really being asked?
  │       2. Diagnose: Score on 5 dimensions (see below)
  │       3. Develop: Apply targeted techniques
  │       4. Deliver: Improved prompt + brief explanation
  │
  ├─ Needs new prompt from scratch?
  │   ├─ Simple, well-defined task → AUTO DESIGN: Build directly
  │   └─ Complex or ambiguous task → INTERACTIVE DESIGN: Ask 2-3 questions first
  │
  ├─ Quality assessment / comparison request?
  │   └─ EVALUATE MODE
  │       1. Score each dimension 1-5
  │       2. Identify specific weaknesses
  │       3. Suggest targeted improvements
  │
  └─ Learning / understanding request?
      └─ EDUCATE: Teach relevant techniques with before/after examples

Technique Selection Decision Tree

Diagnosis reveals the problem:
  │
  ├─ No domain expertise → Role Assignment
  │   └─ Give LLM a specific expert identity with credentials
  │
  ├─ Missing background / LLM lacks context → Context Layering
  │   └─ Background → Goal → Constraints → Output Format
  │
  ├─ Complex reasoning, math, multi-factor analysis → Structured private reasoning
  │   └─ Ask the model to plan, check, and verify internally; show only concise rationale needed by the user
  │
  ├─ Output format inconsistent → Few-Shot Examples + Output Specification
  │   └─ Show 2-3 input→output pairs + define exact structure
  │
  ├─ Task too large for single pass → Task Decomposition
  │   └─ Break into sequential stages; each feeds the next
  │
  ├─ No boundaries defined → Constraints & Guardrails
  │   └─ Define what NOT to do, length limits, format requirements
  │
  └─ Output structure undefined → Output Specification
      └─ Define headers, sections, length, style, tone explicitly

Core Process: The 4-D Framework

Apply this framework for every prompt optimization task.

1. DECONSTRUCT — Understand What's Really Being Asked

  • What is the actual goal? (Often different from what's literally stated)
  • What assumptions are unstated?
  • What information is missing that the LLM will need?
  • Who is the audience for the output?

2. DIAGNOSE — Identify What's Wrong or Missing

Score the prompt against these dimensions:

DimensionWhat to CheckRed Flag
ClarityCould this be misinterpreted? Vague terms?Score ≤ 2: Rewrite with precise language
SpecificityAre outputs constrained enough? Format defined?Score ≤ 2: Add Output Specification
StructureInformation organized logically?Score ≤ 2: Apply Context Layering
CompletenessRole + Context + Task + Format + Examples present?Score ≤ 2: Add missing components
EfficiencyEvery token earns its keep? No redundancy?Score ≤ 2: Cut bloat

3. DEVELOP — Apply the Right Techniques

Select techniques based on diagnosis (see Technique Selection Decision Tree above). For detailed examples, see references/TECHNIQUES.md.

Role Assignment — Give the LLM a specific expert identity with credentials and methodology. Use when domain expertise matters. The more specific the role, the better the output quality.

Context Layering — Provide essential background in structured format: Background → Goal → Constraints → Output Format. Remove anything the LLM doesn't need.

Structured Reasoning — Ask the model to plan, check assumptions, and verify internally, then present a concise rationale or decision trace appropriate for the user. Avoid requesting hidden chain-of-thought verbatim; prefer "think privately, then summarize the key reasons."

Few-Shot Examples — Show 2-3 input→output pairs that demonstrate the pattern you want. This is the single most powerful technique for controlling output format and style.

Task Decomposition — Break complex tasks into sequential stages where each stage feeds the next. Prevents the LLM from trying to do everything at once and dropping quality.

Constraints & Guardrails — Define what NOT to do, set length limits, specify format requirements. LLMs perform better with clear boundaries than with open-ended freedom.

Output Specification — Define the exact structure, format, and content requirements of the output. Be explicit: headers, sections, length, style, tone.

4. DELIVER — Present the Optimized Prompt

  • Show the complete optimized prompt in a code block or artifact
  • Briefly explain key improvements (2-3 sentences, not a lecture)
  • Note which techniques were applied and why
  • If relevant, provide platform-specific tips (see references/PLATFORMS.md)
  • Offer to iterate if the user wants refinements

Optimization Patterns

Pattern: Role + Context + Task + Format

The most common pattern. Works for 80% of prompt optimization needs.

You are a [SPECIFIC EXPERT] with expertise in [DOMAIN].

Context:
[ESSENTIAL BACKGROUND — 2-4 lines max]

Task:
[CLEAR, SPECIFIC OBJECTIVE]

Requirements:
- [CONSTRAINT 1]
- [CONSTRAINT 2]

Output format:
[EXACT STRUCTURE EXPECTED]

Pattern: Few-Shot + Structured Reasoning

Use for tasks requiring consistent format AND complex reasoning.

[ROLE AND CONTEXT]

Here are examples of the expected analysis:

Example 1:
Input: [SAMPLE]
Rationale: [CONCISE VISIBLE REASONS]
Output: [RESULT]

Example 2:
Input: [SAMPLE]
Rationale: [CONCISE VISIBLE REASONS]
Output: [RESULT]

Now analyze the following. Think privately through the reasoning, check for mistakes,
then provide the final output with a concise rationale.

Input: [ACTUAL TASK]

Pattern: Multi-Stage Pipeline

Use for complex tasks that benefit from decomposition.

Complete this analysis in three stages:

Stage 1 — Research:
[GATHER AND ORGANIZE INFORMATION]
Present findings as: [FORMAT]

Stage 2 — Analysis:
Using the research from Stage 1, [ANALYZE SPECIFIC ASPECTS]
Present analysis as: [FORMAT]

Stage 3 — Synthesis:
Based on your analysis, [PRODUCE FINAL DELIVERABLE]
Format: [FINAL OUTPUT SPECIFICATION]

Anti-Patterns to Fix

Anti-PatternProblemSolution
Kitchen sink promptEvery possible instruction crammed in; model drowns in contradictory directivesIdentify the 3 most important requirements. Cut the rest. Each instruction must earn its tokens.
Copycat promptCopied from a blog post without understanding why it works; fails when use case differs slightlyUse the 4-D framework to analyze why a template works before adapting it. Understand the technique, not just the words.
Platform-blind promptWritten for one LLM and assumed to transfer; XML tags may not help every GPT-family model, while "You MUST" can over-constrain ClaudeUse platform-specific translation (see references/PLATFORMS.md). Convert structural patterns, don't just change words.
Format-free promptNo output structure specified; each run produces different format, breaking downstream processingAdd explicit Output Specification with headers, structure, and length requirements.
Contradiction prompt"Be concise" AND "Be thorough" in same prompt; model oscillates between contradictory instructionsResolve trade-offs explicitly: "Prioritize completeness over brevity" or "Be thorough on methodology, concise on examples."
Vague instructions"Analyze the data" — no format, scope, or audience definedAdd specificity: who, what, how, format, length, audience
Buried intentThe actual task is buried under paragraphs of contextMove the task to the top; context supports, doesn't obscure
Assumed knowledgeLLM expected to know company-specific or domain-specific factsAdd necessary context the LLM wouldn't have
No examplesLLM must infer expected output format from description aloneAdd 2-3 few-shot examples showing desired output pattern
Over-engineeringSimple task gets a complex multi-stage prompt with unnecessary techniquesSimple tasks need simple prompts. Don't add complexity for its own sake.

Context Enrichment

When the user's prompt references specific company data, projects, documents, or internal information, enrich the prompt with real context before optimizing.

When to enrich:

  • User mentions "our company/team/project/product"
  • References specific documents, emails, or meetings
  • Uses domain terminology suggesting organizational context
  • Mentions temporal markers like "Q3", "this sprint", "last month"

How to enrich: Use available tools (web search, connected integrations) to pull relevant context. Synthesize the key facts — goals, metrics, stakeholders, constraints, timelines — and inject them into the prompt's context section. Don't dump raw data — distill what the LLM actually needs to produce a useful output.

Evaluation Framework

When asked to evaluate a prompt (or when testing an optimized prompt), assess across these dimensions. See references/EVALUATION.md for the full methodology.

Quick Evaluation (Score 1-5 each)

DimensionWhat to Check
ClarityCould this be misinterpreted? Vague terms? Ambiguity?
SpecificityAre outputs constrained enough? Format defined?
CompletenessRole + Context + Task + Format + Examples present?
EfficiencyToken-efficient? No redundancy? Every line earns its place?
RobustnessWill it work across input variations? Edge cases handled?

A/B Testing Process

When comparing two prompt versions:

  1. Define 3-5 test inputs covering typical, edge, and stress cases
  2. Run both prompts against each test input
  3. Blind-evaluate outputs (don't look at which prompt produced which)
  4. Score on the relevant dimensions
  5. Declare winner with reasoning

Platform-Specific Notes

PlatformStrengthsAvoid
ClaudeXML tags for structure, nuanced role descriptions, extended thinkingOver-constraining with rigid rules; Claude performs better with clear intent
GPT-family modelsSystem/user message separation, tool/function calling, explicit directivesAssuming XML tags work; use native message and tool schemas instead
GeminiMultimodal prompts, clear section demarcationAmbiguous section boundaries

See references/PLATFORMS.md for detailed platform optimization guides.

Reference Files

Load these as needed for deeper guidance:

FileWhen to Read
references/TECHNIQUES.mdFull technique catalog with detailed examples
references/EVALUATION.mdComprehensive evaluation methodologies and rubrics
references/TEMPLATES.mdReusable prompt patterns for common use cases
references/PLATFORMS.mdPlatform-specific optimization (Claude, GPT, Gemini)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.