The Definitive Reference for Mastering Anthropic’s Most Capable Model
Preface
- Who Should Read This Book
- How This Book Is Structured
- How to Use This Book
- Conventions Used in This Book
- A Note on Accuracy and Currency
- Acknowledgments
Introduction
- Why Prompting Matters More Than Ever
- How Claude Opus 5 Interprets Prompts
- What Makes Opus 5 Different
- How This Book Is Organized
- How to Use This Book
- A Note on Sources and Accuracy
Chapter 1: Understanding Claude Opus 5
- The Opus 5 Architecture: Capabilities, Context Window and Extended Thinking
- How Claude Reads Your Prompts: Instruction Processing and Attention
- System Behavior: Safety, Guardrails and Model Constraints
- When to Use Opus 5 (and When Not To)
Chapter 2: Prompt Fundamentals
- The Anatomy of a Well-Structured Prompt
- Clarity Over Cleverness: Writing Instructions Claude Can Follow
- Role Definition and Persona Assignment
- Task Specification: Goals, Steps and Success Criteria
- Constraints and Guardrails in Prompts
Chapter 3: System Prompts and Context Setup
- What System Prompts Do (and Don’t Do)
- Writing Robust System Prompts for Production
- Layered Instructions: Primary Rules, Secondary Guidelines and Edge Cases
- Managing Conflicting Instructions
- Versioning and Maintaining System Prompts
Chapter 4: Structured Prompting with XML
- Why XML Works: Separation of Concerns in Prompts
- Standard XML Tags and Their Purposes
- Organizing Complex Prompts with Nested Elements
- Combining XML Structure with Natural Language
- Common XML Patterns for Different Task Types
Chapter 5: Reasoning and Extended Thinking
- How Extended Thinking Works in Opus 5
- Activating and Configuring Extended Thinking
- Prompting for Deeper Reasoning Without Extended Thinking
- Multi-Step Problem Decomposition
- Verifying and Validating Model Reasoning
Chapter 6: Tool Use and Function Calling
- How Claude Uses Tools: The Mechanism
- Designing Tools for Effective Integration
- Prompting Patterns for Tool-Augmented Workflows
- Error Handling and Recovery in Tool Use
- Chaining Multiple Tools
Chapter 7: Few-Shot and Example-Based Prompting
- Why Examples Work: Pattern Learning in Foundation Models
- Designing Effective Few-Shot Examples
- Input-Output Pairs vs. Annotated Examples
- Balancing Example Quantity and Quality
- Dynamic and Contextual Examples
Chapter 8: Long-Context Strategies
- Understanding the Context Window: Capacity vs. Quality
- Information Placement: Where Things Go Matters
- Compression and Summarization Techniques
- Retrieval-Augmented Generation Patterns
- Case Study: Optimizing a Customer Support RAG System for Opus 5
- Managing Multi-Turn Conversations Over Long Horizons
Chapter 9: Output Control and Structured Responses
- Specifying Output Formats: JSON, XML, Markdown and Custom
- Schema-Constrained Generation
- Controlling Tone, Style and Length
- Enforcing Constraints and Avoiding Hallucination
- Post-Processing Hooks in Prompts
Chapter 10: Agentic Workflows and Autonomous Tasks
- What Makes a Good Agentic Prompt
- Planning, Execution and Self-Correction Patterns
- Multi-Agent Orchestration
- Memory and State Management
- Safety and Bounded Autonomy
- Case Study: Building an Agentic Refactoring Workflow for a Legacy Codebase
Chapter 11: Domain-Specific Prompt Patterns
- Software Engineering and Code Generation
- Research, Analysis and Synthesis
- Case Study: Reducing Hallucination in Legal Contract Review by 42 Percent
- Creative Writing and Content Creation
- Customer Support and Conversational AI
- Data Analysis and Business Intelligence
Chapter 12: Prompt Optimization, Debugging and Evaluation
- Diagnosing Prompt Problems
- Systematic Iteration Strategies
- A/B Testing Prompts
- Building Evaluation Harnesses
- Cost, Latency and Quality Tradeoffs
- Case Study: Iterative Prompt Optimization for a Medical Triage Classifier
Chapter 13: Reusable Templates and Prompt Libraries
- Template Design Principles
- Variable Injection and Dynamic Content
- Organizing Prompt Libraries
- Documentation and Governance
- Note on Migration from Previous Claude Versions
Chapter 14: Common Mistakes, Anti-Patterns and Pitfalls
- Overcomplication and Under-Specification
- Contradictory Instructions
- Fragile Prompt Structures
- Ignoring Model Constraints
- Migration Pitfalls from Earlier Claude Models
- Case Study: Migrating a Code Review System from Opus 4.8 to Opus 5
- Security and Privacy Risks
- Performance and Cost Pitfalls
Conclusion
- The Core Principles
- What Has Changed and What Endures
- A Final Checklist
- Looking Ahead
