| name | prompt-engineering |
| description | Expert prompt engineering guidance with proven techniques and anti-patterns. Invoke this skill whenever writing, editing, reviewing, or refining any prompt that will be interpreted by an AI model — system prompts, agent instructions, tool-use prompts, command templates, multi-step task prompts, or agentic workflows. Use it even when the task doesn't explicitly mention 'prompt engineering' — if the output is instructions for an AI, this skill makes them significantly better. Trigger for both user-requested prompt work and when autonomously generating prompts as part of a larger task (e.g. creating skills, writing agent instructions, drafting review templates). |
| allowed-tools | ["WebFetch(https://platform.claude.com/docs/en/build-with-claude/prompt-engineering*)"] |
Prompt Engineering
Start here: what are you doing?
Crafting prompts
The one principle that matters most: explain why, not just what. Claude reasons better with context than rigid rules. Instead of NEVER use ellipses, write Your response will be read aloud by a text-to-speech engine, so never use ellipses since the TTS engine can't pronounce them. Claude generalizes from the reasoning.
Structure for any non-trivial prompt:
- Role/context — who is Claude, what's the situation
- Input — wrapped in descriptive XML tags (
<code>, <document>, <query>)
- Task — what to do, with success criteria
- Output format — show one concrete example rather than describing the format in prose
- Use
{{variables}} for dynamic content to make prompts reusable and testable
When adding examples (few-shot): use 3–5 diverse examples wrapped in <example> tags. Cover edge cases. Ask yourself: would a pattern-matcher pick up unintended shortcuts from these examples?
Prompt review checklist
Run through this when reviewing or debugging a prompt:
Agentic prompt patterns
These are the non-obvious patterns from the official docs — things Claude wouldn't do by default without guidance.
Autonomy/safety balance — Without guidance, agents may take hard-to-reverse actions (deleting files, force-pushing, posting externally). Add a principle like: "Take local, reversible actions freely. For destructive or externally-visible actions, confirm first." List specific examples of what warrants confirmation.
Subagent orchestration — Current Claude models proactively spawn subagents. Watch for overuse: the model may spawn a subagent for a task that a single grep could handle. Add guidance: "Use subagents for parallel, independent workstreams. For simple tasks, sequential operations, or single-file edits, work directly."
Overthinking and over-exploration — Current models do significantly more upfront exploration than predecessors. If your prompt previously encouraged thoroughness ("always explore before acting", "when in doubt, research more"), dial it back. Replace blanket defaults ("Default to using [tool]") with targeted ones ("Use [tool] when it would enhance your understanding").
Long-horizon state tracking — For tasks spanning multiple context windows:
- First window: set up framework (tests, scripts, structured state files)
- Subsequent windows: iterate on a todo-list, discover state from filesystem and git
- Use structured formats (JSON) for status tracking, freeform text for progress notes
- Encourage git usage for state checkpoints
Overeagerness / overengineering — Current models tend to create extra files, add unnecessary abstractions, or build in unrequested flexibility. Counter with: "Only make changes that are directly requested or clearly necessary. The right amount of complexity is the minimum needed for the current task."
Minimizing hallucinations in agentic coding — Add: "Never speculate about code you haven't read. If a file is referenced, read it before answering."
Going deeper
For technique-specific detail, consult references/reference.md — it lists the source URLs to WebFetch, with a one-line description of what each doc covers. Pick the doc that matches the topic (general principles and migration, when-to-prompt-engineer vs. switch models, or Console tooling) and fetch only that one.