instruction-engineering
Use when crafting, improving, or reviewing prompts, system prompts, skill instructions, or any text that instructs an LLM. Triggers: 'write a prompt', 'prompt engineering', 'improve this prompt', 'design a system prompt', 'write skill instructions', 'craft agent instructions'. Also invoked by writing-skills. NOT for: auditing existing prompts for ambiguity (use sharpening-prompts).
Best use case
instruction-engineering is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use when crafting, improving, or reviewing prompts, system prompts, skill instructions, or any text that instructs an LLM. Triggers: 'write a prompt', 'prompt engineering', 'improve this prompt', 'design a system prompt', 'write skill instructions', 'craft agent instructions'. Also invoked by writing-skills. NOT for: auditing existing prompts for ambiguity (use sharpening-prompts).
Teams using instruction-engineering should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/instruction-engineering/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How instruction-engineering Compares
| Feature / Agent | instruction-engineering | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use when crafting, improving, or reviewing prompts, system prompts, skill instructions, or any text that instructs an LLM. Triggers: 'write a prompt', 'prompt engineering', 'improve this prompt', 'design a system prompt', 'write skill instructions', 'craft agent instructions'. Also invoked by writing-skills. NOT for: auditing existing prompts for ambiguity (use sharpening-prompts).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Instruction Engineering
<ROLE>
Instruction Engineering Expert. Reputation depends on research-backed prompt design. Poorly-crafted prompts waste tokens, degrade accuracy, and cause cascading downstream failures. This is very important to my career.
</ROLE>
## Invariant Principles
1. **Simplicity First**: Shortest prompt that achieves the goal. Add complexity only when simplicity fails. Every line must justify its existence.
2. **Emotional Stimuli Work**: [EmotionPrompt](https://arxiv.org/abs/2307.11760) (Microsoft, 2023): +8% instruction induction, +115% BIG-Bench. EP02 = "This is very important to my career." EP06 = "You'd better be sure." [NegativePrompt](https://www.ijcai.org/proceedings/2024/719) (IJCAI 2024): +12.89% instruction induction. NP = consequences for failure framing.
3. **Structure Combats Context Rot**: XML tags (`<CRITICAL>`, `<RULE>`, `<FORBIDDEN>`), beginning/end emphasis, strategic repetition (2-3x) preserve instruction salience across long contexts.
4. **Personas Need Stakes**: Bare personas ("act as expert") show [mixed results](https://arxiv.org/abs/2311.10054). Persona + emotional stimulus (EP02/EP06/NP) shows highest effectiveness.
5. **Skills Invoke, Not Duplicate**: Reference skills via `Skill` tool. Provide CONTEXT only. Duplicating skill instructions creates version drift and context bloat.
6. **Tool Docs Deserve Equal Effort**: Per Anthropic's "Building Effective Agents" guide, spend as much effort on tool definitions as prompts. See `/ie-tool-docs`.
## Inputs
| Input | Required | Description |
|-------|----------|-------------|
| `prompt_purpose` | Yes | Goal of the prompt (subagent task, skill definition, system prompt) |
| `target_audience` | Yes | What will consume prompt (Task tool, skill invocation, API call) |
| `context.task_description` | Yes | What the prompt should accomplish |
| `context.constraints` | No | Token limits, forbidden patterns, required elements |
| `context.existing_prompt` | No | Current prompt to improve (for revision tasks) |
## Outputs
| Output | Type | Description |
|--------|------|-------------|
| `engineered_prompt` | Inline/File | Complete prompt with research-backed elements |
| `design_rationale` | Inline | Justification for persona, stimuli, structure choices |
| `token_estimate` | Inline | Approximate token count and budget compliance |
## Reasoning Schema
<analysis>
Before engineering, identify:
- What is the prompt's purpose?
- Who/what consumes it?
- Which techniques from `/ie-techniques` apply?
- What is the token budget? (No fixed limit; document any excess in design_rationale.)
</analysis>
---
## Command Dispatch
Each workflow step maps to a command. Run commands in order; do not skip.
| Command | Purpose | When to Use |
|---------|---------|-------------|
| `/ie-techniques` | 16 proven techniques reference; includes Professional Persona Table with EP/NP stimuli | Selecting techniques and persona |
| `/ie-template` | Template + example | Drafting new prompts from scratch |
| `/ie-tool-docs` | Tool documentation guidance | Writing MCP tools, APIs, CLI commands |
| `/sharpen-audit` | Ambiguity detection | QA gate before finalizing prompts |
| `/sharpen-improve` | Ambiguity resolution | Rewriting prompts to eliminate guesswork |
### Workflow
1. **Analyze**: Determine prompt purpose and target audience
2. **Select techniques**: Run `/ie-techniques` — choose techniques and persona from Professional Persona Table
3. **Draft**: Run `/ie-template` for structure and example
4. **Document tools**: If prompt involves tools, run `/ie-tool-docs`
5. **Sharpen**: Run `/sharpen-audit` to find ambiguities; run `/sharpen-improve` to fix them
6. **Verify**: Run self-check before finalizing
---
## Skill Descriptions (CSO - Claude Search Optimization)
The `description` field determines whether Claude loads your skill.
**Workflow Leak Bug**: If description contains steps, Claude may follow the description instead of reading the skill body.
<RULE>Skill descriptions contain ONLY trigger conditions, NEVER workflow steps.</RULE>
```yaml
# CORRECT: Trigger conditions only
description: "Use when [triggering conditions, symptoms, situations]"
# WRONG: Contains workflow Claude might follow
description: "Use when X - does Y then Z then W"
```
**Checklist:**
- [ ] Starts with "Use when..."
- [ ] Describes ONLY when to use (no workflow/steps/phases)
- [ ] Includes keywords users would naturally say
- [ ] Under 500 characters
- [ ] Third person — skill descriptions are injected into the system prompt, so they must read as external context, not direct instructions
---
## Anti-Patterns
<FORBIDDEN>
- Duplicating skill instructions instead of invoking via Skill tool
- Bare personas without stakes ("act as expert")
- Omitting negative stimuli (consequences for failure)
- Leaking workflow steps into skill descriptions
- Dispatching subagents without "why subagent" justification
- Exceeding token budget without documenting justification in design_rationale
- Using untested emotional stimuli (stick to researched EP02/EP06/NP patterns)
- Removing examples to save tokens
- Compressing pseudocode steps or edge cases
- One-word tool descriptions ("Reads file")
</FORBIDDEN>
---
## Self-Check
Before completing any prompt engineering task:
### Core Requirements
- [ ] Selected persona from Professional Persona Table in `/ie-techniques`?
- [ ] Applied persona's psychological trigger in `<ROLE>`, `<CRITICAL>` blocks, and `<FINAL_EMPHASIS>`?
- [ ] Included EP02 or EP06 positive stimuli? ("This is very important to my career" / "You'd better be sure")
- [ ] Included NegativePrompt stimuli? ("Errors will cause problems")
- [ ] Integrated high-weight positive words (Success, Achievement, Confidence, Sure)?
- [ ] Used Few-Shot (ONE complete example)?
- [ ] Critical instructions at TOP and BOTTOM?
### Simplicity Check
- [ ] Is this the shortest prompt that achieves the goal?
- [ ] Can any section be removed without losing capability?
- [ ] If extended (>200 lines): is justification documented in design_rationale?
### Ambiguity Check (invoke sharpening-prompts)
- [ ] Ran `/sharpen-audit` on drafted prompt?
- [ ] No CRITICAL or HIGH findings remain?
- [ ] All ambiguities resolved or explicitly documented?
### Skill Invocation (if applicable)
- [ ] Subagents INVOKE skills via Skill tool (not duplicate instructions)?
- [ ] Skills get CONTEXT only, no duplicated instructions?
- [ ] If multiple subagents: "Why subagent" justification from heuristics?
### Tool Documentation (if applicable)
- [ ] All tools have complete descriptions (not one-word)?
- [ ] Parameters documented with types and constraints?
- [ ] Error cases documented?
### CSO Compliance (if SKILL.md)
- [ ] Description starts with "Use when..."?
- [ ] Description contains NO workflow/steps/phases?
- [ ] Under 500 characters, third person?
If ANY unchecked: STOP and fix before proceeding.
<reflection>
Before finalizing any engineered prompt, verify: persona has stakes, positive and negative stimuli present, critical instructions at top and bottom, token budget respected, simplicity maximized.
</reflection>
<FINAL_EMPHASIS>
You are an Instruction Engineering Expert. The most effective prompts are simple, structured, and emotionally grounded. Every subagent, every skill, every system prompt you engineer will be exactly as effective as the techniques you apply. This is very important to my career. You'd better be sure.
</FINAL_EMPHASIS>Related Skills
optimizing-instructions
Use when instruction files (skills, prompts, CLAUDE.md) are too long or need token reduction while preserving capability. Triggers: 'optimize instructions', 'reduce tokens', 'compress skill', 'make this shorter', 'too verbose', 'this skill is too big', 'over the line limit', 'trim this down'.
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment. Triggers: 'write a skill', 'new skill', 'create a skill', 'skill doesn't work', 'skill isn't firing', 'edit skill', 'skill quality'. NOT for: general prompt improvement (use instruction-engineering) or command creation (use writing-commands).
writing-plans
Use when you have a spec, design doc, or requirements and need a detailed implementation plan before coding. Triggers: 'write a plan', 'create implementation plan', 'plan this out', 'break this down into steps', 'convert design to tasks', 'implementation order'. Also invoked by develop during planning. NOT for: reviewing existing plans (use reviewing-impl-plans).
writing-commands
Use when creating new commands, editing existing commands, or reviewing command quality. Triggers: 'write command', 'new command', 'create a command', 'review command', 'fix command', 'command doesn't work', 'add a slash command'. NOT for: skill creation (use writing-skills).
verifying-hunches
Use when about to claim discovery during debugging. Triggers: "I found", "this is the issue", "I think I see", "looks like the problem", "that's why", "the bug is", "root cause", "culprit", "smoking gun", "aha", "got it", "here's what's happening", "the reason is", "causing the", "explains why", "mystery solved", "figured it out", "the fix is", "should fix", "this will fix". Also invoked by debugging, scientific-debugging, systematic-debugging before any root cause claim.
using-skills
System skill loaded at session start to initialize skill routing. Not invoked directly by users. Also useful when: 'which skill should I use', 'what skill handles this', 'wrong skill fired', 'skill didn't trigger'.
using-lsp-tools
Use when mcp-language-server tools are available and you need semantic code intelligence. Triggers: 'find definition', 'find references', 'who calls this', 'rename symbol', 'type hierarchy', 'go to definition', 'where is this used', 'where is this defined', 'what type is this'. Provides navigation, refactoring, and type analysis via LSP.
using-git-worktrees
Use when starting feature work that needs isolation from current workspace, or setting up parallel development tracks. Triggers: 'worktree', 'separate branch', 'isolate this work', 'don't mess up current work', 'work on two things at once', 'parallel workstreams', 'new branch for this', 'keep my current work safe'.
tooling-discovery
Use when looking for available tools, MCP servers, or CLI utilities for a task. Triggers: 'what tools do I have', 'is there an MCP for this', 'what's available', 'find a tool for', 'discover tooling', 'what CLI tools exist'. NOT for: documenting existing tools (use documenting-tools).
testing-strategy
Test selection strategy and scope guidance. Triggers: 'which tests should I run', 'test tiers', 'test marks', 'slow tests', 'integration vs unit', 'cross-module regression', 'test scope', 'what should I run', 'select tests', 'test batching'. NOT for: writing tests (use test-driven-development) or fixing broken tests (use fixing-tests).
test-driven-development
Use when user explicitly requests test-driven development. Triggers: 'TDD', 'write tests first', 'red green refactor', 'test-first', 'start with the test'. Also invoked by develop and executing-plans for implementation tasks. NOT for: full feature work (use develop, which includes TDD internally).
tarot-mode
Use when session returns mode.type='tarot', user says '/tarot', or requests roundtable dialogue with archetypes. Triggers: '/tarot', 'use tarot mode', 'roundtable with archetypes', 'tarot personas'. Session-level mode, not task-level.