1. Define the Goal, Not the Steps
- Don't: "Open file X, find function Y, change line Z"
- Do: "Fix the bug where users can't log in with special characters"
2. Provide Context, Not Instructions
- Don't: "Use React hooks"
- Do: "This project uses React 18 with TypeScript, see CLAUDE.md for conventions"
3. Verify, Don't Trust
- Always have a way to validate agent output
- Tests, type checking, linting, human review
- "Trust but verify" — Compound Engineering principle
4. Iterate in Loops
- Agent tries → You review → Provide feedback → Agent tries again
- This is faster than trying to specify everything upfront
5. Invest in Infrastructure
- Good CLAUDE.md = better agent performance
- Good tests = safer agent autonomy
- Good CI/CD = faster feedback loops
6. Use the "Best of N" Pattern
Generate multiple versions, cherry-pick the best:
You: "Generate 3 different approaches to this authentication flow.
For each, explain the tradeoffs."
Then:
- Review all versions
- Pick the best one, or combine elements from multiple
- Refine the chosen approach
Why it works: AI generates diverse solutions. You bring judgment to select.
7. Branch First, Experiment Freely
Always create a git branch before major AI-assisted changes:
git checkout -b feature/ai-experiment
- AI can try, fail, and retry without risk
- Easy to discard bad approaches
- Compare AI output against your baseline
- Merge only what works
Prompt Patterns
Effective patterns for getting better results from Claude Code.
Pattern 1: The Specification Prompt
Front-load all context, then state the task:
Context: - This is a React 18 app with TypeScript - We use Tailwind for styling - Components go in /src/components - We follow the existing Button component pattern Task: Create a Modal component that: - Accepts title, children, and onClose props - Has animated entrance/exit - Closes on backdrop click and Escape key - Is accessible (focus trap, aria labels)
Pattern 2: The Critique Prompt
Have Claude review its own work:
You: "Now review the code you just wrote. Check for:
- Security vulnerabilities
- Edge cases not handled
- Performance issues
- Accessibility problems
Then fix any issues you find."
Pattern 3: The Three Experts
Get multiple perspectives on design decisions:
You: "Approach this problem as three experts would:
1. A senior security engineer
2. A performance optimization specialist
3. A UX-focused developer
What would each prioritize? Where do they disagree?"
Pattern 4: The Incremental Build
For complex features, build in stages:
Step 1: "Create the data model and types" Step 2: "Add the API layer" Step 3: "Build the UI components" Step 4: "Connect everything and add error handling" Step 5: "Write tests for the critical paths"
Pattern 5: The Constraint Prompt
Limit scope to get focused output:
You: "Implement ONLY the login form. Do not:
- Add routing
- Create the API client
- Set up state management
I'll handle those separately."