Help us improve
Share bugs, ideas, or general feedback.
From platform
Guides context engineering for Claude: designing prompts, system prompts, and context windows using Anthropic techniques like clear instructions, multishot examples, chain-of-thought, XML tags. For API calls, agents, complex inputs.
npx claudepluginhub closedloop-ai/claude-plugins --plugin platformHow this skill is triggered — by the user, by Claude, or both
Slash command
/platform:context-engineeringThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Context engineering is the practice of designing the entire context window—system prompts, examples, structure, instructions, and data—to maximize Claude's performance. This skill distills Anthropic's official prompt engineering documentation into actionable guidance.
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.
Generates new prompts or improves existing ones for Anthropic Claude models using techniques like XML tags, Chain of Thought, prefilling, role assignment, and few-shot examples.
Structures Claude prompts using behavior/task/knowledge zones, XML tagging, and tone registers for skills, agents, modes, complex tasks, tools, and code generation.
Share bugs, ideas, or general feedback.
Context engineering is the practice of designing the entire context window—system prompts, examples, structure, instructions, and data—to maximize Claude's performance. This skill distills Anthropic's official prompt engineering documentation into actionable guidance.
Apply techniques in order of effectiveness. Not all tasks require all techniques.
| Priority | Technique | Best For |
|---|---|---|
| 1 | Be clear and direct | All tasks |
| 2 | Use examples (multishot) | Format consistency, complex patterns |
| 3 | Chain of thought | Math, logic, analysis, complex reasoning |
| 4 | XML tags | Multi-part prompts, structured I/O |
| 5 | Role prompting | Domain expertise, tone adjustment |
| 6 | Prefill response | Output format control, character consistency |
| 7 | Chain prompts | Multi-step workflows, error isolation |
| 8 | Long context tips | Documents >20K tokens |
| 9 | Extended thinking | Complex STEM, constraint optimization |
Think of Claude as a brilliant new employee who needs explicit instructions.
The Golden Rule: Show the prompt to a colleague with minimal context. If they're confused, Claude will be too.
Key Practices:
Instructions:
Data to process: {{FEEDBACK_DATA}}
Examples dramatically improve accuracy, consistency, and quality.
Best Practices:
<example> tags (nest within <examples> if multiple)Now analyze: {{FEEDBACK}}
Encourage Claude to break down problems step-by-step for complex reasoning tasks.
When to Use:
When to Avoid:
Complexity Levels:
| Level | Approach | Example |
|---|---|---|
| Basic | "Think step-by-step" | Quick, less guided |
| Guided | Outline specific steps | More control over reasoning |
| Structured | Use <thinking> and <answer> tags | Easy to parse, separates reasoning from output |
Program info: {{PROGRAM_DETAILS}} Donor info: {{DONOR_DETAILS}}
Think before writing in tags:
Then write the email in tags.
Use XML tags to structure prompts with multiple components.
Benefits:
Best Practices:
<outer><inner></inner></outer><contract> tags..."<instructions>, <context>, <examples>, <data>)See references/xml-tags.md for detailed patterns.
Use the system parameter to set Claude's role and dramatically improve domain performance.
Benefits:
Best Practices:
system parameter, task in user turnGuide outputs by prefilling the Assistant message.
Use Cases:
{ for JSON)Constraints:
<character_maintenance> user: What do you deduce about this shoe? assistant: [Sherlock Holmes] </character_maintenance>
Break complex tasks into sequential subtasks for better accuracy.
When to Chain:
Benefits:
Patterns:
For prompts with substantial data (20K+ tokens):
Key Practices:
Put data at the top: Place long documents above queries/instructions (up to 30% quality improvement)
Structure with XML: Wrap documents with metadata
<documents>
<document index="1">
<source>annual_report.pdf</source>
<document_content>{{CONTENT}}</document_content>
</document>
</documents>
See references/long-context.md for detailed patterns.
For complex problems requiring deep reasoning:
Best Practices:
Best Use Cases:
See references/extended-thinking.md for detailed patterns.
| Goal | Technique |
|---|---|
| JSON output | Prefill with { |
| Specific structure | Provide example in <example> tags |
| No preamble | Prefill or explicit instruction |
| Consistent format | Multishot examples |
| Problem | Solution |
|---|---|
| Misses instructions | Number steps, be explicit |
| Inconsistent format | Add examples |
| Wrong reasoning | Add CoT with structured output |
| Misses context | Add role prompting |
| Drops steps | Chain into separate prompts |
When optimizing or compressing an existing prompt, apply these checks after every structural change:
| Pitfall | Check |
|---|---|
| Stale cross-references | After renaming or renumbering steps, search for ALL references to old labels (jump targets, "see Step X", resume points) and update them |
| Over-abstraction | If the model needs exact values to execute (specific keys, field names, command arguments), keep them literal even if they look repetitive -- a generic placeholder the model cannot expand is worse than duplication |
| Lost preconditions | When merging or removing steps, verify that any precondition checks or guards in the removed step are preserved elsewhere |
| Silent behavior changes | Diff the before/after and confirm every deleted line is either redundant or relocated, not dropped |
| Tag | Purpose |
|---|---|
<instructions> | Task directives |
<context> | Background information |
<example> / <examples> | Few-shot demonstrations |
<data> / <document> | Input content |
<thinking> | Chain of thought reasoning |
<answer> / <output> | Final response |
<constraints> | Limitations or requirements |
For detailed guidance on specific techniques: