Prompt design techniques for LLMs: structure, examples, reasoning patterns, and optimization. Invoke whenever task involves any interaction with AI instructions — crafting, debugging, improving, or evaluating prompts for skills, agents, output styles, or system configurations.
Applies prompt engineering techniques to design, debug, and optimize AI instructions for skills, agents, and system configurations.
npx claudepluginhub xobotyi/cc-foundryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/agent-patterns.mdreferences/claude-specific.mdreferences/learning-paradigms.mdreferences/long-context.mdreferences/optimization-strategies.mdreferences/reasoning-techniques.mdreferences/security.mdreferences/workflow-patterns.mdDesign effective prompts for LLMs. Apply when crafting skills, agents, output styles, system prompts, or any AI instructions.
Most prompts need only three things:
Start here. Add complexity only when this fails.
Summarize the following article in 3 bullet points.
Each bullet should be under 20 words.
Focus on business implications.
Example output:
- Revenue increased 15% due to new product line launch
- Operating costs reduced through automation initiatives
- Market share expanded in European regions
Article:
{{ARTICLE}}
| Symptom | Fix | Details |
|---|---|---|
| Wrong format | Add explicit format + example | Output Format |
| Missing information | Be more specific about what to include | Be Specific |
| Hallucination | Add context, request citations | Provide Context |
| Ignores instructions | Move instructions to end, use XML tags | Long Context Rules |
| Complex reasoning fails | Add CoT or use extended thinking | Reasoning |
| Inconsistent results | Add 3-5 examples | Examples |
| Too verbose | Specify word/sentence limits | Be Specific |
| Security concerns | Validate input, filter output | security.md |
| Topic | Reference | Contents |
|---|---|---|
| Reasoning techniques | reasoning-techniques.md | CoT variants (zero-shot, few-shot, auto), Tree-of-Thoughts, Self-Consistency, extended thinking details, academic citations |
| Learning paradigms | learning-paradigms.md | In-context learning theory, paradigm spectrum details, example ordering research, generated knowledge prompting |
| Workflow patterns | workflow-patterns.md | Prompt chaining examples, iterative refinement cycles, meta prompting templates |
| Prompt security | security.md | Injection attack types, jailbreaking techniques, defense strategies, security checklist |
| Optimization strategies | optimization-strategies.md | Prompting vs RAG vs fine-tuning decision flow, DSPy, cost-benefit analysis |
| Claude-specific | claude-specific.md | Prefilling examples, system prompt API usage, extended thinking API details, technique combinations |
| Long context | long-context.md | Document organization patterns, XML structuring for multi-doc, query patterns, chunking strategies |
| Agent & tool patterns | agent-patterns.md | ReAct, PAL, Reflexion, ART implementation patterns, pattern selection table |
Use these in order — most problems are solved by #1-3.
The golden rule: Show your prompt to a colleague with minimal context. If they're confused, Claude will be too.
Tell Claude:
| Vague | Specific |
|---|---|
| "Summarize this" | "Summarize in 3 bullets, each under 20 words" |
| "Make it better" | "Fix grammar errors, reduce word count by 30%" |
| "Analyze the data" | "Calculate YoY growth, identify top 3 trends" |
Always specify format explicitly. Show an example if structure matters:
Extract the following as JSON:
- Product name
- Price (number only)
- In stock (boolean)
Example output:
{"name": "Widget Pro", "price": 29.99, "in_stock": true}
3-5 examples typically sufficient. Cover edge cases.
Text: "Great service!" → Positive
Text: "Worst purchase ever" → Negative
Text: "It works as expected" → Neutral
Text: "Absolutely love it!" → ?
Example selection rules:
<examples> tags for clear separation from instructionsChoosing the right paradigm:
| Situation | Approach |
|---|---|
| Simple, well-known task | Zero-shot (just ask) |
| Need specific output format | One-shot (1 example) |
| Complex classification / nuanced judgment | Few-shot (3-5 examples) |
| Domain-specific task | Few-shot with domain examples |
| Highly nuanced + complex reasoning | Few-shot + Chain-of-Thought |
Extended paradigm details and ICL theory: see learning-paradigms.md.
Separate components for clarity and parseability:
<instructions>
Analyze the contract for risks.
</instructions>
<contract>
{{CONTRACT_TEXT}}
</contract>
<output_format>
List risks in <risks> tags, recommendations in <recommendations>.
</output_format>
Rules:
<contract>..."<outer><inner>...</inner></outer>For complex reasoning, ask Claude to show its work:
Think through this step by step, then provide your answer.
Or use structured tags:
Think through this in <thinking> tags.
Then provide your answer in <answer> tags.
Critical: Claude must output its thinking. Without outputting the thought process, no thinking actually occurs.
CoT vs Extended Thinking decision:
| Criteria | Standard CoT | Extended Thinking |
|---|---|---|
| Activation | Prompt: "think step by step" | API parameter |
| Token budget | Shared with output | Dedicated thinking budget |
| Prompting style | Prescriptive steps work well | High-level guidance better |
| Prefilling | Supported | Not supported |
| Best for | Clear problems with known steps | Complex STEM, constraint optimization, exploration |
Rule: Use extended thinking when the problem requires exploring multiple approaches or when thinking budget would exceed output. Use standard CoT for straightforward multi-step reasoning. Use neither for simple factual tasks.
With extended thinking, provide high-level guidance ("think thoroughly, consider multiple approaches") — not prescriptive steps. Claude's creativity often exceeds human-prescribed step sequences.
CoT variants, Tree-of-Thoughts, self-consistency sampling: see reasoning-techniques.md.
For multi-step tasks, number the steps:
Your task is to anonymize customer feedback.
Instructions:
1. Replace customer names with "CUSTOMER_[ID]"
2. Replace emails with "EMAIL_[ID]@example.com"
3. Redact phone numbers as "PHONE_[ID]"
4. Leave product names intact
5. Output only processed messages, separated by "---"
Numbered steps ensure Claude follows the exact sequence.
Simple task, clear format → Zero-shot (just ask)
Need consistent format → Few-shot (3-5 examples)
Complex reasoning → Chain-of-Thought
Very complex problem → Extended Thinking
Multi-step workflow → Prompt Chaining
Need external information → ReAct (reasoning + tool use)
Precise calculation → PAL (generate code)
Agent and tool patterns (ReAct, PAL, Reflexion, ART): see agent-patterns.md.
Start Claude's response to control format:
messages=[
{"role": "user", "content": "Extract as JSON: ..."},
{"role": "assistant", "content": "{"} # Prefill
]
Claude continues from {, outputting pure JSON without preamble.
Prefilling rules:
Use the system parameter to define Claude's role and expertise:
system="You are a senior security auditor specializing in web applications."
System prompt rules:
Full API details and technique combinations: see claude-specific.md.
When working with 20K+ token documents, follow these rules:
<documents>
<document index="1">
<source>annual_report_2023.pdf</source>
<document_content>{{CONTENT}}</document_content>
</document>
</documents>
Document organization patterns, chunking strategies, and query templates: see long-context.md.
When a single prompt can't handle the full task, decompose into a chain of simpler prompts where each output feeds the next.
When to chain:
Design principles:
Chain patterns:
Avoid over-chaining — breaking tasks too small creates overhead without benefit. Chain when there's a natural validation boundary.
Extended examples and iterative refinement patterns: see workflow-patterns.md.
When prompting alone isn't enough:
Is task within model's knowledge?
├── Yes → Prompt engineering (you are here)
│ ├── Sufficient? → Done
│ └── Need accuracy on domain data? → Add RAG
└── No → Need deep domain expertise?
├── Yes → Fine-tune (or RAG if data is external)
└── No → Improve prompts, add examples
Start with prompting. Add RAG when you need current/accurate external data. Fine-tune only when prompt engineering and RAG together can't achieve the required quality.
Strategy comparison and cost-benefit analysis: see optimization-strategies.md.
When a prompt handles untrusted input (user-provided content, web scraping, external documents), apply these defenses:
System instructions (trusted):
[instructions here]
---USER INPUT BELOW (untrusted)---
{user_input}
Prompt injection cannot be fully prevented — it's inherent to how LLMs process natural language. Defense is about reducing attack surface, limiting blast radius, and detecting incidents.
Attack taxonomy, defense implementation details, full checklist: see security.md.
Before finalizing a prompt:
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.