The quality of your prompts directly affects the quality of Claude Code's output. This chapter covers proven patterns for getting the results you want.
The Anatomy of a Good Prompt
Effective prompts typically include three components: context, intent, and constraints.
Context
What's the current state? What files are involved? What problem are you solving? Claude Code can read your codebase, but explicitly pointing to relevant areas helps focus the response.
Intent
What do you want to achieve? Be clear about whether you want code written, a concept explained, a bug fixed, or an architecture discussed.
Constraints
Are there specific requirements? Technology choices? Style guidelines? Mentioning constraints upfront prevents back-and-forth revisions.
Prompting Patterns
- Step-by-step: Break complex tasks into sequential steps
- Example-driven: Show an example of what you want
- Negative constraints: Specify what you don't want
- Role-based: Ask Claude to act as a specific type of expert
Common Pitfalls
Avoid vague requests like "make it better" or "clean this up". Instead, specify what "better" means - faster performance? More readable? Better error handling? The more precise your request, the more useful the response.
Key Takeaways
Good prompts include context, intent, and constraints
Use patterns like step-by-step, example-driven, and role-based prompting
Be specific about what "better" means
Avoid vague requests - specify exactly what improvement you're looking for
Negative constraints help prevent unwanted output
Tell Claude what you don't want as well as what you do