Agent skill
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'. Provides CSO (Claude Search Optimization) guidance for skill descriptions. Also invoked by writing-skills.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/instruction-engineering
SKILL.md
Instruction Engineering
Invariant Principles
-
Simplicity First: The most effective prompts are the shortest that achieve the goal. Add complexity only when simplicity fails. Every line must justify its existence.
-
Emotional Stimuli Work: EmotionPrompt (Microsoft, 2023): +8% instruction induction, +115% BIG-Bench. NegativePrompt (IJCAI 2024): +12.89% instruction induction, +46.25% BIG-Bench.
-
Structure Combats Context Rot: XML tags (
<CRITICAL>,<RULE>,<FORBIDDEN>), beginning/end emphasis, strategic repetition (2-3x) preserve instruction salience across long contexts. -
Personas Need Stakes: Bare personas ("act as expert") show mixed results. Persona + emotional stimulus shows highest effectiveness.
-
Skills Invoke, Not Duplicate: Reference skills via
Skilltool. Provide CONTEXT only. Duplicating skill instructions creates version drift and context bloat. -
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
Command Dispatch
This skill orchestrates prompt engineering through specialized commands:
| Command | Purpose | When to Use |
|---|---|---|
/ie-techniques |
16 proven techniques reference | Selecting which techniques to apply |
/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
- Analyze task: Determine prompt purpose and target audience
- Select techniques: Run
/ie-techniquesto choose applicable techniques - Draft prompt: Run
/ie-templatefor structure and example - Document tools: If prompt involves tools, run
/ie-tool-docs - Sharpen: Run
/sharpen-auditto find ambiguities,/sharpen-improveto fix them - Verify: Run self-check before finalizing
Skill Descriptions (CSO - Claude Search Optimization)
The description field determines whether Claude loads your skill. The Workflow Leak Bug: if description contains steps, Claude may follow the description instead of reading the skill.
<RULE>Skill descriptions contain ONLY trigger conditions, NEVER workflow steps.</RULE>
# 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 (injected into system prompt)
Anti-Patterns
Self-Check
Before completing any prompt engineering task:
Core Requirements
- Selected persona from emotional-stakes Professional Persona Table?
- Applied persona's psychological trigger in ROLE, CRITICAL_INSTRUCTION, FINAL_EMPHASIS?
- Included EP02 or EP06 positive stimuli? ("This is very important to my career")
- 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?
Ambiguity Check (invoke sharpening-prompts)
- Ran
/sharpen-auditon 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.
<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>
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?