klaviyo-sdk-patterns

Featured

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".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Klaviyo SDK Patterns ## Overview Production-ready patterns for the `klaviyo-api` Node.js SDK: singleton sessions, type-safe wrappers, retry logic, pagination, and multi-tenant support. ## Prerequisites - `klaviyo-api` package installed - Completed `klaviyo-install-auth` setup - TypeScript project with strict mode ## Instructions ### Step 1: Singleton Session Pattern ```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; } // For testing: reset the singleton export function resetSession(): void { _session = null; } ``` ### Step 2: Type-Safe API Wrapper ```typescript // src/klaviyo/api.ts import { ApiKeySession, ProfilesApi, EventsApi, ListsApi, SegmentsApi, CampaignsApi, FlowsApi, MetricsApi, TemplatesApi, CatalogsApi, DataPrivacyApi, WebhooksApi, } from 'klaviyo-api'; import { getSession } from './session'; // Lazy-initialized API clients -- avoids creating unused clients const apis = { get profiles() { return new ProfilesApi(getSession()); }, get events() { return new EventsApi(getSession()); }, get lists() { return new ListsApi(getSession()); }, get segments() { return new SegmentsApi(getSess...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

shopify-sdk-patterns

Apply production-ready patterns for @shopify/shopify-api including typed GraphQL clients, session management, and retry logic. Use when implementing Shopify integrations, refactoring SDK usage, or establishing team coding standards for Shopify. Trigger with phrases like "shopify SDK patterns", "shopify best practices", "shopify code patterns", "idiomatic shopify", "shopify client wrapper".

2,266 Updated today
jeremylongshore
AI & Automation Featured

apollo-sdk-patterns

Apply production-ready Apollo.io SDK patterns. Use when implementing Apollo integrations, refactoring API usage, or establishing team coding standards. Trigger with phrases like "apollo sdk patterns", "apollo best practices", "apollo code patterns", "idiomatic apollo", "apollo client wrapper".

2,266 Updated today
jeremylongshore
AI & Automation Featured

elevenlabs-sdk-patterns

Apply production-ready ElevenLabs SDK patterns for TypeScript and Python. Use when implementing ElevenLabs integrations, refactoring SDK usage, or establishing team coding standards for audio AI applications. Trigger: "elevenlabs SDK patterns", "elevenlabs best practices", "elevenlabs code patterns", "idiomatic elevenlabs", "elevenlabs typescript".

2,266 Updated today
jeremylongshore
AI & Automation Featured

hubspot-sdk-patterns

Apply production-ready @hubspot/api-client SDK patterns for TypeScript. Use when implementing HubSpot integrations, building typed wrappers, or establishing team standards for HubSpot CRM operations. Trigger with phrases like "hubspot SDK patterns", "hubspot best practices", "hubspot typed client", "hubspot api-client wrapper", "idiomatic hubspot".

2,266 Updated today
jeremylongshore
AI & Automation Featured

apify-sdk-patterns

Production-ready patterns for Apify SDK and apify-client in TypeScript. Use when building Actors with Crawlee, managing datasets/KV stores, or implementing robust client wrappers with retry and validation. Trigger: "apify SDK patterns", "apify best practices", "apify client wrapper", "crawlee patterns", "idiomatic apify".

2,266 Updated today
jeremylongshore