Best Practices
Guidelines for building reliable, secure, and efficient agents.Agent Design
Keep Tools Focused
Each tool should do one thing well:Write Clear Tool Descriptions
Claude uses descriptions to decide when to use tools:Use CLAUDE.md Effectively
Structure your CLAUDE.md for clarity:Error Handling
Handle Tool Failures Gracefully
Validate Inputs
Set Timeouts
Security
Never Trust User Input
Restrict File Access
Sanitize Command Execution
Use Secrets for Credentials
Performance
Minimize API Calls
Stream Large Outputs
For long responses, consider streaming:Clean Up Resources
Testing
Test Locally First
Test Edge Cases
- Empty prompts
- Very long prompts
- Prompts that might cause infinite loops
- Prompts with special characters