/klaviyo-pack:klaviyo-performance-tuningfrom klaviyo-pack
Optimizes Klaviyo API performance with caching, batching, pagination tuning, and sparse fieldsets. Use for slow responses or throughput optimization.
Ships in klaviyo-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Optimize Klaviyo API performance with response caching, request batching, cursor-based pagination, sparse fieldsets, and connection pooling. This skill diagnoses where an integration is slow, then applies the right technique — payload reduction, memory caching, bounded pagination, request coalescing, or rate-limit-aware concurrency.
Read this file for the workflow and the decision guide. Full, copy-pasteable code for every step lives in references/implementation.md; combined real-world scenarios live in references/examples.md.
klaviyo-api SDK installeddataloader, p-queue, lru-cache| Operation | Typical Latency | Max Page Size |
|---|---|---|
| Get Profile by ID | 50-150ms | N/A |
| Get Profiles (list) | 100-300ms | 20 (default), 100 (some endpoints) |
| Create Profile | 100-200ms | N/A |
| Create Event | 50-100ms | N/A |
| Get Segment Profiles | 200-500ms | 20 |
| Campaign Operations | 200-500ms | 20 |
Apply the techniques in order — each is independent, so start with the one that matches your bottleneck. Every step below has a full implementation in references/implementation.md.
Klaviyo supports JSON:API sparse fieldsets — request only the fields you need instead of the 20+ default attributes. This is the cheapest win and applies to every read.
// GOOD: Only fetch the fields you use (much smaller payload)
const profiles = await profilesApi.getProfiles({
fieldsProfile: ['email', 'first_name', 'created'], // snake_case = API names
});
Wrap read calls in an LRUCache keyed by query, with per-resource TTLs (profiles 5 min, segments 15 min — they change less often). See the caching implementation in references/implementation.md.
Use a fetchAllPages helper that follows the links.next cursor with a maxPages ceiling so large exports terminate predictably. See the pagination implementation in references/implementation.md.
Coalesce many getProfile(id) calls in a single tick into concurrency-controlled requests with DataLoader (maxBatchSize: 10, 50 ms window). See the batching implementation in references/implementation.md.
Drive bulk writes through a PQueue capped at 50 req/s — a safe margin under the 75 req/s burst limit — with progress logging. See the concurrency implementation in references/implementation.md.
Wrap calls in measuredCall and read a p95 summary via getPerfSummary to find the real bottleneck before optimizing. See the monitoring implementation in references/implementation.md.
Applying this skill produces:
src/klaviyo/cache.ts) that serves repeated reads from memory with per-resource TTLs.src/klaviyo/pagination.ts) that safely walks cursor-paginated endpoints to completion under a maxPages guard.src/klaviyo/perf-monitor.ts) emitting per-operation avg, p95, and count so you can verify the gains.| Issue | Cause | Solution |
|---|---|---|
| Cache stampede | Many requests on cache miss | Use stale-while-revalidate pattern |
| Pagination timeout | Very large datasets | Set maxPages limit, process in chunks |
| Rate limit on bulk ops | Too much concurrency | Reduce PQueue concurrency/intervalCap |
| Slow filter queries | Complex filter expressions | Simplify filters, use segment IDs instead |
Worked, end-to-end scenarios that combine the steps above are in references/examples.md:
PQueue concurrency under the rate limit.measuredCall + getPerfSummary to find the slow op first.Minimal caching example (full versions in the reference):
import { cachedKlaviyoCall } from './cache';
const profile = await cachedKlaviyoCall(
`profile:${email}`,
() => profilesApi.getProfiles({ filter: `equals(email,"${email}")` }),
5 * 60 * 1000 // 5 minute TTL
);
Once reads are cached and bulk writes are rate-limit-safe, profile the workload with getPerfSummary (Step 6) to confirm the p95 improvement, then tune TTLs and concurrency to your traffic. For cost optimization of the same integration, see the klaviyo-cost-tuning skill.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
klaviyo, api-performance, caching, pagination, email-marketing
24 skills in this plugin
/klaviyo-ci-integrationConfigure CI/CD pipelines for Klaviyo integrations with GitHub Actions.
Use when setting up automated testing, configuring CI secrets,
or integrating Klaviyo SDK tests into your build pipeline.
Trigger with phrases like "klaviyo CI", "klaviyo GitHub Actions",
"klaviyo automated tests", "CI klaviyo", "klaviyo pipeline".
/klaviyo-common-errorsDiagnose and fix common Klaviyo API errors and exceptions.
Use when encountering Klaviyo 4xx/5xx errors, debugging failed requests,
or troubleshooting SDK integration issues.
Trigger with phrases like "klaviyo error", "fix klaviyo",
"klaviyo not working", "debug klaviyo", "klaviyo 400", "klaviyo 429".
/klaviyo-core-workflow-aExecute Klaviyo primary workflow: profiles, lists, and subscriptions.
Use when creating/updating profiles, managing lists, subscribing contacts,
or syncing customer data to Klaviyo for email/SMS marketing.
Trigger with phrases like "klaviyo profiles", "klaviyo lists",
"klaviyo subscribe", "add contacts to klaviyo", "klaviyo customer data".
/klaviyo-core-workflow-bExecute the Klaviyo secondary workflow: event tracking, segments, and campaigns.
Use when you need to track customer events, query or size segments, build and send
email campaigns, or inspect metric-triggered flows through the Klaviyo API.
Trigger with phrases like "klaviyo events", "klaviyo segments", "klaviyo campaigns",
"track klaviyo event", "klaviyo flow trigger".
/klaviyo-cost-tuningOptimize Klaviyo costs through plan selection, contact management, and usage monitoring.
Use when analyzing Klaviyo billing, reducing active profile costs,
or implementing usage monitoring and budget alerts.
Trigger with phrases like "klaviyo cost", "klaviyo billing",
"reduce klaviyo costs", "klaviyo pricing", "klaviyo expensive", "klaviyo budget".
/klaviyo-data-handlingImplement Klaviyo data privacy, GDPR/CCPA compliance, and PII handling patterns.
Use when handling profile data, implementing right-to-deletion, configuring
data retention, or ensuring compliance with privacy regulations.
Trigger with phrases like "klaviyo data", "klaviyo PII",
"klaviyo GDPR", "klaviyo data retention", "klaviyo privacy", "klaviyo CCPA",
"klaviyo delete profile", "klaviyo data privacy".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin klaviyo-packOther plugins' skills for the same job