--- name: claude-prompt-guide description: Anthropic official XML tag patterns and prompt engineering best practices. Document behavior control tags, system prompt internals, and the 10-Component Framework for effective Claude prompts. --- # SKILL: Claude Prompt Guide > **Purpose**: Document Anthropic XML tag patterns and prompt engineering best practices > **Target**: All agents creating or modifying system prompts, commands, and skills --- ## Quick Start ### When to Use This Skill - Creating new system prompts or agent instructions - Modifying existing command or skill behavior - Debugging prompt-related issues ### Quick Reference ```xml Defer action until conditions met Prefer tool use over chat responses Execute independent tools simultaneously Research before responding Prefer prose over lists ``` ## What This Skill Covers ### In Scope - Anthropic official behavior control XML patterns - System prompt internal tag structure - 10-Component Framework for effective prompts - Best practices (DO/DON'T) ### Out of Scope - Model-specific tuning → @.claude/skills/coding-standards/SKILL.md - Agent role definitions → @.claude/agents/CONTEXT.md --- ## Core Concepts ### CRITICAL: Tag Names Are Customizable **XML tag names are NOT magic** - the content/instructions matter, not the tag name. --- ## Official Behavior Control Tags ### `` - Control When to Defer Action **Purpose**: Prevent premature tool use or implementation **When to Use**: Read-only phases, planning stages ```xml This is a READ-ONLY planning phase. Do not use Edit tool or modify any files. Only proceed with implementation when the user explicitly runs `/01_confirm` → `/02_execute`. ``` ### `` - Encourage Proactive Tool Use **Purpose**: Prefer tool execution over chat-only responses ```xml Prefer taking action through tool use rather than providing lengthy explanations. ``` ### `` - Optimize for Parallel Execution **Purpose**: Execute independent operations simultaneously ```xml Execute independent operations in parallel using separate tool calls. ``` ### `` - Research Before Responding **Purpose**: Ensure thorough context gathering before response generation ```xml Before providing recommendations, thoroughly investigate the codebase: 1. Read relevant source files 2. Search for related patterns 3. Check existing tests and documentation ``` ### `` - Control Output Format **Purpose**: Prefer concise prose over structured lists ```xml Prefer natural language prose over excessive bullet points and markdown formatting. ``` --- ## System Prompt Internal Tags ```xml Core behavioral guidelines Context injection during conversation Guidelines for tool invocation Codebase and user instructions true ``` --- ## 10-Component Framework 1. **Role Definition**: Who is the AI acting as? 2. **Context & Scope**: What is covered and excluded? 3. **Quick Start**: How to get started immediately? 4. **Core Concepts**: Why does this approach work? 5. **Behavioral Instructions**: What should the AI do (or not do)? 6. **Tool Use Guidelines**: How should tools be invoked? 7. **Output Format**: What should responses look like? 8. **Examples & Patterns**: What do good implementations look like? 9. **Error Handling**: What to do when things fail? 10. **Further Reading**: Where to find more information? --- ## Best Practices (DO/DON'T) ### DO ✅ **Use XML tags for structure** - Provides clear delimiters for instructions ✅ **Focus on content, not tag names** - Clear instructions matter more than naming ✅ **Combine complementary tags** - Multiple tags for nuanced control ✅ **Provide examples** - Show good vs. bad patterns ✅ **Specify scope clearly** - In Scope vs. Out of Scope sections ### DON'T ❌ **Rely on tag name magic** - `` works as well as `` ❌ **Over-specify edge cases** - Let Claude reason within guidelines ❌ **Use tags for simple formatting** - Markdown is sufficient ❌ **Nest XML tags deeply** - Keep structure flat (1-2 levels max) ❌ **Duplicate instructions** - One clear statement > multiple vague ones --- ## Common Patterns ### Phase-Gated Workflow ```xml Phase 1 (Planning): Read-only, no file modifications Phase 2 (Execution): Requires `/01_confirm` command ``` ### Autonomous Execution ```xml Execute immediately when user request maps to clear tool usage. Execute independent operations simultaneously. ``` ### Quality Assurance ```xml Before analysis: Read files, search patterns, check documentation. ``` --- ## Further Reading **Internal**: @.claude/skills/claude-prompt-guide/REFERENCE.md - Detailed tag documentation, customization guide | @.claude/skills/claude-prompt-guide/EXAMPLES.md - Common patterns and 10-component framework examples | @.claude/skills/coding-standards/SKILL.md - Code quality standards | @.claude/agents/CONTEXT.md - Agent ecosystem | @.claude/commands/CONTEXT.md - Command workflows **External**: [Prompting best practices - Claude Docs](https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/claude-4-best-practices) | [Use XML tags - Claude Docs](https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/use-xml-tags) | [Claude Code Best Practices - Anthropic](https://www.anthropic.com/engineering/claude-code-best-practices) | [Piebald-AI/claude-code-system-prompts](https://github.com/Piebald-AI/claude-code-system-prompts) - 40+ system prompt examples --- **Version**: claude-pilot 4.4.43