Implement Clay reference architecture with best-practice project layout. Use when designing new Clay integrations, reviewing project structure, or establishing architecture standards for Clay applications. Trigger with phrases like "clay architecture", "clay best practices", "clay project structure", "how to organize clay", "clay layout".
View on GitHubjeremylongshore/claude-code-plugins-plus-skills
clay-pack
plugins/saas-packs/clay-pack/skills/clay-reference-architecture/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/saas-packs/clay-pack/skills/clay-reference-architecture/SKILL.md -a claude-code --skill clay-reference-architectureInstallation paths:
.claude/skills/clay-reference-architecture/# Clay Reference Architecture
## Overview
Production-ready architecture patterns for Clay integrations.
## Prerequisites
- Understanding of layered architecture
- Clay SDK knowledge
- TypeScript project setup
- Testing framework configured
## Project Structure
```
my-clay-project/
├── src/
│ ├── clay/
│ │ ├── client.ts # Singleton client wrapper
│ │ ├── config.ts # Environment configuration
│ │ ├── types.ts # TypeScript types
│ │ ├── errors.ts # Custom error classes
│ │ └── handlers/
│ │ ├── webhooks.ts # Webhook handlers
│ │ └── events.ts # Event processing
│ ├── services/
│ │ └── clay/
│ │ ├── index.ts # Service facade
│ │ ├── sync.ts # Data synchronization
│ │ └── cache.ts # Caching layer
│ ├── api/
│ │ └── clay/
│ │ └── webhook.ts # Webhook endpoint
│ └── jobs/
│ └── clay/
│ └── sync.ts # Background sync job
├── tests/
│ ├── unit/
│ │ └── clay/
│ └── integration/
│ └── clay/
├── config/
│ ├── clay.development.json
│ ├── clay.staging.json
│ └── clay.production.json
└── docs/
└── clay/
├── SETUP.md
└── RUNBOOK.md
```
## Layer Architecture
```
┌─────────────────────────────────────────┐
│ API Layer │
│ (Controllers, Routes, Webhooks) │
├─────────────────────────────────────────┤
│ Service Layer │
│ (Business Logic, Orchestration) │
├─────────────────────────────────────────┤
│ Clay Layer │
│ (Client, Types, Error Handling) │
├─────────────────────────────────────────┤
│ Infrastructure Layer │
│ (Cache, Queue, Monitoring) │
└─────────────────────────────────────────┘
```
## Key Components
### Step 1: Client Wrapper
```typescript
// src/clay/client.ts
export class ClayService {
private client: ClayClien