intercom-performance-tuning
Optimize Intercom API performance with caching, search optimization, and pagination. Use when experiencing slow API responses, implementing caching strategies, or optimizing request throughput for Intercom integrations. Trigger with phrases like "intercom performance", "optimize intercom", "intercom latency", "intercom caching", "intercom slow", "intercom pagination".
Best use case
intercom-performance-tuning is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Optimize Intercom API performance with caching, search optimization, and pagination. Use when experiencing slow API responses, implementing caching strategies, or optimizing request throughput for Intercom integrations. Trigger with phrases like "intercom performance", "optimize intercom", "intercom latency", "intercom caching", "intercom slow", "intercom pagination".
Teams using intercom-performance-tuning should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/intercom-performance-tuning/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How intercom-performance-tuning Compares
| Feature / Agent | intercom-performance-tuning | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Optimize Intercom API performance with caching, search optimization, and pagination. Use when experiencing slow API responses, implementing caching strategies, or optimizing request throughput for Intercom integrations. Trigger with phrases like "intercom performance", "optimize intercom", "intercom latency", "intercom caching", "intercom slow", "intercom pagination".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Intercom Performance Tuning
## Overview
Optimize Intercom API performance through response caching, efficient search queries, cursor-based pagination, connection pooling, and request batching.
## Prerequisites
- `intercom-client` SDK installed
- Understanding of Intercom data model
- Redis or in-memory cache available (optional)
## Intercom API Latency Baselines
| Operation | Typical P50 | Typical P95 | Notes |
|-----------|-------------|-------------|-------|
| `GET /me` (health check) | 50ms | 150ms | Lightest endpoint |
| `GET /contacts/{id}` | 80ms | 200ms | Single lookup |
| `POST /contacts/search` | 120ms | 400ms | Depends on query complexity |
| `GET /conversations/{id}` | 100ms | 300ms | Heavier with parts (up to 500) |
| `POST /contacts` (create) | 150ms | 400ms | Write operation |
| `GET /contacts` (list) | 100ms | 350ms | Paginated, 50 per page |
| `POST /messages` | 200ms | 500ms | Triggers delivery pipeline |
## Instructions
### Step 1: Response Caching
Cache frequently accessed contacts and conversations to avoid repeated API calls.
```typescript
import { LRUCache } from "lru-cache";
import { IntercomClient } from "intercom-client";
import { Intercom } from "intercom-client";
const contactCache = new LRUCache<string, Intercom.Contact>({
max: 5000,
ttl: 5 * 60 * 1000, // 5 minutes
});
const client = new IntercomClient({
token: process.env.INTERCOM_ACCESS_TOKEN!,
});
async function getContact(contactId: string): Promise<Intercom.Contact> {
const cached = contactCache.get(contactId);
if (cached) return cached;
const contact = await client.contacts.find({ contactId });
contactCache.set(contactId, contact);
return contact;
}
// Invalidate on update
async function updateContact(
contactId: string,
data: Partial<Intercom.UpdateContactRequest>
): Promise<Intercom.Contact> {
contactCache.delete(contactId);
const updated = await client.contacts.update({ contactId, ...data });
contactCache.set(contactId, updated);
return updated;
}
// Webhook-driven cache invalidation
function handleContactWebhook(notification: any): void {
const contactId = notification.data?.item?.id;
if (contactId) {
contactCache.delete(contactId);
}
}
```
### Step 2: Efficient Search Queries
Minimize search latency by using selective queries and limiting fields.
```typescript
// BAD: Overly broad search, fetching too many results
const allUsers = await client.contacts.search({
query: { field: "role", operator: "=", value: "user" },
pagination: { per_page: 150 }, // Max is 150
});
// GOOD: Targeted search with specific filters
const recentPro = await client.contacts.search({
query: {
operator: "AND",
value: [
{ field: "role", operator: "=", value: "user" },
{ field: "custom_attributes.plan", operator: "=", value: "pro" },
{ field: "last_seen_at", operator: ">", value: Math.floor(Date.now() / 1000) - 86400 },
],
},
pagination: { per_page: 25 },
sort: { field: "last_seen_at", order: "descending" },
});
```
### Step 3: Optimized Pagination
```typescript
// Stream contacts with memory-efficient cursor pagination
async function* streamContacts(
client: IntercomClient,
perPage = 50
): AsyncGenerator<Intercom.Contact> {
let startingAfter: string | undefined;
do {
const page = await client.contacts.list({ perPage, startingAfter });
for (const contact of page.data) {
yield contact;
}
startingAfter = page.pages?.next?.startingAfter ?? undefined;
// Small delay to avoid rate limits on large datasets
if (startingAfter) {
await new Promise(r => setTimeout(r, 100));
}
} while (startingAfter);
}
// Process contacts in batches for efficiency
async function processContactsInBatches(
client: IntercomClient,
processor: (contacts: Intercom.Contact[]) => Promise<void>,
batchSize = 100
): Promise<number> {
let batch: Intercom.Contact[] = [];
let total = 0;
for await (const contact of streamContacts(client)) {
batch.push(contact);
if (batch.length >= batchSize) {
await processor(batch);
total += batch.length;
batch = [];
}
}
if (batch.length > 0) {
await processor(batch);
total += batch.length;
}
return total;
}
```
### Step 4: Connection Pooling
```typescript
import { Agent } from "https";
// Reuse TCP connections (HTTP keep-alive)
const agent = new Agent({
keepAlive: true,
maxSockets: 10, // Max concurrent connections
maxFreeSockets: 5, // Keep idle connections warm
timeout: 30000, // Connection timeout
});
// Apply to fetch calls if using raw API
const response = await fetch("https://api.intercom.io/contacts", {
headers: { Authorization: `Bearer ${token}` },
agent,
} as any);
```
### Step 5: Parallel Requests with Rate Awareness
```typescript
import PQueue from "p-queue";
const queue = new PQueue({
concurrency: 5, // Max parallel requests
interval: 1000, // Per second
intervalCap: 100, // Max per interval
});
// Batch-lookup contacts by ID
async function getContactsBatch(
client: IntercomClient,
contactIds: string[]
): Promise<Map<string, Intercom.Contact>> {
const results = new Map<string, Intercom.Contact>();
await Promise.all(
contactIds.map(id =>
queue.add(async () => {
// Check cache first
const cached = contactCache.get(id);
if (cached) {
results.set(id, cached);
return;
}
try {
const contact = await client.contacts.find({ contactId: id });
contactCache.set(id, contact);
results.set(id, contact);
} catch {
// Skip not-found contacts
}
})
)
);
return results;
}
```
### Step 6: Performance Monitoring
```typescript
async function measuredCall<T>(
name: string,
operation: () => Promise<T>
): Promise<T> {
const start = performance.now();
try {
const result = await operation();
const duration = performance.now() - start;
console.log(JSON.stringify({
metric: "intercom.api.call",
operation: name,
duration_ms: Math.round(duration),
status: "success",
}));
return result;
} catch (error) {
const duration = performance.now() - start;
console.error(JSON.stringify({
metric: "intercom.api.call",
operation: name,
duration_ms: Math.round(duration),
status: "error",
error: (error as Error).message,
}));
throw error;
}
}
// Usage
const contact = await measuredCall("contacts.find", () =>
client.contacts.find({ contactId: "abc123" })
);
```
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Cache stampede | Many concurrent cache misses | Use mutex/lock per key |
| Memory pressure | Cache too large | Set `max` on LRUCache |
| Stale data | TTL too long | Use webhook invalidation |
| Pagination timeouts | Large data set + slow network | Reduce per_page, add delays |
| Rate limit during batch | Too many parallel requests | Lower PQueue concurrency |
## Resources
- [Pagination](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination)
- [Search Contacts](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/searchcontacts)
- [LRU Cache](https://github.com/isaacs/node-lru-cache)
- [p-queue](https://github.com/sindresorhus/p-queue)
## Next Steps
For cost optimization, see `intercom-cost-tuning`.Related Skills
running-performance-tests
Execute load testing, stress testing, and performance benchmarking. Use when performing specialized testing. Trigger with phrases like "run load tests", "test performance", or "benchmark the system".
workhuman-performance-tuning
Workhuman performance tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman performance tuning".
workhuman-cost-tuning
Workhuman cost tuning for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman cost tuning".
wispr-performance-tuning
Wispr Flow performance tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr performance tuning".
wispr-cost-tuning
Wispr Flow cost tuning for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr cost tuning".
windsurf-performance-tuning
Optimize Windsurf IDE performance: indexing speed, Cascade responsiveness, and memory usage. Use when Windsurf is slow, indexing takes too long, Cascade times out, or the IDE uses too much memory. Trigger with phrases like "windsurf slow", "windsurf performance", "optimize windsurf", "windsurf memory", "cascade slow", "indexing slow".
windsurf-cost-tuning
Optimize Windsurf licensing costs through seat management, tier selection, and credit monitoring. Use when analyzing Windsurf billing, reducing per-seat costs, or implementing usage monitoring and budget controls. Trigger with phrases like "windsurf cost", "windsurf billing", "reduce windsurf costs", "windsurf pricing", "windsurf budget".
webflow-performance-tuning
Optimize Webflow API performance with response caching, bulk endpoint batching, CDN-cached live item reads, pagination optimization, and connection pooling. Use when experiencing slow API responses or optimizing request throughput. Trigger with phrases like "webflow performance", "optimize webflow", "webflow latency", "webflow caching", "webflow slow", "webflow batch".
webflow-cost-tuning
Optimize Webflow costs through plan selection, CDN read optimization, bulk endpoint usage, and API usage monitoring with budget alerts. Use when analyzing Webflow billing, reducing API costs, or implementing usage monitoring for Webflow integrations. Trigger with phrases like "webflow cost", "webflow billing", "reduce webflow costs", "webflow pricing", "webflow budget".
vercel-performance-tuning
Optimize Vercel deployment performance with caching, bundle optimization, and cold start reduction. Use when experiencing slow page loads, optimizing Core Web Vitals, or reducing serverless function cold start times. Trigger with phrases like "vercel performance", "optimize vercel", "vercel latency", "vercel caching", "vercel slow", "vercel cold start".
vercel-cost-tuning
Optimize Vercel costs through plan selection, function efficiency, and usage monitoring. Use when analyzing Vercel billing, reducing function execution costs, or implementing spend management and budget alerts. Trigger with phrases like "vercel cost", "vercel billing", "reduce vercel costs", "vercel pricing", "vercel expensive", "vercel budget".
veeva-performance-tuning
Veeva Vault performance tuning for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva performance tuning".