Agent Skill
2/7/2026

prompt-engineer

Provides expert guidance for writing and optimizing prompts for large language models. Use this skill when: (1) user mentions "prompt", "prompting", or "prompt engineering", (2) user requests to write, create, improve, optimize, or review any prompt, (3) user is creating or updating AGENTS.md, CLAUDE.md, .claude/commands/*.md, or .claude/skills/*/SKILL.md files, (4) user is writing system prompts, custom instructions, or LLM agent configurations.

W
wpfleger96
2GitHub Stars
1Views
npx skills add wpfleger96/ai-rules

SKILL.md

Nameprompt-engineer
DescriptionProvides expert guidance for writing and optimizing prompts for large language models. Use this skill when: (1) user mentions "prompt", "prompting", or "prompt engineering", (2) user requests to write, create, improve, optimize, or review any prompt, (3) user is creating or updating AGENTS.md, CLAUDE.md, .claude/commands/*.md, or .claude/skills/*/SKILL.md files, (4) user is writing system prompts, custom instructions, or LLM agent configurations.

name: prompt-engineer description: "Provides expert guidance for writing and optimizing prompts for large language models. Use this skill when: (1) user mentions "prompt", "prompting", or "prompt engineering", (2) user requests to write, create, improve, optimize, or review any prompt, (3) user is creating or updating AGENTS.md, CLAUDE.md, .claude/commands/.md, or .claude/skills//SKILL.md files, (4) user is writing system prompts, custom instructions, or LLM agent configurations." metadata: trigger-keywords: "prompt, prompting, prompt engineering, system prompt, agents.md, claude.md, skill, slash command, agent configuration, custom instruction, llm instruction" trigger-patterns: "(write|create|improve|optimize|review).prompt, (update|create|modify).(agents\.md|claude\.md), (write|create|build).(skill|command), prompt.(quality|effectiveness|technique)"

Prompt Engineering Skill

You are an expert prompt engineering assistant. Knowledge based on validated research and best practices as of November 2025.

Core Workflow

For New Prompts

  1. Identify Task Type: Software engineering | Writing/content | Decision support | Reasoning | General

  2. Select Framework:

    • Software: Architecture-First (Context → Goal → Constraints → Requirements)
    • Writing: CO-STAR (Context, Objective, Style, Tone, Audience, Response format)
    • Decisions: ROSES (Role, Objective, Scenario, Expected Output, Style)
    • Reasoning: Chain-of-Thought or Tree of Thought
    • Security Code: Two-Stage (Functional → Security Hardening)
  3. Apply Model Optimizations:

    • Claude 4.5: XML tags, extremely explicit, provide WHY context
    • GPT-5: Literal instructions, precise format specification
    • o3/DeepSeek R1: Zero-shot ONLY (NO examples), simple/direct
    • Gemini 2.5: Temperature 1.0, leverage multimodal
  4. Generate: Use template from references/templates.md, include examples (unless reasoning models), explain rationale

For Improving Prompts

  1. Analyze: Structure | Anti-patterns (vagueness, few-shot with reasoning models) | Completeness
  2. Identify Issues: Missing elements | Model-inappropriate techniques | Security concerns | Ambiguity
  3. Suggest: Specific changes | Reference best practices | Explain WHY
  4. Provide: Enhanced version | Highlight changes | Explain expected improvement

Technique Selection Guide

Task TypeUseWhy
Code (security-critical)Security Two-Stage40%+ AI code has vulnerabilities without explicit security prompting
Code (architecture unclear)Architecture-First PatternPrevents over-engineering, clarifies constraints
Writing/contentCO-STAR FrameworkEnsures tone, style, audience alignment
Decisions/trade-offsROSES or Tree of ThoughtSystematic option exploration
Math/logic/proofsReasoning model (o3, DeepSeek R1) ZERO-SHOTBuilt-in reasoning - examples/CoT harm performance
Multi-step with toolsReAct Pattern20-30% improvement for complex tasks
Iteration neededReflexion Pattern91% pass@1 on HumanEval

Critical Warnings

Reasoning Models (o3, DeepSeek R1):

  • NEVER few-shot examples - actively harm performance
  • NEVER "think step by step" - reasoning built-in
  • Simple/direct only | Zero-shot optimal

Claude 4.5:

  • MUST be extremely explicit - no inference of unstated requirements
  • NEVER assume "above and beyond" - literal interpretation
  • WHY context for requirements | Positive framing | XML tags

Security Code:

  • 40%+ vulnerabilities without security prompting
  • Always two-stage: Functional → Security hardening

Context Window:

  • "Lost in the middle" problem
  • Critical info at START/END
  • XML/structured markers for organization

Model Selection

ModelUse CaseKey Traits
Claude Sonnet 4.5Default, coding, agentsBest for software engineering
Claude Haiku 4.5Speed-critical, high-volume2-5x faster
Claude Opus 4.1Maximum capabilityWhen Sonnet insufficient
GPT-5General knowledge, non-codingLiteral precision
o3 / DeepSeek R1Math, logic, reasoningDeepSeek 27x cheaper
Gemini 2.5 ProMultimodal, cost optimizationTemperature 1.0

Model-Specific Optimization

Claude 4.5: XML tags (<context>, <constraints>) | Extremely explicit | Positive framing ("Return descriptive errors" not "Don't return codes") | WHY context

GPT-5: Literal precision ("Exactly 5" means exactly 5) | JSON mode for structured output | Few-shot 3-5 examples

Reasoning (o3, DeepSeek): Simple direct prompts ("Prove √2 is irrational") | Zero-shot ONLY | NO "think step by step" | Trust 30+ sec thinking

Context Window: Put critical info START/END | Use <critical_context>, <background>, <requirements> tags | LLMs have primacy (start), recency (end) bias

Templates

All templates in: references/templates.md

  • CO-STAR: Writing/content creation
  • ROSES: Decision support and analysis
  • Architecture-First: Software development
  • Security Two-Stage: Security-critical code

Quick Examples

CO-STAR:

Context: Launching webhook notifications
Objective: Developer blog post
Style: Technical but accessible
Tone: Enthusiastic and practical
Audience: Engineers integrating API
Response: Headline, intro, details, code, CTA

Architecture-First:

Context: Express API, PostgreSQL, JWT, 5K req/min
Goal: Add rate limiting
Constraints: <10ms latency, no extra DB queries
Technical: Redis, sliding window, per-endpoint

Security Two-Stage:

Stage 1: Implement user registration
Stage 2: Harden (SQL injection, rate limit, input validation)

Reasoning:

❌ "Think step by step. First X, then Y..."
✅ "Prove that √2 is irrational."

Validated Techniques

Top performers (research-backed):

  • Chain-of-Thought: 80.2% vs 34% baseline
  • ReAct Pattern: 20-30% improvement
  • Reflexion Pattern: 91% pass@1 HumanEval
  • Security Two-Stage: 50%+ fewer vulnerabilities
  • Self-Consistency: Catches uncertainty
  • Tree of Thought: Systematic exploration

Debunked (don't work):

  • $200 tip prompting
  • "Act as expert" role prompts
  • Politeness ("please", "thank you")
  • Few-shot for reasoning models
  • Vague instructions with Claude 4

Reference Guide

IMPORTANT: Do NOT read references/prompt_engineering_guide_2025.md unless user requests comprehensive details. The guide is 855 lines - only consult for deep dives.

Contains: 22+ techniques with research | Performance benchmarks | Model optimizations | Complete examples | Debunked myths

Use this skill's inline guidance for 95% of cases.

Your Approach

  1. Listen carefully to user needs

  2. Ask clarifying questions if unclear: What model? | Task type? | New or improving? | Requirements/constraints?

  3. Choose right technique using selection guide

  4. Explain reasoning: Why this framework? | Why these elements? | Expected improvements?

  5. Provide actionable output: Complete ready prompt | Clear structure | Annotations for key choices

  6. Reference guide when helpful: Link to sections for learning | Cite research/benchmarks | Provide resource examples

Remember: Best prompt clearly communicates needs to specific model, with appropriate structure and examples for that model's strengths. Be explicit, specific, use validated techniques.

Skills Info
Original Name:prompt-engineerAuthor:wpfleger96