/klaviyo-pack:klaviyo-reference-architecturefrom klaviyo-pack
Provides a layered architecture for Klaviyo integrations with service patterns, event-driven sync, and project layout best practices.
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.
Production-ready architecture for Klaviyo integrations: a layered project structure, service patterns, event-driven sync, and the klaviyo-api SDK wired into a real application. SKILL.md gives you the four-layer contract and the skeleton you scaffold from; the deep material lives in references/ so you pull code only when you reach that layer.
klaviyo-api installedUse Write to scaffold the directory tree, then fill each layer bottom-up. The four layers and their one-way call rule:
API / Webhook Layer → routes + webhook handlers (calls Service only)
Service Layer → profile-sync, event-tracker, campaigns (calls SDK + Infra)
Klaviyo SDK Layer → ApiKeySession, ProfilesApi, EventsApi (never calls upward)
Infrastructure Layer → Redis cache, BullMQ queue, Prisma DB, OTel monitoring
src/{klaviyo,services,webhooks,jobs,middleware,config,health} layout. Full annotated tree: architecture.md.loadConfig() returns environment-specific keys, rate limits, and cache TTLs — every other layer reads from it. Code: implementation.md Step 1.ProfileSyncService (bidirectional upsert) and EventTracker (server-side Placed Order / custom events). Both route Klaviyo calls through withRateLimitRetry. Code: implementation.md Steps 2–3.syncToKlaviyo(), purchase → trackPurchase(), inbound profile.updated webhook → WebhookRouter.routeEvent() → local DB. Diagram: architecture.md.When reviewing an existing project, Read its src/ tree and Grep for cross-layer imports that break the one-way rule (SDK importing a service, a route importing the SDK directly).
Applying this skill produces:
src/ tree matching the four-layer contract, with SDK, service, webhook, job, middleware, config, and health directories.config/klaviyo.ts plus ProfileSyncService and EventTracker service classes ready to call from routes and jobs.| Issue | Cause | Solution |
|---|---|---|
| Circular deps | Wrong layering | Services call SDK, never the reverse |
| Sync conflicts | Both sides update | Last-write-wins with sync timestamp |
| Queue backlog | Klaviyo slow/down | Circuit breaker + dead letter queue |
| Type mismatches | SDK version mismatch | Pin SDK version, run tsc --noEmit in CI |
Scaffold a new integration — "Set up a Klaviyo integration for our Node app." Create the layered tree, drop in loadConfig(), then ProfileSyncService and EventTracker. Full code per step: implementation.md.
Track a purchase from your backend:
await new EventTracker().trackPurchase({
email: order.email,
orderId: order.id,
total: order.total,
items: order.lineItems,
});
Review project structure — "Is our Klaviyo code layered correctly?" Grep for imports that violate the one-way call rule and check webhook handlers verify HMAC signatures. Layer contract: architecture.md.
For multi-environment configuration and per-stage key management, see the klaviyo-multi-env-setup skill in this pack.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin klaviyo-pack24 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-Other plugins' skills for the same job