Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/klaviyo-performance-tuning

@0d57af8
Run it yourself

Optimize Klaviyo API performance with caching, batching, and pagination tuning. Use when experiencing slow API responses, implementing caching strategies, or optimizing request throughput for Klaviyo integrations. Trigger with phrases like "klaviyo performance", "optimize klaviyo", "klaviyo latency", "klaviyo caching", "klaviyo slow", "klaviyo batch".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/klaviyo-performance-tuning

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesexamples.md

≈652 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Klaviyo Performance Tuning — Worked Examples

These scenarios combine the building blocks from implementation.md to solve common real-world performance problems. Each one composes the caching, pagination, batching, and concurrency primitives defined in the main workflow.

Example 1: Fast, cached profile lookup by email

Combines sparse fieldsets (Step 1) with response caching (Step 2) so a repeated lookup during a request burst hits memory instead of the API.

import { cachedKlaviyoCall } from './cache';

async function getProfileFast(email: string) {
  return cachedKlaviyoCall(
    `profile:${email}`,
    () => profilesApi.getProfiles({
      filter: `equals(email,"${email}")`,
      fieldsProfile: ['email', 'first_name', 'created'],  // sparse payload
    }),
    5 * 60 * 1000  // 5 minute TTL
  );
}

Example 2: Export every profile in a large list

Combines cursor pagination (Step 3) with a bounded maxPages guard so an export of a multi-hundred-thousand-member list terminates predictably.

import { fetchAllPages } from './pagination';

async function exportList(listId: string) {
  const allProfiles = await fetchAllPages(
    (cursor) => listsApi.getListProfiles({ id: listId, pageCursor: cursor }),
    { maxPages: 500 }  // hard ceiling — process in chunks beyond this
  );
  console.log(`Exported ${allProfiles.length} profiles`);
  return allProfiles;
}

Example 3: Bulk-update 10,000 profiles under the rate limit

Combines the PQueue concurrency controller (Step 5) with progress logging so a large write job stays under Klaviyo's 75 req/s burst / 700 req/min ceiling.

import PQueue from 'p-queue';

const queue = new PQueue({ concurrency: 10, interval: 1000, intervalCap: 50 });

async function bulkUpdate(updates: Array<{ email: string; data: any }>) {
  await Promise.allSettled(
    updates.map(u => queue.add(() =>
      profilesApi.createOrUpdateProfile({
        data: { type: 'profile' as any, attributes: { email: u.email, ...u.data } },
      })
    ))
  );
}

Example 4: Measure where the time goes

Wrap any of the above in measuredCall (Step 6) and read a p95 summary to find the slow operation before you optimize it.

import { measuredCall, getPerfSummary } from './perf-monitor';

await measuredCall('getProfileFast', () => getProfileFast('a@example.com'), true);
await measuredCall('exportList', () => exportList(listId));

console.table(getPerfSummary());
// { getProfileFast: { avg: 2, p95: 5, count: 40 },
//   exportList:     { avg: 210, p95: 480, count: 12 } }

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides legitimate guidance and implementation code for optimizing Klaviyo API performance through batching, caching, and concurrency control. No security risks were identified.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago
What it can do
Reads files Edits files
version
1.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "klaviyo",
  "email-marketing",
  "cdp"
]
All 3 allowed tools
ReadWriteEdit
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/klaviyo-performance-tuning