
Claude Code in Action
Claude Code is an AI-powered coding assistant developed by Anthropic, designed to act as an “agentic” tool that goes beyond simple text responses. It operates primarily in your terminal (via CLI) but also extends to IDEs (like VS Code and JetBrains), desktop apps, web interfaces (claude.ai/code), mobile (iOS), Slack, and CI/CD pipelines (e.g., GitHub Actions, GitLab CI/CD). At its core, it’s built to understand your entire codebase, edit files, run commands, fix bugs, automate workflows, and handle non-coding tasks like documentation, builds, searches, and even data visualization or queries.
Unlike traditional code assistants (e.g., GitHub Copilot, which focuses on inline suggestions), Claude Code is agentic, meaning it can autonomously plan, execute, and verify tasks across multiple files, tools, and systems. It’s powered by Anthropic’s Claude models and emphasizes safety, with features like permissions, checkpoints, and reversible actions. It’s available via a subscription or Anthropic Console account, with support for third-party LLMs in some setups.
Claude Code originated as an internal prototype at Anthropic in September 2024, starting as a simple CLI tool for music control. It quickly evolved into a full product, adopted by 80% of Anthropic’s engineers, boosting their PR throughput by 67%. By 2025, it was publicly released, generating significant revenue ($500M+ ARR) and 10x usage growth. While focused on coding, it’s versatile for data science, security, APIs, and more.
Tech Stack
- Primary Language: TypeScript (chosen because Claude models excel at it, making self-generation easier).
- UI Framework: React with Ink (for building interactive, dynamic terminal interfaces).
- Layout System: Yoga (Meta’s open-source constraints-based layout engine) for responsive designs across terminal sizes.
- Build Tool: Bun (for fast packaging and building, preferred over Webpack or Vite for speed).
- Backend/Execution: Local execution on the user’s machine (no VMs or Docker by default for simplicity; runs commands and file ops directly). For cloud tasks, it uses Anthropic-managed VMs.
- Integrations and Protocols:
- Model Context Protocol (MCP): An open standard for connecting to external tools/data (e.g., Google Drive, Jira, Slack, GitHub, databases).
- Git Integration: Handles branches, commits, PRs natively.
- Chrome Integration: For web debugging.
- Agent SDK: A framework for custom agents, allowing programmatic control over orchestration, tools, and permissions.
- Other Dependencies: Minimal; the stack is “on distribution” (familiar to Claude models) to avoid teaching the AI new tech.
Development Process
- Team and Velocity: Started as a solo prototype by Boris Cherny (founding engineer). Grew to a 2-person team by November 2024, then ~10 by 2025 (engineers, PMs, designers, data scientists). They release ~60–100 internal builds daily, ~5 PRs per engineer per day, and ~1 external release per day — far faster than typical teams.
- AI-First Approach: Use Claude Code itself for code reviews, testing, prototyping, and writing code. Features like the todo list involved ~20 prototypes in 2 days. Subagents were built in 3 days (with 2 days’ work discarded via iteration).
- Prototyping Focus: Emphasizes rapid UX testing (e.g., interactive elements like spinners, drawers). Deletes code/prompts with each new model release (e.g., Claude 4.0) to simplify.
- Safety and Permissions: The most complex part — multi-tiered system (user/project/org levels) via settings.json. Static analysis checks commands before execution.
- Unique Aspects: Runs locally for simplicity (no virtualization initially, though similar tools like Claude Cowork use local VMs via Apple Virtualization Framework on macOS). Designed for “raw” model access, avoiding brittle DAG-based (Directed Acyclic Graph) architectures in favor of a single-threaded “Master Loop” with tools.
The architecture draws from Anthropic’s “Constitutional AI” (embedding safety/ethics in models) and shares similarities with Claude Cowork (a related tool for non-coding tasks), using the same agentic framework: local VM isolation, strict access controls, and MCP for extensions.
The Entire Architecture
Claude Code’s architecture is a unified engine (shared backend) powering multiple interfaces, with a focus on agentic capabilities. It’s not a monolithic app but a harness that integrates models, tools, and environments. Key layers:
Frontend Interfaces:
- CLI (Terminal): Core entry point (install via Homebrew/winget/script). Interactive REPL with dynamic UI (e.g., expandable todos via CTRL+T).
- IDEs: VS Code extension (inline diffs, @-mentions), JetBrains plugin (diff viewing).
- Desktop App: Standalone for macOS/Windows (visual diffs, side-by-side sessions).
- Web/Mobile: claude.ai/code (browser-based, no local setup); iOS app for on-the-go.
- Other: Slack (@Claude for task routing), CI/CD (GitHub Actions for PR reviews).
Core Engine (Agentic Harness):
- Models Layer: Claude models (Sonnet for general, Opus for complex; switch via /model or — model flag). Handles reasoning, planning, code understanding (any language), and decision-making.
- Tools Layer: Provides agency. Categories:
- File Ops: Read/edit/create/rename/reorganize.
- Search: Pattern/regex, codebase exploration.
- Execution: Shell commands, git, tests, servers.
- Web: Search/fetch docs/errors.
- Code Intel: Type errors, definitions/references (plugins).
- Orchestration: Subagents, user questions.
- Permissions & Safety Layer: Multi-mode (default: prompt before actions; auto-accept: edits without approval; plan: read-only). Checkpoints (file snapshots for undo via Esc). Configurable via settings.json.
- Context Management: Auto-compacts history; includes conversation, files, outputs, CLAUDE.md. Inspect via /context; compact via /compact.
- Execution Environments: Local (default), cloud VMs (for remote repos), remote control (browser/terminal handoff via /teleport, /desktop).
Extensibility Layer:
- CLAUDE.md: Project-root file for persistent instructions (standards, architecture, libraries).
- Skills (Custom Slash Commands): Reusable workflows (e.g., /review-pr). Defined in .claude/skills/<name>/SKILL.md with YAML (name, description, tools, hooks).
- Hooks: Shell scripts for events (e.g., lint after edit).
- Subagents: Specialized AIs (e.g., “reviewer”); lead agent coordinates, spawns isolates for parallel tasks. Defined via — agents or skills.
- MCP Servers: Connect external tools (e.g., /mcp add github for PRs).
- Agent SDK: Build custom agents with full control.
Data Flow and Persistence:
- Sessions: Saved locally (UUID-based); resume via — resume, fork via — fork-session. Tied to directories/branches; use git worktrees for parallel.
- Settings: Hierarchical (~/.claude/settings.json, project-level); shared across interfaces.
- Integrations: GitHub/GitLab (PRs, CI/CD), Chrome (web debug), Slack (notifications).
No explicit diagrams in sources, but conceptual flow: User → Interface → Engine (Model + Tools) → Action/Verify Loop → Output (e.g., commits/PRs).
Similar to Claude Cowork: Paradigm shift from passive “Oracle mode” (Q&A) to active “Agentic mode”; uses local VM isolation (e.g., via Apple Virtualization Framework on macOS) with strict controls.
How It Works End-to-End
Claude Code follows an iterative agentic loop: Gather Context → Take Action → Verify Results. It’s adaptive — simple tasks may skip phases; complex ones cycle repeatedly. Users can interrupt anytime.
End-to-End Workflow Example: Fixing a Bug
- Setup/Initialization:
- Install CLI: curl -sSfL https://install.claude.com | bash.
- Auth: claude auth login.
- Start session: claude in project dir (loads CLAUDE.md, codebase, git state).
User Input:
- Command: claude “fix the failing tests in auth module”.
- Or pipe: git diff main | claude -p “review for security”.
Gather Context:
- Claude reads: Files, imports, dependencies, CLAUDE.md (e.g., “Use TypeScript, FastAPI”).
- Scans repo structure, git history.
- If needed: Searches web/docs, queries MCP tools (e.g., Jira ticket).
Planning:
- Breaks task: Identify failures → Analyze errors → Edit files.
- May spawn subagents (e.g., one for testing, one for review).
Take Action (Tool Use):
- Runs: !pytest (or equivalent tool) to identify issues.
- Edits: Multi-file changes (with checkpoint snapshot).
- Executes: Git commits, shell builds.
- Permissions: Prompts for sensitive actions (e.g., delete file).
Verify Results:
- Reruns tests/lint.
- Checks outcomes; iterates if fails (e.g., diagnose new error).
- Outputs: Diffs, explanations (styles: explanatory, learning).
Completion & Integration:
- Commits/PRs: Auto-generates messages, opens PRs.
- Notifications: Slack alerts.
- Session End: Saves history; resume later via — continue.
- Handoff: /teleport to web for mobile review.
Advanced Flows
- Parallel Tasks: Subagents work isolated (e.g., planner + executor).
- Automation: Hooks auto-lint; skills like /deploy-staging.
- Non-Interactive: -p flag for scripting (e.g., in CI/CD).
- Long-Running: Cloud VMs for background; monitor via web/iOS.
Safety in Action
- Undo: Esc reverts to checkpoint.
- Limits: — max-turns, — max-budget-usd.
- Modes: Cycle via Shift+Tab (plan/read-only for safe exploration).
This loop turns a “talking model” (Claude) into a “doing system,” enabling autonomous engineering while keeping users in control.
CLI Commands (Terminal-Level Commands)
These are executed directly from the terminal to manage Claude’s runtime environment. They control authentication, sessions, configurations, tools, and execution modes. Flags often modify behaviors for security or automation.
Authentication
- claude auth login: Logs in using an Anthropic account. Essential for cloud model access.
- claude auth status: Checks login status. Commonly used in CI/CD pipelines to verify authentication before automated runs.
Session Management
- claude: Starts a new Claude session.
- claude — resume: Resumes a previous session, maintaining state (e.g., conversation history, memory).
- claude — disable-slash-commands: Disables slash commands entirely. Useful in hardened or restricted environments to prevent accidental workflow triggers.
Detailed Explanation: Sessions accumulate history, which can hit token limits in long tasks. Use — resume for continuity in multi-step workflows like debugging.
Configuration Commands
- claude config set — global preferredNotifChannel terminal_bell: Sets global configurations, such as notifications, execution policies, or telemetry. For example, configure long workflows to notify via terminal bell when complete.
Detailed Explanation: Configurations persist across sessions and are key for tailoring behavior (e.g., enabling/disabling telemetry for privacy in enterprise setups).
Tool Control Flags
- claude — disallowedTools bash: Restricts specific tools (e.g., bash, filesystem). Prevents destructive actions like file deletions.
Detailed Explanation: In security-focused environments, these flags enforce least-privilege access, integrating with enterprise governance models.
Execution Modes
Claude supports foreground (blocking) and background execution, allowing tasks to continue without tying up the terminal. This is a core feature for agentic designs, enabling non-blocking workflows.
Slash Commands (Core Workflow Power)
Slash commands (/) are the primary power feature: reusable workflows defined as Markdown files in .claude/commands/ directories. They act as agent orchestration primitives — prompt snippets that Claude loads and executes automatically. Built-in ones are always available; custom ones extend them.
Detailed Explanation: Typing /command loads the corresponding Markdown instructions, injecting them into Claude’s reasoning loop. This makes workflows repeatable and composable, turning Claude into a task automation engine. Outputs from /help vary dynamically based on enabled features.
Built-In Slash Commands
- /help: Displays all available commands (built-in, custom, MCP). Includes discovery of hooks and agents. Output changes based on environment.
- /config: Opens an interactive UI for changing settings (e.g., notifications, tool behaviors, execution confirmations).
- /allowed-tools: Controls permissions for tools like bash, filesystem, or network. Lists and modifies enabled tools for security.
- /hooks: Manages hooks (event triggers). Configures automations like auto-lint before commits or tests after file changes.
- /mcp: Manages MCP servers (e.g., /mcp add github). Integrates external tools like APIs, databases, or GitHub for extended capabilities.
- /agents: Orchestrates sub-agents (e.g., /agents create reviewer). Creates, lists, or assigns roles to specialized AI agents (e.g., QA, architecture).
- /vim: Enables Vim editing mode for terminal productivity.
- /terminal-setup: Installs shell shortcuts (e.g., Shift + Enter for multiline input).
- /install-github-app: Integrates GitHub automation for PR/issue analysis.
- /init: Initializes repository understanding. Scans structure (e.g., package.json, Git history), updates memory (e.g., CLAUDE.md). Run on new repos or after refactors to ground Claude’s context.
- /refresh: Rebuilds workspace context without restarting (e.g., after external file additions or branch changes).
- /status: Shows runtime details (model, tools, permissions, MCP servers). Useful for debugging.
- /clear: Clears conversation history to manage token limits in polluted sessions.
- /compact: Compresses history into summarized memory, reducing tokens while preserving continuity. Ideal for long debugging.
- /model: Switches models (e.g., Opus for deep reasoning, Haiku for cheap tasks).
- /memory: Inspects persistent project knowledge (environment-dependent).
- /add-context: Adds file or reference contexts (integration-dependent, for large repos).
- /review: Runs code review workflow (analyzes diffs, suggests improvements). Often custom-implemented.
- /pr-review: Analyzes pull requests (requires GitHub integration).
Detailed Explanation: Lifecycle commands like /clear and /compact are critical for context management — Claude models have finite token windows, so compacting prevents “forgetting” key details in extended sessions.
Recently Added Slash Command Workflows
Recent updates added developer-focused reusable workflows:
- /debug: Auto-debugging workflow for repeated tasks.
- /release notes: Generates release notes.
- /PR comments: Automates PR comment generation.
Detailed Explanation: These are prompt snippets for common dev tasks, reducing manual prompting. They leverage Claude’s reasoning to automate repetitive engineering patterns.
Custom Slash Commands
Create reusable workflows in .claude/commands/ (global: ~/.claude/commands; project: project/.claude/commands).
- Example: .claude/commands/security-review.md with content like “Analyze repo for vulnerabilities. Run OWASP checks. Suggest fixes.”
- Usage: /security-review — Claude executes the instructions.
Detailed Explanation: This extensibility turns Claude into a domain-specific agent. Commands auto-load from directories, making them discoverable via /help. Huge for productivity in teams.
Quick Prefix Commands (Inline Shortcuts)
These are NOT slash commands but quick prefixes for immediate actions. Often confused with slashes due to similar utility.
- ! (Bash Execution): Runs shell commands directly, bypassing Claude (e.g., !ls -la or !pytest). For CI debugging or quick terminal ops.
- # (Memory Write): Adds persistent notes to CLAUDE.md (e.g., # remember project uses FastAPI). Claude recalls across sessions.
- @ (File Reference): Attaches files to context (e.g., @src/app.py explain bug). Avoids manual pasting for large files.
Detailed Explanation: Prefixes are “bypasses” for speed — ! executes without AI involvement, # builds long-term memory (key for multi-session projects), and @ injects context efficiently, preventing token waste.
Extensibility and Advanced Commands
SDK Slash Commands
Programmatically send commands via the Claude Agent SDK (e.g., Python: client.send(“/help”)).
- Triggers: /clear history, /compact context.
- Purpose: Remote orchestration in scripts or apps.
Hooks Commands (Agent Lifecycle)
- Managed via /hooks or config files.
- Triggers: Before/after events (e.g., commit, edit).
- Examples: Auto-lint, auto-test.
Detailed Explanation: Hooks automate lifecycles, integrating Claude into CI/CD. They run conditionally, enhancing autonomy.
MCP Tool Commands
- Managed via /mcp (e.g., /mcp add postgres).
- Grants access: Database queries, APIs, GitHub.
Detailed Explanation: MCP is an integration protocol for external “servers,” expanding Claude’s capabilities beyond local tools. Enterprise workflows rely on it for data-driven agents.
Sub-Agent Commands
- Managed via /agents (e.g., /agents create planner).
- Roles: Planner, reviewer, executor.
- Purpose: Multi-agent orchestration for complex tasks.
Detailed Explanation: Sub-agents divide labor (e.g., one plans, another reviews), mimicking team structures. Combines with MCP/hooks for full autonomy.
Hidden Power Commands and Keyboard Workflows
- Shortcuts: Shift + Enter (multiline input after /terminal-setup), Ctrl + J.
- Conditional: Appear based on integrations (e.g., GitHub adds PR commands).
Detailed Explanation: These are productivity enhancers, often undocumented but observed in engineering usage. They optimize terminal interactions.
Where Commands Are Stored
- Global: ~/.claude/commands (system-wide reusables).
- Project: project/.claude/commands (repo-specific).
- Claude auto-loads them, making commands context-aware.
Enterprise Usage Example
Real workflow:
/agents create architect
/mcp add github
/review-pr
Claude: Reads repo, analyzes PR, writes comments. This is agentic DevOps in action.
Summary of Complete Command Coverage
- Repository: /init, /refresh.
- Session Lifecycle: /clear, /compact, /resume.
- Discovery: /help, /status.
- Runtime: /model, /config.
- Security: /allowed-tools.
- Memory: #, /memory.
- Context: @, /add-context.
- Agents: /agents.
- MCP: /mcp.
- Hooks: /hooks.
- GitHub: /install-github-app, /review, /pr-review.
- Terminal/Editor: /vim, /terminal-setup.
- Execution: !.
- Custom Workflows: .claude/commands/.
- CLI: Authentication, sessions, configs, tool flags.
Claude Code is a transformative tool built on familiar tech, leveraging Anthropic’s models for agentic workflows. Its architecture prioritizes simplicity, extensibility, and safety, making it ideal for end-to-end development — from prototyping to deployment.