jeremylongshore/claude-code-plugins-plus-skills
lindy-pack
plugins/saas-packs/lindy-pack/skills/lindy-sdk-patterns/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/saas-packs/lindy-pack/skills/lindy-sdk-patterns/SKILL.md -a claude-code --skill lindy-sdk-patternsInstallation paths:
.claude/skills/lindy-sdk-patterns/# Lindy SDK Patterns
## Overview
Essential SDK patterns and best practices for Lindy AI agent development.
## Prerequisites
- Completed `lindy-install-auth` setup
- Basic understanding of async/await
- Familiarity with TypeScript
## Instructions
### Pattern 1: Client Singleton
```typescript
// lib/lindy.ts
import { Lindy } from '@lindy-ai/sdk';
let client: Lindy | null = null;
export function getLindyClient(): Lindy {
if (!client) {
client = new Lindy({
apiKey: process.env.LINDY_API_KEY!,
timeout: 30000,
});
}
return client;
}
```
### Pattern 2: Agent Factory
```typescript
// agents/factory.ts
import { getLindyClient } from '../lib/lindy';
interface AgentConfig {
name: string;
instructions: string;
tools?: string[];
}
export async function createAgent(config: AgentConfig) {
const lindy = getLindyClient();
const agent = await lindy.agents.create({
name: config.name,
instructions: config.instructions,
tools: config.tools || [],
});
return agent;
}
```
### Pattern 3: Retry with Backoff
```typescript
async function runWithRetry<T>(
fn: () => Promise<T>,
maxRetries = 3
): Promise<T> {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error: any) {
if (error.status === 429 && i < maxRetries - 1) {
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
continue;
}
throw error;
}
}
throw new Error('Max retries exceeded');
}
```
### Pattern 4: Streaming Responses
```typescript
async function streamAgentResponse(agentId: string, input: string) {
const lindy = getLindyClient();
const stream = await lindy.agents.runStream(agentId, { input });
for await (const chunk of stream) {
process.stdout.write(chunk.delta);
}
console.log(); // newline
}
```
## Output
- Reusable client singleton pattern
- Agent factory for consistent creation
- Robust error handling with retries
- Streaming support for real-time output