jeremylongshore/claude-code-plugins-plus-skills
customerio-pack
plugins/saas-packs/customerio-pack/skills/customerio-performance-tuning/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/saas-packs/customerio-pack/skills/customerio-performance-tuning/SKILL.md -a claude-code --skill customerio-performance-tuningInstallation paths:
.claude/skills/customerio-performance-tuning/# Customer.io Performance Tuning
## Overview
Optimize Customer.io API performance for high-volume and low-latency integrations.
## Prerequisites
- Customer.io integration working
- Monitoring infrastructure
- Understanding of your traffic patterns
## Instructions
### Step 1: Connection Pooling
```typescript
// lib/customerio-pooled.ts
import { TrackClient, RegionUS } from '@customerio/track';
import { Agent } from 'http';
import { Agent as HttpsAgent } from 'https';
// Create connection pool with keep-alive
const httpsAgent = new HttpsAgent({
keepAlive: true,
keepAliveMsecs: 30000,
maxSockets: 100,
maxFreeSockets: 20,
timeout: 30000
});
// Create client with connection pooling
export function createPooledClient(): TrackClient {
return new TrackClient(
process.env.CUSTOMERIO_SITE_ID!,
process.env.CUSTOMERIO_API_KEY!,
{
region: RegionUS,
// Pass custom agent for connection pooling
httpAgent: httpsAgent
}
);
}
// Singleton for connection reuse
let clientInstance: TrackClient | null = null;
export function getClient(): TrackClient {
if (!clientInstance) {
clientInstance = createPooledClient();
}
return clientInstance;
}
```
### Step 2: Batch Processing
```typescript
// lib/batch-processor.ts
import { TrackClient } from '@customerio/track';
interface BatchItem {
type: 'identify' | 'track';
userId: string;
data: Record<string, any>;
}
export class BatchProcessor {
private batch: BatchItem[] = [];
private batchSize: number;
private flushInterval: number;
private timer: NodeJS.Timer | null = null;
constructor(
private client: TrackClient,
options: { batchSize?: number; flushIntervalMs?: number } = {}
) {
this.batchSize = options.batchSize || 100;
this.flushInterval = options.flushIntervalMs || 1000;
this.startFlushTimer();
}
add(item: BatchItem): void {
this.batch.push(item);
if (this.batch.length >= this.batchSize) {
this.flush();
}
}
asy