AgentSkillsCN

sdk-agent

以 TypeScript 或 Python 创建并配置 Claude Agent SDK 应用程序。适用于用户希望构建自定义智能体、创建全新 SDK 项目,或搭建智能体开发环境时使用。可通过诸如“创建智能体”、“构建 SDK 应用”、“新建智能体项目”等请求触发。

SKILL.md
--- frontmatter
name: sdk-agent
description: Create and setup Claude Agent SDK applications in TypeScript or Python. Use when the user wants to build custom agents, create new SDK projects, or set up agent development environments. Triggers on requests like "create an agent", "build an SDK app", "new agent project".

Claude Agent SDK Setup

Create and configure Claude Agent SDK applications following official documentation and best practices.

Quick Start

  1. Gather Requirements: Language (TypeScript/Python), project name, agent type
  2. Initialize Project: Create directory, package manager, configuration
  3. Install SDK: Latest version from npm/PyPI
  4. Create Starter Files: Basic agent with proper imports and error handling
  5. Setup Environment: API keys, .env configuration
  6. Verify: Run type checks and validation

Language Options

TypeScript

bash
npm init -y
npm install @anthropic-ai/claude-agent-sdk@latest

Create index.ts with:

  • Proper imports from SDK
  • Basic agent configuration
  • Error handling
  • Type definitions

Python

bash
pip install claude-agent-sdk

Create main.py with:

  • SDK imports
  • Agent configuration
  • Error handling

Project Structure

code
project-name/
├── src/
│   └── index.ts (or main.py)
├── .env.example
├── .gitignore
├── package.json (or requirements.txt)
└── tsconfig.json (TypeScript only)

Environment Setup

Create .env.example:

code
ANTHROPIC_API_KEY=your_api_key_here

Get API key from: https://console.anthropic.com/

Verification

After setup, verify:

  • TypeScript: Run npx tsc --noEmit - fix all type errors
  • Python: Verify syntax and imports

Resources

Detailed References

Common Next Steps

After initial setup:

  1. Customize system prompt
  2. Add custom tools via MCP
  3. Configure permissions
  4. Create subagents
  5. Add sessions for persistence