TypeScript SDK Reference

Document TypeScript SDK functions, configuration, and MCP server schemas.

497|68|Updated Sep 7, 2025
One-click install
npx skills add https://github.com/CaptainCrouton89/.claude --skill typescript-sdk-reference
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TypeScript SDK Reference
Source: https://github.com/CaptainCrouton89/.claude/tree/main/.claude/skills/typescript-sdk-reference
Command: npx skills add https://github.com/CaptainCrouton89/.claude --skill typescript-sdk-reference

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @anthropic-ai/claude-agent-sdk.

What problem does it solve?

This Skill provides a comprehensive reference for the Anthropic Agent SDK (TypeScript), enabling developers to programmatically interact with Claude Code and integrate custom tools. It simplifies building sophisticated AI applications by offering detailed documentation on functions, types, and configuration options.

Core Features & Use Cases

  • Programmatic Interaction: Use query() to send prompts, stream responses, and manage multi-turn conversations directly from your TypeScript application.
  • Custom Tooling: Define type-safe MCP tools with tool() and host them in-process using createSdkMcpServer().
  • Use Case: When building a custom AI agent that needs to interact with Claude Code, integrate with internal systems via custom tools, or automate complex development workflows, this Skill provides all the necessary technical details to get started and build robust solutions.

Quick Start

Install the SDK

npm install @anthropic-ai/claude-agent-sdk

Basic query example

import { query } from '@anthropic-ai/claude-agent-sdk';

const result = query({ prompt: "Analyze this code" });

for await (const message of result) { if (message.type === 'assistant') { console.log(message.message.content); } }

Frequently Asked Questions about TypeScript SDK Reference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a custom AI agent with TypeScript that integrates with Claude?

Use the Anthropic Agent SDK's `query()` function to send prompts and stream responses, then define custom tools with `tool()` and host them via `createSdkMcpServer()`. This enables programmatic interaction with Claude and integration of internal systems through type-safe MCP tools directly in your TypeScript application.

Can I define and host custom tools within my TypeScript application?

Yes. The SDK provides `tool()` to define type-safe MCP tools and `createSdkMcpServer()` to host them in-process. This allows you to extend Claude's capabilities with custom functions tailored to your application's needs without external tool servers.

What's the quickest way to get started with the Anthropic Agent SDK?

Install `@anthropic-ai/claude-agent-sdk` via npm, then import and call `query()` with a prompt. The SDK handles connection and streaming; iterate over the response to access assistant messages and build multi-turn conversations programmatically.

Does the TypeScript SDK support multi-turn conversations?

Yes. The `query()` function manages multi-turn conversations directly from your TypeScript application. Stream responses across multiple exchanges, enabling stateful interactions and complex development workflows within a single application context.

What structured type definitions and schemas does the SDK provide?

The SDK includes detailed input/output schemas, tooling schemas for MCP tools, and configuration options for core functions. These type definitions ensure API surface continuity, structured tool orchestration, and accurate embedding for retrieval and reasoning workflows.

Can I automate complex development workflows using this SDK?

Yes. Combine `query()` for Claude interaction with custom `tool()` definitions to automate workflows. Host tools via `createSdkMcpServer()`, integrate with internal systems, and orchestrate multi-step processes programmatically within your TypeScript application.