text
stringlengths
0
59.1k
---
You are a performance optimization expert.
Focus areas:
1. Algorithm complexity analysis
2. Database query optimization
3. Memory usage patterns
4. Caching strategies
5. Async/parallel processing opportunities
Always:
- Measure before and after (with actual numbers)
- Don't sacrifice readability for 2ms gains
- Leave comments explaining the black magic
- Test the crap out of optimized code
```
## War Stories from Production
### The Authentication Nightmare That Became a Dream
Two months ago: 47 files of legacy auth code. Session-based, poorly documented, and held together by prayers. Boss wanted JWT. Timeline: "yesterday."
```bash
$ claude "Help me refactor our authentication system to use JWT tokens"
# Claude Code coordinates multiple subagents:
# 1. Analyzer agent maps out the current system
# 2. Architect agent plans the refactoring
# 3. Implementation agent makes the changes
# 4. Test writer ensures everything still works
# 5. Code reviewer checks the final result
```
![claude code concept](https://cdn.voltagent.dev/2025-07-30-claude-code-agents/war-stories.png)
### The 2 AM Wake-Up Call
You know the drill. Phone buzzing. Slack notifications. "URGENT: Users can't login after 5PM EST." Half-awake, laptop barely open, and the CTO is already asking for updates.
```bash
$ claude "Users report login failures after 5PM - help me debug this"
# 2:07 AM: "Interesting pattern - only affecting EST users"
# 2:12 AM: "Found it - JWT expiry calculation ignores DST"
# 2:18 AM: "Here's the fix with tests"
# 2:25 AM: Deployed, working, back to bed
# 2:26 AM: Made note to create timezone specialist agent
```
### The Documentation Debt Reckoning
73 endpoints. 20 documented (poorly). Every sprint: "we'll document it next time." Spoiler: we never did. Until...
```bash
$ claude "Generate comprehensive API documentation for our REST endpoints"
# What actually happened:
# - Found 12 endpoints I forgot existed
# - Generated OpenAPI spec that actually worked in Swagger
# - Added curl examples from our test suite
# - Even documented the weird auth headers
# - Monday standup: "Yeah, I documented everything" *mic drop*
```
## Lessons Learned the Hard Way
### Finding the Right Balance
I went overboard at first. Had a subagent for everything - even one just for formatting console.log statements (don't judge). Here's what actually works:
-  Code Reviewer (broad, useful role)
-  Test Writer (clear specialty)
- L JavaScript Array Method Optimizer (too specific)
### Tool Permissions
Lesson from the trenches - treat permissions like production access:
- Code reviewers: Read-only (they suggest, not edit)
- Test writers: Read, write, run tests (but can't push)
- Debuggers: Almost everything (except that one time it pushed a debug log to main... never again)
### Writing Prompts That Actually Work
Forget generic instructions. Be specific AF:
- ❌ "Review code for quality"
- ✅ "Flag any function over 20 lines, any file without tests, and anywhere we're not using our custom error handler"
Include your team's weird rules:
- "We use 'data' not 'response' for API returns"
- "Tests must use 'it' not 'test'"
- "No default exports, ever"
### Version Control