# claude-sdk-integration-patterns

A skill with ready patterns for the Claude API and TypeScript SDK: streaming, tool use, error handling, token savings.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 434 installs · ★ 62
- Author: manutej
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-ai-integration/skills/claude-sdk-integration-patterns/SKILL.md
- Updated: 2026-06-13
- HTML: https://affpapa.org/en/nevibecode/skills/claude-sdk-integration-patterns

## What it does

This skill collects working examples of wiring the Claude API into Node.js and TypeScript apps. Inside are the Messages API, streaming responses, tool use with Zod, error handling and token optimization. Every pattern carries a note on when to reach for it: a plain question-answer call, a multi-turn conversation, a live UI that renders partial output.

Tooling gets its own section. You define a schema with `betaZodTool`, let `toolRunner` execute the calls automatically, and stream several tools in sequence. Cancellation is covered too — `stream.abort()` plus catching `Anthropic.APIUserAbortError` when the user closes the window or a timeout fires.

You need an `ANTHROPIC_API_KEY` and the `@anthropic-ai/sdk` package. The patterns target your own application rather than Claude itself, so a project without Node.js and TypeScript gets nothing from it. Worth checking your stack before installing.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill claude-sdk-integration-patterns -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/claude-sdk-integration-patterns/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/claude-sdk-integration-patterns/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill claude-sdk-integration-patterns -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/claude-sdk-integration-patterns/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill claude-sdk-integration-patterns -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/claude-sdk-integration-patterns/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install manutej/luxor-claude-marketplace claude-sdk-integration-patterns
```

2. **Manually: put the files in place**
- File: `.github/skills/claude-sdk-integration-patterns/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill claude-sdk-integration-patterns -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/manutej/luxor-claude-marketplace --path plugins/luxor-ai-integration/skills/claude-sdk-integration-patterns
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/claude-sdk-integration-patterns/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add manutej/luxor-claude-marketplace --skill claude-sdk-integration-patterns -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/manutej/luxor-claude-marketplace/tree/HEAD/plugins/luxor-ai-integration/skills/claude-sdk-integration-patterns/SKILL.md

## When to use it
- connect the Claude API to a Node.js app
- stream model output into a chat UI
- define a tool schema with Zod
- handle an aborted stream or a request timeout
- cut token spend in a multi-turn conversation

## Example prompts
- show me the Claude API streaming pattern for TypeScript
- how do I define a tool with betaZodTool and run toolRunner
- add error handling and stream abort to my messages.create call

## Similar
- [anthropic-claude-development](https://affpapa.org/en/nevibecode/skills/anthropic-claude-development.md) — skill · 728 installs
- [vercel-ai-sdk](https://affpapa.org/en/nevibecode/skills/wsimmonds-vercel-ai-sdk.md) — skill · 337 installs
- [claude-api](https://affpapa.org/en/nevibecode/skills/claude-api.md) — skill · 74198 installs
- [v4-sdk-integration](https://affpapa.org/en/nevibecode/skills/v4-sdk-integration.md) — skill · 729 installs
- [honcho-integration](https://affpapa.org/en/nevibecode/skills/honcho-integration.md) — skill · 882 installs
- [zapier-sdk](https://affpapa.org/en/nevibecode/skills/zapier-sdk.md) — skill · 1000 installs

From the same set: [manutej/luxor-claude-marketplace](https://affpapa.org/en/nevibecode/by/manutej/luxor-claude-marketplace.md) — 31 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
