<< All versions
Skill v1.0.1
currentAutomated scan100/100thebushidocollective/han/agent-creation
4 files
──Details
PublishedJune 5, 2026 at 06:29 AM
Content Hashsha256:4406cb713f50e249...
Git SHA3fc9880ee2be
Bump Typepatch
──Files
Files (1 file, 3.9 KB)
SKILL.md3.9 KBactive
SKILL.md · 210 lines · 3.9 KB
version: "1.0.1" name: claude-agent-sdk-agent-creation user-invocable: false description: Use when creating or configuring Claude AI agents using the Agent SDK. Covers agent initialization, configuration, and basic setup patterns. allowed-tools:
- Read
- Write
- Edit
- Bash
- Grep
- Glob
Claude Agent SDK - Agent Creation
Creating and configuring AI agents using the Claude Agent SDK with TypeScript.
Core Agent Initialization
Basic Agent Creation
typescript
import { Agent } from '@anthropic-ai/claude-agent-sdk';const agent = new Agent({model: 'claude-3-5-sonnet-20241022', // Latest modelsystemPrompt: 'You are a helpful assistant specialized in...',settingSources: ['project'], // Load .claude/CLAUDE.md from projectallowedTools: ['read_file', 'write_file', 'list_files'],});
Configuration Options
System Prompts
typescript
// Direct system promptconst agent = new Agent({systemPrompt: 'You are an expert code reviewer...',});// Load from CLAUDE.mdconst agent = new Agent({settingSources: ['project'], // Loads ./.claude/CLAUDE.md});// User-level memoryconst agent = new Agent({settingSources: ['user'], // Loads ~/.claude/CLAUDE.md});
Tool Permissions
typescript
// Allow specific toolsconst agent = new Agent({allowedTools: ['read_file','write_file','list_files','grep','bash',],});// Block specific toolsconst agent = new Agent({disallowedTools: ['bash', 'web_search'],});// Permission modesconst agent = new Agent({permissionMode: 'strict', // Require explicit approval});
Agent Directory Structure
Required Structure
project/├── .claude/│ ├── CLAUDE.md # Project memory│ ├── agents/│ │ └── specialist.md # Subagent definitions│ ├── skills/│ │ └── my-skill/│ │ └── SKILL.md # Skill definitions└── src/└── index.ts # Your code
Authentication
Environment Variables
bash
# Anthropic API (primary)export ANTHROPIC_API_KEY="sk-ant-..."# Alternative providersexport AWS_ACCESS_KEY_ID="..."export AWS_SECRET_ACCESS_KEY="..."export AWS_REGION="us-east-1"# Google Vertex AIexport GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials.json"# Azureexport AZURE_OPENAI_API_KEY="..."export AZURE_OPENAI_ENDPOINT="..."
SDK Configuration
typescript
// Anthropic directconst agent = new Agent({apiKey: process.env.ANTHROPIC_API_KEY,});// Amazon Bedrockconst agent = new Agent({provider: 'bedrock',model: 'anthropic.claude-3-5-sonnet-20241022-v2:0',});
Best Practices
Always Specify Model
typescript
// Goodconst agent = new Agent({model: 'claude-3-5-sonnet-20241022',});// Avoid: relying on default modelconst agent = new Agent({});
Use Explicit Setting Sources
typescript
// Goodconst agent = new Agent({settingSources: ['project'],});// Avoid: unclear memory sourceconst agent = new Agent({systemPrompt: '...',});
Separate Project and User Memory
typescript
// Project-specific contextconst projectAgent = new Agent({settingSources: ['project'],});// User preferencesconst userAgent = new Agent({settingSources: ['user'],});
Anti-Patterns
Don't Hardcode API Keys
typescript
// Badconst agent = new Agent({apiKey: 'sk-ant-hardcoded-key',});// Goodconst agent = new Agent({apiKey: process.env.ANTHROPIC_API_KEY,});
Don't Mix Conflicting Permissions
typescript
// Bad: contradictory permissionsconst agent = new Agent({allowedTools: ['read_file', 'write_file'],disallowedTools: ['read_file'], // Conflict!});// Good: clear permissionsconst agent = new Agent({allowedTools: ['read_file'],});
Related Skills
- tool-integration: Working with tools and MCP servers
- context-management: Managing agent context and memory