Agent skill

Klaviyo SDK Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Apply production-ready Klaviyo SDK patterns for the klaviyo-api package.

MITAuto-check passedMarketing & SEO

Install Klaviyo SDK Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill klaviyo-sdk-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace klaviyo-sdk-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/klaviyo-sdk-patterns .claude/skills/klaviyo-sdk-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
klaviyo-sdk-patterns
GitHub stars
2.8k
Token cost
~1.5k tokens
SKILL.md length
498 words
Files
3 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Apply production-ready Klaviyo SDK patterns for the klaviyo-api package.

  • Implementing Klaviyo integrations
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 5 more sections
  • Needs KLAVIYO_PRIVATE_KEY
  • Refactoring SDK usage

What it does

Klaviyo SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Apply production-ready Klaviyo SDK patterns for the klaviyo-api package. Use when implementing Klaviyo integrations, refactoring SDK usage, or establishing team coding standards for Klaviyo API calls. Trigger with phrases like "klaviyo SDK patterns", "klaviyo best practices", "klaviyo code patterns", "idiomatic klaviyo", "klaviyo wrapper".

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/examples.md` and `references/implementation.md`). Compatibility notes: Designed for Claude Code

It sits in Marketing & SEO, covering Email marketing. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Implementing Klaviyo integrations
  • Refactoring SDK usage
  • Establishing team coding standards for Klaviyo API calls
  • With phrases like klaviyo SDK patterns

Example prompts

  • “klaviyo SDK patterns”
  • “klaviyo best practices”
  • “klaviyo code patterns”
  • “/klaviyo-sdk-patterns”

Requirements

  • Node.js
  • A credential in KLAVIYO_PRIVATE_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.klaviyo.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • KLAVIYO_PRIVATE_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Klaviyo SDK Patterns loads about 1.5k tokens when it runs, and up to ~3.6k if it reads all its reference files. Until then it costs about 91 tokens; SKILL.md has 498 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~91
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 498 words, ~1,514 tokens.

Download SKILL.mdSave it as .claude/skills/klaviyo-sdk-patterns/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
klaviyo-sdk-patterns
description
Apply production-ready Klaviyo SDK patterns for the klaviyo-api package. Use when implementing Klaviyo integrations, refactoring SDK usage, or establishing team coding standards for Klaviyo API calls. Trigger with phrases like "klaviyo SDK patterns", "klaviyo best practices", "klaviyo code patterns", "idiomatic klaviyo", "klaviyo wrapper".
allowed-tools
Read, Write, Edit
compatibility
Designed for Claude Code
version
1.7.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, klaviyo, email-marketing, cdp

Klaviyo SDK Patterns

Overview

Production-ready patterns for the klaviyo-api Node.js SDK: singleton sessions, type-safe wrappers, retry logic, cursor pagination, and multi-tenant support. Read the target project's Klaviyo files, then Write or Edit the src/klaviyo/ modules below into place so every call goes through one consistent, retry-aware layer instead of ad-hoc new ApiKeySession(...) calls scattered across the codebase.

The six patterns are summarized here with the essential skeleton; the full, copy-paste implementation for all of them lives in references/implementation.md, and combined worked examples with expected output are in references/examples.md.

Prerequisites

  • klaviyo-api package installed in the target project.
  • The klaviyo-install-auth setup completed, so KLAVIYO_PRIVATE_KEY is available in the environment.
  • A TypeScript project with strict mode enabled — every pattern is typed.

Instructions

Step 1: Singleton session (the foundation)

Create one lazily-initialized ApiKeySession and reuse it everywhere. Read the key from the environment, fail fast if it is missing, and expose a reset hook for tests.

typescript
// src/klaviyo/session.ts
import { ApiKeySession } from 'klaviyo-api';

let _session: ApiKeySession | null = null;

export function getSession(apiKey?: string): ApiKeySession {
  if (!_session) {
    const key = apiKey || process.env.KLAVIYO_PRIVATE_KEY;
    if (!key) throw new Error('KLAVIYO_PRIVATE_KEY is required');
    _session = new ApiKeySession(key);
  }
  return _session;
}
export function resetSession(): void { _session = null; }
Steps 2-6: the rest of the layer

Each builds on the session singleton. Write the corresponding file from references/implementation.md:

  • Step 2 — Type-safe API wrapper (api.ts): lazy getters for all 11 API clients (Profiles, Events, Lists, …) so unused clients are never constructed.
  • Step 3 — Error wrapper (errors.ts): parseKlaviyoError normalizes the raw error and safeCall returns { data, error } instead of throwing.
  • Step 4 — Retry (retry.ts): withRetry retries only on 429/5xx, honoring Klaviyo's Retry-After header, else exponential backoff with jitter.
  • Step 5 — Pagination (pagination.ts): paginate turns any cursor-based list endpoint into an AsyncGenerator, extracting page[cursor] for you.
  • Step 6 — Multi-tenant factory (multi-tenant.ts): getApisForTenant caches one client set per tenant id, isolating each customer's API key.
Show full SKILL.md (234 more words)Show less

Output

Applying this skill produces a src/klaviyo/ module set:

FileExportsPurpose
session.tsgetSession, resetSessionOne shared authenticated session
api.tsdefault apisLazy, type-safe access to every API client
errors.tsparseKlaviyoError, safeCallNon-throwing typed error results
retry.tswithRetryRate-limit/5xx retry honoring Retry-After
pagination.tspaginateAsync iteration over cursor pages
multi-tenant.tsgetApisForTenantPer-tenant client isolation

Callers then read as const { data, error } = await safeCall(() => apis.profiles.getProfiles(...)) instead of managing sessions and try/catch by hand.

SDK Conventions

ConventionExample
Property casingfirstName (not first_name)
Response accessresponse.body.data (not response.data)
Payload structure{ data: { type: 'profile', attributes: { ... } } }
Filter syntaxequals(email,"user@example.com")
Sort syntax'-datetime' (descending), 'datetime' (ascending)
Include relations{ include: ['lists'] }

Error Handling

ErrorStatusRetryableSolution
Invalid API key401NoCheck KLAVIYO_PRIVATE_KEY
Missing scope403NoAdd required scope to API key
Validation error400NoFix request payload
Rate limited429YesHonor Retry-After header
Server error500/503YesRetry with backoff
Conflict409NoResource already exists; use update

Examples

A quick taste — wrap any call so a failure returns a typed error instead of throwing:

typescript
import apis from './klaviyo/api';
import { safeCall } from './klaviyo/errors';

const { data, error } = await safeCall(
  () => apis.profiles.getProfiles({ pageSize: 20 }),
  'list profiles',
);
if (error) console.error(`Failed (${error.status}):`, error.errors[0].detail);
else console.log(`Fetched ${data!.body.data.length} profiles`);

Full worked examples — retrying a rate-limited write, paginating every profile, and serving two tenants from one process, each with expected output — are in references/examples.md.

Resources

Next Steps

Once the src/klaviyo/ layer is in place, apply the patterns in klaviyo-core-workflow-a for profile and list management — those workflows assume apis, safeCall, withRetry, and paginate already exist.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/.curated/klaviyo-sdk-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/examples.md
  • references/implementation.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Klaviyo SDK Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Klaviyo SDK Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Klaviyo SDK Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.5kAutomated safety check: PassMIT
Email Sequencefreekmurze/dotfiles1k19 repos~2kAutomated safety check: PassNone
Emailscoreyhaines31/marketingskills54k1 repos~2.8kAutomated safety check: PassMIT
Email SequenceLeoYeAI/openclaw-marketing-skills1k2 repos~2.1kAutomated safety check: PassCustom licence
Onboarding Crofreekmurze/dotfiles1k16 repos~1.6kAutomated safety check: PassNone
Marketing OsYuzzyuk/marketing-os540—~2.5kAutomated safety check: PassMIT

Similar skills

  • Email Sequence

    freekmurze/dotfiles

    When the user wants to create or optimize an email sequence, drip campaign, automated email flow, or lifecycle email program.

    1k GitHub starsUsed in 19 repos~2k tokens
    Marketing & SEOAuto-check passed
  • Emails

    coreyhaines31/marketingskills

    When the user wants to create or optimize an email sequence, drip campaign, automated email flow, or lifecycle email program.

    54k GitHub starsUsed in 1 repo~2.8k tokens
    Marketing & SEOAuto-check passed
  • Email Sequence

    LeoYeAI/openclaw-marketing-skills

    When the user wants to create or optimize an email sequence, drip campaign, automated email flow, or lifecycle email program.

    1k GitHub starsUsed in 2 repos~2.1k tokens
    Marketing & SEOAuto-check passed
  • Onboarding Cro

    freekmurze/dotfiles

    When the user wants to optimize post-signup onboarding, user activation, first-run experience, or time-to-value.

    1k GitHub starsUsed in 16 repos~1.6k tokens
    Marketing & SEOAuto-check passed
  • Marketing Os

    Yuzzyuk/marketing-os

    A complete marketing department in one skill. An agent skill from Yuzzyuk/marketing-os.

    540 GitHub stars~2.5k tokensUpdated 1 mo ago
    Marketing & SEOAuto-check passed
  • Onboarding

    Nexus-JPF/note-companion

    When the user wants to optimize post-signup onboarding, user activation, first-run experience, or time-to-value.

    870 GitHub starsUsed in 4 repos~1.6k tokens
    Marketing & SEOAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Klaviyo SDK Patterns

What does Klaviyo SDK Patterns do?

Apply production-ready Klaviyo SDK patterns for the klaviyo-api package. Klaviyo SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Apply production-ready Klaviyo SDK patterns for the klaviyo-api package.

When should I use Klaviyo SDK Patterns?

Klaviyo SDK Patterns fits situations like: implementing Klaviyo integrations; refactoring SDK usage; establishing team coding standards for Klaviyo API calls; with phrases like klaviyo SDK patterns.

How do I install Klaviyo SDK Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klaviyo-sdk-patterns -a claude-code`. Or copy the skill folder (skills/.curated/klaviyo-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/klaviyo-sdk-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Klaviyo SDK Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klaviyo-sdk-patterns -a codex`. Or copy the skill folder (skills/.curated/klaviyo-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/klaviyo-sdk-patterns in your project. Codex loads it when a task matches its description.

Can I use Klaviyo SDK Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klaviyo-sdk-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/klaviyo-sdk-patterns, .gemini/skills/klaviyo-sdk-patterns, .github/skills/klaviyo-sdk-patterns and .opencode/skills/klaviyo-sdk-patterns in your project.

What does Klaviyo SDK Patterns need to run?

Going by SKILL.md and its folder, Klaviyo SDK Patterns needs credentials named KLAVIYO_PRIVATE_KEY. Our summary lists: Node.js; A credential in KLAVIYO_PRIVATE_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit. Compatibility (from SKILL.md): Designed for Claude Code.

Does Klaviyo SDK Patterns access the network?

SKILL.md names 2 domains. As links in the text: developers.klaviyo.com and github.com. This is read from the text; nothing was executed.

Is Klaviyo SDK Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Klaviyo SDK Patterns use?

Klaviyo SDK Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Klaviyo SDK Patterns use?

About 1.5k tokens (SKILL.md is roughly 6.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.1k tokens, read only when the agent opens those files.

What are the alternatives to Klaviyo SDK Patterns?

Skills that share tags, products or a category with Klaviyo SDK Patterns: Email Sequence (freekmurze/dotfiles, 1k stars), Emails (coreyhaines31/marketingskills, 54k stars), Email Sequence (LeoYeAI/openclaw-marketing-skills, 1k stars) and Onboarding Cro (freekmurze/dotfiles, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Klaviyo SDK Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.