# Claude Desktop Setup

# Claude Desktop Setup

Learn how to setup Claude Desktop to work effectively with Tomba API for code generation and development assistance.

## Quick Use

### Direct Documentation Reference

In Claude Desktop, you can reference our documentation directly:

```
Please review the Tomba API documentation at https://docs.tomba.io/llms.txt and help me create a Python client for email verification with async support and proper error handling.
```

### Project Analysis

```
I'm building an email validation service. Can you analyze the Tomba API documentation at https://docs.tomba.io/llms.txt and suggest the best approach for:
1. Real-time email verification
2. Bulk email processing
3. Rate limiting and caching
4. Error handling strategies
```

## Project-level Setup

### Method 1: Documentation Preparation

Before starting a coding session, prepare your documentation:

1. **Download Documentation Locally**:

```bash
curl -L https://docs.tomba.io/llms.txt -o tomba-api-docs.txt
```

2. **Upload to Claude Desktop**:
    - Click the attachment button (📎)
    - Select the `tomba-api-docs.txt` file
    - This gives Claude persistent access to the documentation

### Method 2: Project Context File

Create a comprehensive project context file:

```markdown
# Project: Email Validation Service

# Technology Stack: Node.js, TypeScript, Express, Redis

# API Provider: Tomba.io

## Tomba API Documentation

[Upload tomba-api-docs.txt here]

## Project Requirements

- Real-time email verification
- Bulk processing capabilities
- Rate limiting (100 requests/minute)
- Redis caching (1-hour TTL)
- Comprehensive error handling
- TypeScript throughout
- Unit and integration tests

## Environment Variables

- TOMBA_API_KEY
- TOMBA_SECRET_KEY
- REDIS_URL
- PORT

## Current Architecture

[Describe your current setup]
```

## Claude Desktop Best Practices

### 1. Structured Conversations

Start conversations with clear context:

```
Context: Building a TypeScript Node.js service for email verification
Documentation: [Upload tomba-api-docs.txt]
Current Task: Implement rate limiting with Redis

Please help me create a rate limiting middleware that:
1. Uses Redis for distributed rate limiting
2. Implements sliding window algorithm
3. Returns appropriate HTTP status codes
4. Includes retry-after headers
5. Logs rate limit violations
```

### 2. Incremental Development

Build features step by step:

**Session 1**: Architecture & Planning

```
Based on the Tomba API docs, help me design the architecture for an email verification service that needs to handle 10k requests/day with high availability.
```

**Session 2**: Core Implementation

```
Let's implement the core Tomba API client. I need:
- TypeScript interfaces for all responses
- Proper authentication handling
- Request/response interceptors
- Error handling for all scenarios
```

**Session 3**: Advanced Features

```
Now let's add advanced features:
- Caching with Redis
- Rate limiting
- Request queuing for bulk operations
- Monitoring and metrics
```

### 3. Code Review and Optimization

Use Claude for code review:

```
Please review this Tomba API integration code for:
- Security best practices
- Performance optimizations
- Error handling completeness
- Code maintainability
- TypeScript type safety

[Paste your code here]
```

## Development Workflows

### 1. API Client Development

**Initial Prompt**:

```
Using the uploaded Tomba API documentation, create a complete TypeScript client library with:

1. Core client class with authentication
2. Service classes for each endpoint group:
   - Email finder
   - Email verifier
   - Domain search
   - Bulk operations
3. Comprehensive TypeScript types
4. Error handling with custom error classes
5. Rate limiting with exponential backoff
6. Request/response logging
7. Unit tests with Jest
8. Integration examples

Please start with the project structure and core client class.
```

### 2. Integration Development

**Prompt for Express.js Integration**:

```
Based on the Tomba API documentation, help me integrate email verification into an Express.js application:

1. Middleware for email validation
2. Route handlers for verification endpoints
3. Background job processing for bulk operations
4. Error handling middleware
5. Request logging and monitoring
6. API documentation with Swagger
7. Docker configuration
8. Environment-based configuration

Current Express app structure:
[Describe your current setup]
```

### 3. Testing Strategy

**Comprehensive Testing Prompt**:

```
Help me create a comprehensive testing strategy for my Tomba API integration:

1. Unit tests for all service methods
2. Integration tests with mock API responses
3. Error scenario testing
4. Rate limiting tests
5. Performance benchmarks
6. End-to-end tests
7. Test data fixtures
8. CI/CD pipeline integration

Current testing setup: Jest + Supertest
```

## Code Examples

### TypeScript Client Implementation

**Prompt**:

```
Create a production-ready TypeScript client for Tomba API with the following specifications:

- Singleton pattern for client instance
- Configurable base URL and timeouts
- Automatic retry with exponential backoff
- Request/response interceptors
- Comprehensive error handling
- Type-safe API methods
- Built-in caching support
- Request logging
```

**Generated Code Structure**:

```typescript
// types/tomba.ts
export interface TombaConfig {
    apiKey: string;
    secretKey: string;
    baseUrl?: string;
    timeout?: number;
    retryAttempts?: number;
    retryDelay?: number;
}

export interface EmailVerificationResult {
    email: string;
    result: "valid" | "invalid" | "unknown";
    score: number;
    reason: string;
    // ... other fields from API docs
}

// client/tomba-client.ts
export class TombaClient {
    private static instance: TombaClient;
    private config: Required<TombaConfig>;

    public static getInstance(config: TombaConfig): TombaClient {
        if (!TombaClient.instance) {
            TombaClient.instance = new TombaClient(config);
        }
        return TombaClient.instance;
    }

    // Implementation details...
}
```

### React Integration

**Prompt**:

```
Create React components and hooks for Tomba email verification:

1. TombaProvider context component
2. useEmailVerification hook
3. EmailVerificationForm component
4. BulkEmailProcessor component
5. VerificationResults display component
6. Error boundary for API errors
7. Loading states and progress indicators
8. Form validation integration
```

### Python Async Client

**Prompt**:

```
Build a Python async client for Tomba API using aiohttp:

1. AsyncTombaClient class
2. Async context manager support
3. Session management with connection pooling
4. Rate limiting with asyncio semaphores
5. Retry logic with exponential backoff
6. Comprehensive error handling
7. Type hints throughout
8. Async generators for bulk operations
9. Caching with TTL support
10. Logging integration
```

## Advanced Use Cases

### 1. Microservices Architecture

**Architecture Planning Prompt**:

```
Help me design a microservices architecture for email validation using Tomba API:

Services needed:
- Email verification service
- Bulk processing service
- Cache service (Redis)
- Queue service (Bull/Agenda)
- API gateway
- Monitoring service

Requirements:
- Handle 100k+ requests/day
- 99.9% uptime
- Horizontal scaling
- Circuit breaker pattern
- Distributed tracing
- Comprehensive monitoring

Please provide:
1. Service boundaries and responsibilities
2. Inter-service communication patterns
3. Data flow diagrams
4. Technology recommendations
5. Deployment strategy
```

### 2. Performance Optimization

**Optimization Prompt**:

```
My Tomba API integration is experiencing performance issues:

Current metrics:
- 500ms average response time
- 10% timeout rate
- High memory usage
- Occasional rate limit errors

Please analyze and optimize:
1. Connection pooling configuration
2. Request batching strategies
3. Caching implementation
4. Memory usage patterns
5. Rate limiting logic
6. Error recovery mechanisms

Current implementation:
[Paste relevant code]
```

### 3. Security Hardening

**Security Review Prompt**:

```
Please review my Tomba API integration for security best practices:

Areas to examine:
1. API key management and rotation
2. Request/response data sanitization
3. Rate limiting and DDoS protection
4. Input validation
5. Error message exposure
6. Logging security (no sensitive data)
7. HTTPS enforcement
8. Authentication token handling

Current security measures:
[Describe current implementation]
```

## File Management Tips

### Organizing Documentation

1. **Create Project Folder**: Organize files by project
2. **Version Documentation**: Keep versions of API docs for reference
3. **Context Files**: Maintain project-specific context files
4. **Code Snippets**: Save reusable code patterns

### Conversation Management

1. **Topic-based Conversations**: Separate conversations by feature/topic
2. **Regular Summaries**: Ask Claude to summarize progress
3. **Context Refresh**: Re-upload docs when starting new features
4. **Code Reviews**: Dedicated conversations for code review

## Troubleshooting

### Documentation Issues

1. **File Upload Fails**: Try smaller file sizes, split if necessary
2. **Context Lost**: Re-upload documentation if Claude seems unfamiliar
3. **Outdated Info**: Download fresh documentation periodically

### Code Generation Issues

1. **Be Specific**: Provide detailed requirements and constraints
2. **Include Context**: Always include relevant project information
3. **Iterative Approach**: Build complex features incrementally
4. **Review Outputs**: Validate generated code against documentation

### Performance Issues

1. **Reduce Context**: Use focused conversations for specific tasks
2. **Clear Conversations**: Start fresh for unrelated topics
3. **Optimize Prompts**: Be concise but complete in requests

## Additional Resources

- [Claude Desktop Guide](https://claude.ai/desktop)
- [Tomba API Reference](/api)
- [Authentication Documentation](/authentication)
- [Rate Limits Guide](/rate-limits)
- [Error Handling Guide](/error-handling)
