Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows
npx @tessl/cli install tessl/npm-anthropic-ai--claude-code@1.0.0Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows through natural language commands. It integrates directly into terminal environments and IDEs, providing AI-assisted coding capabilities.
npm install -g @anthropic-ai/claude-codeclaudeFor TypeScript SDK integration:
import { ClaudeCodeSDK } from '@anthropic-ai/claude-code';For Python SDK integration:
from claude_code_sdk import ClaudeCodeSDK# Global CLI installation
npm install -g @anthropic-ai/claude-code
# SDK installation for TypeScript projects
npm install @anthropic-ai/claude-code
# SDK installation for Python projects
pip install claude-code-sdk# Navigate to your project directory
cd /path/to/your/project
# Start Claude Code interactive session
claude
# Natural language commands:
# - "Help me fix this bug in authentication.js"
# - "Create a new component for user profiles"
# - "Explain what this function does"
# - "Run the tests and fix any failures"
# Slash commands for specific actions:
# /add-dir path/to/directory # Add directories to context
# /bug "Issue description" # Report bugs
# /cost # View usage costs
# /todos # List current todos# Run Claude Code with a single prompt
claude --print "Fix the bug in auth.js"
# JSON output for programmatic use
claude --print "Analyze code quality" --output-format=stream-json// TypeScript SDK
import { ClaudeCodeSDK } from '@anthropic-ai/claude-code';
const sdk = new ClaudeCodeSDK({
apiKey: 'your-api-key'
});
const session = await sdk.createSession();
const response = await session.sendMessage("Fix the bug in auth.js");Claude Code is built around several key components:
Interactive and non-interactive command-line interface with comprehensive options for different usage modes.
# Interactive mode
claude
# Print mode (non-interactive)
claude --print "prompt text"
# Configuration options
claude --settings settings.json
claude --mcp-config server1.json server2.json
claude --add-dir additional/directory
# Output formats
claude --output-format=stream-json
claude --system-prompt-file custom-prompt.txtBuilt-in commands for specific actions and workflow management.
# File and project management
/add-dir path/to/directory # Add directories to context
/memory # Edit memory files
/context # Debug context issues
/export # Export conversations
/resume # Switch conversations
# Development workflow
/bug "issue description" # Report bugs
/cost # View usage and costs
/todos # List current todos
/pr-comments # Handle PR comments
/install-github-app # Install GitHub integration
# Configuration and tools
/doctor # Validate configuration
/permissions # Manage tool permissions
/model # Model selection
/statusline # Customize status line
/vim # Enable vim bindings
/mcp # MCP server management
/agents # Create custom subagentsEvent-driven extension system with multiple hook types for comprehensive customization.
// Hook types
{
"hooks": {
"SessionStart": [...], // Session initialization
"SessionEnd": [...], // Session termination
"PreToolUse": [...], // Before tool execution
"UserPromptSubmit": [...], // User input processing
"PreCompact": [...], // Before conversation compaction
"Stop": [...], // Task completion
"SubagentStop": [...] // Subagent completion
}
}Markdown-based command definitions with agent capabilities for specialized workflows.
# Custom command with agent support
---
allowed-tools: Bash(git checkout --branch:*), Bash(git add:*), Bash(git status:*)
description: Brief description of the command
model: claude-3-sonnet-20240229
namespace: frontend
---
# Command instructions with dynamic context
## Context
- Current status: !`git status`
- Recent changes: !`git diff HEAD~1..HEAD`
## Your task
Step-by-step instructions for Claude to followComprehensive configuration management with project and global settings.
// Main configuration locations
~/.claude/settings.json // Global settings
.claude/settings.json // Project settings
CLAUDE.md // Project context
.mcp.json // MCP server config
// Environment variables
CLAUDE_CONFIG_DIR // Override config directory
ANTHROPIC_DEFAULT_SONNET_MODEL // Control model selection
CLAUDE_CODE_AUTO_CONNECT_IDE // IDE auto-connectionProgrammatic access through TypeScript and Python SDKs.
// TypeScript SDK
interface ClaudeCodeSDK {
createSession(options?: SessionOptions): Promise<Session>;
canUseTool(toolName: string): boolean;
onUserInput(callback: (input: string) => void): void;
cancelRequest(requestId: string): void;
}
interface Session {
sendMessage(message: string): Promise<Response>;
addCustomTool(name: string, callback: ToolCallback): void;
getPermissions(): ToolPermissions;
}Model Context Protocol servers for extended capabilities.
// MCP server configuration
{
"servers": {
"filesystem": {
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/path/to/allowed-dir"]
},
"git": {
"command": "mcp-server-git",
"args": ["--repository", "/path/to/repo"]
}
}
}Native editor integration with VS Code extension.
// VS Code extension features
- Real-time diff display
- Diagnostics integration
- Image paste support
- WSL compatibility
- File watching and suggestionsMultiple authentication methods and subscription management.
# Authentication methods
- API keys (stored in system keychain)
- OAuth authentication
- Claude Pro/Max subscriptions
- Bedrock/Vertex AI integration
# Environment variables
ANTHROPIC_API_KEY # Direct API key
AWS_BEARER_TOKEN_BEDROCK # Bedrock authentication// CLI and SDK Types
interface ClaudeCodeSDK {
createSession(options?: SessionOptions): Promise<Session>;
canUseTool(toolName: string): boolean;
onUserInput(callback: (input: string) => void): void;
cancelRequest(requestId: string): void;
}
interface Session {
sendMessage(message: string): Promise<Response>;
addCustomTool(name: string, callback: ToolCallback): void;
getPermissions(): ToolPermissions;
}
interface SessionOptions {
apiKey?: string;
model?: string;
workingDirectory?: string;
permissions?: ToolPermissions;
}
// Hook System Types
interface HookConfiguration {
hooks: {
SessionStart?: HookTrigger[];
SessionEnd?: HookTrigger[];
PreToolUse?: HookTrigger[];
UserPromptSubmit?: HookTrigger[];
PreCompact?: HookTrigger[];
Stop?: HookTrigger[];
SubagentStop?: HookTrigger[];
};
}
interface HookTrigger {
matcher: string;
hooks: HookAction[];
}
interface HookAction {
type: "command";
command: string;
timeout?: number;
}
interface HookInput {
tool_name: string;
tool_input: Record<string, any>;
environment?: Record<string, string>;
}
// Custom Command Types
interface CustomCommandFrontmatter {
"allowed-tools": string[];
description: string;
model?: string;
namespace?: string;
}
// MCP Types
interface MCPServerConfig {
servers: Record<string, MCPServer>;
}
interface MCPServer {
command: string;
args: string[];
env?: Record<string, string>;
}
// Configuration Types
interface Settings {
hooks?: HookConfiguration;
mcpServers?: MCPServerConfig;
permissions?: ToolPermissions;
model?: string;
outputStyle?: string;
}
interface ToolPermissions {
allowedTools: string[];
blockedTools?: string[];
}