Communication Best Practices
Master the art of communicating with Claude to get the best possible responses. Clear communication leads to better results.
Core Principles
1. Be Clear and Specific
Claude performs best with precise, unambiguous instructions.
❌ Vague:
Can you help with my code?
✅ Specific:
I have a React component that's causing infinite re-renders.
Here's the code: [code block]
The issue happens when I update the user state.
Can you identify the problem and suggest a fix?
2. Provide Context
Help Claude understand your situation fully.
Essential Context Includes:
- What you’re trying to achieve
- Your tech stack/environment
- What you’ve already tried
- Any constraints or requirements
- Relevant code or data
Communication Patterns
The Problem-Solution Format
**Problem**: [What's not working]
**Expected**: [What should happen]
**Actual**: [What's happening instead]
**Code**: [Minimal reproducible example]
**Question**: [Specific ask]
Effective Request Example
Context: Building a Node.js API with Express
Goal: Implement rate limiting
Current: Using express-rate-limit package
Issue: Rate limit not working for API keys
Constraint: Must support per-key limits
Question: How do I implement per-API-key rate limiting?
Best Practices
✅ DO: Be Direct
I need help optimizing this SQL query.
Current execution time is 5 seconds.
Goal is under 1 second.
[query here]
❌ DON’T: Waste Tokens on Pleasantries
Hello! I hope you're having a wonderful day!
I was wondering if maybe you could possibly help me...
✅ DO: Provide Examples
Create a function that formats dates:
- "2024-01-15" → "January 15, 2024"
- "2024-12-25" → "December 25, 2024"
❌ DON’T: Ask Multiple Unrelated Questions
1. How do I use React hooks?
2. What's the best database?
3. Should I use TypeScript?
4. Explain Docker to me
Advanced Techniques
Multi-Step Problems
Break complex tasks into stages:
I need to migrate PostgreSQL to MongoDB.
Let's approach this in stages:
1. First, analyze current schema
2. Then, design MongoDB schema
3. Next, create migration script
4. Finally, write validation tests
Let's start with step 1...
Iterative Refinement
Build solutions progressively:
- Start broad: “I need user authentication”
- Add specifics: “Using JWT with 24h expiration”
- Refine: “Need token refresh and RBAC”
- Implement: “Here’s my code, add refresh tokens?”
Communication Checklist
Before asking, verify:
- Clear objective
- Necessary context
- Specific question
- Expected format
- Examples provided
- Constraints listed
- Current progress
Practical Examples
Debugging Help
Good Request:
Getting "Cannot read property 'map' of undefined" error.
Context: React component fetching users
Error occurs: On initial render
Code:
const [users, setUsers] = useState();
useEffect(() => {
fetch('/api/users').then(res => res.json()).then(setUsers);
}, []);
return <ul>{users.map(u => <li>{u.name}</li>)}</ul>;
What's causing this and how do I fix it?
Architecture Advice
Good Request:
Designing real-time chat for 10K concurrent users.
Requirements:
- Message persistence
- File sharing (10MB max)
- Read receipts
- <100ms latency
Stack: Node.js, PostgreSQL
Questions:
1. WebSockets vs Server-Sent Events?
2. Database structure?
3. Caching strategy?
4. Scalability concerns?
Key Takeaways
- Clarity is king - Be specific
- Context matters - Provide background
- Structure helps - Organize logically
- Examples clarify - Show what you mean
- Iterate freely - Build progressively
- Be direct - Skip pleasantries
- Stay focused - One topic at a time