Lindy AI SDK best practices and common patterns. Use when learning SDK patterns, optimizing API usage, or implementing advanced agent features. Trigger with phrases like "lindy SDK patterns", "lindy best practices", "lindy API patterns", "lindy code patterns".
/plugin marketplace add jeremylongshore/claude-code-plugins-plus-skills/plugin install lindy-pack@claude-code-plugins-plusThis skill is limited to using the following tools:
Essential SDK patterns and best practices for Lindy AI agent development.
lindy-install-auth setup// 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;
}
// 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;
}
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');
}
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
}
| Pattern | Use Case | Benefit |
|---|---|---|
| Singleton | Connection reuse | Reduced overhead |
| Factory | Agent creation | Consistency |
| Retry | Rate limits | Reliability |
| Streaming | Long responses | Better UX |
// services/agent-service.ts
import { getLindyClient } from '../lib/lindy';
export class AgentService {
private lindy = getLindyClient();
async createAndRun(name: string, instructions: string, input: string) {
const agent = await this.lindy.agents.create({ name, instructions });
const result = await this.lindy.agents.run(agent.id, { input });
return { agent, result };
}
async listAgents() {
return this.lindy.agents.list();
}
async deleteAgent(id: string) {
return this.lindy.agents.delete(id);
}
}
Proceed to lindy-core-workflow-a for agent creation workflows.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.