Prompt Engineering Mastery
Complete system for designing, testing, optimizing, and managing prompts for LLMs and AI agents. From first draft to production-grade prompt libraries.
by modbender★ 21 GitHub stars
Install Prompt Engineering Mastery in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Prompt Engineering Mastery
Complete system for designing, testing, optimizing, and managing prompts for LLMs and AI agents. From first draft to production-grade prompt libraries.
Phase 1: Prompt Design Fundamentals
The CRAFT Framework
Every prompt should pass CRAFT before use:
| Dimension | Question | Fix |
|---|---|---|
| Clear | Can someone else read this and know exactly what to do? | Remove ambiguity, add examples |
| Role-aware | Does the AI know WHO it is and WHO it's helping? | Add role/persona context |
| Actionable | Is there a specific output format or action requested? | Define deliverable shape |
| Focused | Does it do ONE thing well vs. many things poorly? | Split into chain |
| Testable | Can you objectively judge if the output is good? | Add success criteria |
Prompt Architecture (4 Layers)
┌─────────────────────────────────┐
│ LAYER 1: System Context │ Who you are, constraints, tone
├─────────────────────────────────┤
│ LAYER 2: Task Definition │ What to do, output format
├─────────────────────────────────┤
│ LAYER 3: Input/Context │ User data, documents, variables
├─────────────────────────────────┤
│ LAYER 4: Output Shaping │ Format, examples, guardrails
└─────────────────────────────────┘
Layer 1: System Context Template
You are a [ROLE] with expertise in [DOMAIN].
Your audience is [WHO] — they need [WHAT LEVEL] of detail.
Communication style:
- Tone: [professional/casual/technical/friendly]
- Length: [concise/detailed/comprehensive]
- Format: [prose/bullets/structured]
Constraints:
- [Hard rules: never do X, always do Y]
- [Knowledge boundaries: only discuss X]
- [Safety: refuse requests that involve X]
Layer 2: Task Definition Patterns
Direct instruction (best for simple tasks):
Summarize this article in 3 bullet points. Each bullet should be one sentence, max 20 words. Focus on actionable takeaways, not background context.
Goal-based (best for creative/complex tasks):
I need to convince my CEO to invest in AI automation. Write a one-page memo that addresses their likely objections (cost, reliability, job displacement) and frames the investment as risk reduction rather than cost savings.
Constraint-based (best for precision):
Generate 5 email subject lines for our product launch.
Rules:
- Under 50 characters each
- No exclamation marks
- Include the product name "Sentinel"
- A/B testable (vary one element per pair)
- No spam trigger words (free, urgent, act now)
Layer 3: Context Injection Methods
| Method | When to use | Example |
|---|---|---|
| Inline | Short context (<500 words) | "Given this customer complaint: [text]" |
| XML tags | Multiple context blocks | <document>, <conversation>, <data> |
| File reference | Long documents | "Read the attached PDF and..." |
| Variable slots | Reusable templates | {{customer_name}}, {{product}} |
| Retrieved context | RAG/search results | "Based on these search results: [results]" |
XML tag best practice:
<context>
<customer_profile>
Name: {{name}}
Plan: {{plan}}
Tenure: {{months}} months
Recent tickets: {{ticket_count}}
</customer_profile>
<complaint>
{{complaint_text}}
</complaint>
</context>
Given the customer profile and complaint above, draft a response that:
1. Acknowledges the specific issue
2. Proposes a concrete resolution
3. Includes a retention offer if tenure > 12 months
Layer 4: Output Shaping
Format specification:
Return your analysis as JSON:
{
"sentiment": "positive|negative|neutral",
"confidence": 0.0-1.0,
"key_phrases": ["phrase1", "phrase2"],
"summary": "one sentence",
"action_required": true|false
}
Few-shot examples (the single most powerful technique):
Classify these support tickets by urgency.
Example 1:
Input: "My account was hacked and someone transferred money out"
Output: { "urgency": "critical", "category": "security", "sla_hours": 1 }
Example 2:
Input: "How do I change my notification settings?"
Output: { "urgency": "low", "category": "how-to", "sla_hours": 48 }
Now classify:
Input: "{{ticket_text}}"
Phase 2: Advanced Techniques
Chain-of-Thought (CoT)
When to use: Math, logic, multi-step reasoning, analysis, decisions
Basic CoT:
Think through this step-by-step before giving your final answer.
Structured CoT:
Analyze this business decision using this process:
1. IDENTIFY: What are the key variables?
2. ANALYZE: What does the data tell us about each variable?
3. COMPARE: What are the tradeoffs between options?
4. DECIDE: Which option wins and why?
5. RISK: What could go wrong with this choice?
Show your reasoning fo
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- README.md
FAQ
What does the Prompt Engineering Mastery skill do?
Complete system for designing, testing, optimizing, and managing prompts for LLMs and AI agents. From first draft to production-grade prompt libraries.
How do I install the Prompt Engineering Mastery skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the Prompt Engineering Mastery skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…