Advanced Claude Code Usage
You know the basics. You have a working CLAUDE.md, you run sessions regularly, and you understand permission modes. This guide covers the patterns that turn Claude Code from a coding assistant into a software engineering force multiplier: multi-agent orchestration, hooks for automated quality gates, subagent delegation, and cost optimization at fleet scale.
Multi-Agent Orchestration
Running a single Claude Code instance handles one task at a time. Multi-agent orchestration runs multiple instances in parallel, each handling a different part of a complex task. This is how teams process large refactoring jobs, multi-file feature implementations, and codebase-wide migrations in minutes instead of hours.
- Claude Code Multi-Agent Architecture Guide – architectural patterns for multi-agent systems
- Claude Code Multi-Agent Orchestration Patterns – practical orchestration patterns
- Orchestrate Claude Code Subagents – step-by-step subagent orchestration
- Multi-Agent Workflow Design Patterns – design pattern catalog
- Context Engineering for Multi-Agent Systems – managing context across agents
- How 5 Parallel Claude Agents Cost $1,000/Month – real cost analysis of parallel agents
- How to Test and Debug Multi Agent Workflows – testing strategies for multi-agent systems
Architectural Patterns
- Opus Orchestrator + Sonnet Worker Architecture – cost-optimized model pairing
- Opus Orchestrator with Haiku Workers Pattern – maximum cost efficiency
- Supervisor-Agent Worker-Agent Pattern – hierarchical agent coordination
- Building Supervisor Worker Agent Architecture – hands-on implementation tutorial
- Fan-Out Fan-In Pattern with Claude Code Subagents – parallel decomposition pattern
- Claude Code Pipeline: Sequential vs Parallel – choosing the right execution model
- Human-in-the-Loop Multi-Agent Patterns – adding human checkpoints
Hooks and Automation
Hooks let you run custom scripts at specific points in Claude Code’s execution cycle. Use them for automated formatting, test validation, security scanning, and cost tracking – all without manual intervention.
- Claude Code Hooks: Complete Guide – comprehensive hook reference
- Claude Code Hooks: How They Work – internals and execution model
- Understanding the Claude Code Hooks System – system architecture
- Best Claude Code Hooks for Code Quality – quality-focused hook recipes
- Write Your First Claude Code Hook – getting started with hooks
- Auto-Format Code with Claude Code Hooks – Prettier and ESLint integration
- Claude Code Hooks for Token Budget Enforcement – automated cost control
- Claude Code Git Hooks and Pre-commit Automation – git integration hooks
- Monitoring Claude Code Token Usage via Custom Hooks – usage tracking hooks
Subagent Patterns
Subagents are child Claude Code instances spawned by a parent agent to handle delegated tasks. Mastering subagent patterns unlocks parallel file processing, distributed code review, and recursive task decomposition.
- Claude Code Subagents Guide – complete subagent reference
- Claude Code Parallel Subagents Guide – parallel execution best practices
- Claude Code Multi-Agent Subagent Communication – inter-agent messaging
- Passing Context Between Claude Code Subagents – context sharing strategies
- Claude Code Subagent Token Usage Control – per-subagent cost control
- Multi-Agent Token Budgeting – budget allocation patterns
- Claude Code Subagent Spawn Limit – fixing spawn limit issues
- Claude Code subagent spawning too many – preventing runaway spawning
Custom Commands and Skills
Custom slash commands and skills extend Claude Code’s capabilities with reusable, project-specific workflows.
- Skills vs Hooks vs Commands in Claude Code – understanding the differences
- Create Custom Slash Commands for Claude – building custom commands
- Advanced Claude Skills with Tool Use – skills with tool integration
- Build Your First Claude Code Skill in 5 Minutes – quick skill creation tutorial
- Best Claude Code Skills to Install First – curated skill recommendations
- Claude Skills vs MCP Servers: When to Use Each – choosing the right extension mechanism
- Hybrid Patterns: Skills + MCP + Custom Tools – combining extension types
- Write Token-Efficient Claude Code Skills – optimizing skill token usage
Sequential Thinking and Extended Reasoning
Sequential thinking enables Claude to break down complex problems into explicit reasoning steps, producing better solutions for architectural decisions, debugging sessions, and multi-file refactoring.
- Sequential Thinking in Claude Code – enabling and using sequential thinking
- Claude Extended Thinking API Guide – API-level extended thinking configuration
- Extended Thinking + Claude Skills Integration – combining skills with deep reasoning
- Claude Code Extended Thinking Cost Analysis – when to enable vs disable
- Extended Thinking Budget Exceeded – managing thinking token budgets
Worktrees and Parallel Development
Git worktrees let you run multiple Claude Code agents on different branches simultaneously, each in an isolated working directory.
- Claude Code Git Worktree Parallel Development – worktree-based parallel workflows
- Claude Code Worktrees and Skills Isolation – isolation guarantees
- Git Worktree Lock Conflict Fix – resolving worktree conflicts
- Claude Code Tmux Session Management – tmux-based multi-agent management
- Claude Code Parallel Task Execution – parallel execution patterns
Cost Optimization at Scale
When you run multiple agents, batch jobs, or high-volume sessions, cost optimization becomes an architecture concern, not a configuration tweak.
- Cost-Efficient Multi-Agent Coding Workflows – architecture-level cost patterns
- Claude Orchestrator-Worker Cost Optimization – model-tier cost optimization
- Multi-Agent Claude Fleet Cost Architecture – fleet-scale cost modeling
- Claude Batch Plus Caching for 95% Cost Savings – maximum savings via batch + cache
- Claude Prompt Caching Saves 90% Input Costs – caching for repeat context
- Combining Caching with Batch API: 95% Savings – compound savings strategies
- Claude Batch API 50% Discount Guide – batch processing discount details
- Reducing Claude Code MCP Round-Trips – minimizing MCP overhead
Calculate your costs: Use the Claude Code Cost Calculator to model multi-agent and batch processing costs before deploying.
Monitoring and Observability
Running Claude Code at scale requires monitoring token usage, error rates, and agent performance.
- Monitoring and Logging in Claude Code Multi-Agent Systems – observability for multi-agent setups
- How to Audit Your Claude Code Token Usage – token audit workflow
- Track Claude Token Spend Per Project – per-project cost tracking
- Benchmarking Claude Code Skills Performance – skill performance measurement
Frequently Asked Questions
What is multi-agent orchestration in Claude Code?
Multi-agent orchestration runs multiple Claude Code instances simultaneously, each handling a different task or file. A parent agent (orchestrator) breaks down complex work and delegates subtasks to child agents (workers). This pattern reduces wall-clock time for large tasks by 3-5x.
How many parallel agents can I run?
The practical limit depends on your API rate limits and budget. Most developers run 3-5 parallel agents effectively. Enterprise API tiers support higher concurrency. See How 5 Parallel Claude Agents Cost $1,000/Month for real cost data.
What are Claude Code hooks?
Hooks are custom scripts that run at specific points in Claude’s execution cycle: before tool use, after tool use, before commit, and on session events. They enable automated formatting, security scanning, test validation, and cost tracking without manual intervention.
When should I use skills vs hooks vs MCP servers?
Use skills for reusable workflows (code review, deployment). Use hooks for automated quality gates (formatting, linting, testing). Use MCP servers for external tool integration (databases, APIs, cloud services). See Skills vs Hooks vs Commands.
How does sequential thinking improve Claude Code output?
Sequential thinking forces Claude to reason through problems step-by-step before generating code. This produces better results for architectural decisions, complex debugging, and multi-file changes where the interactions between files matter. It costs more tokens but reduces revision cycles.
What is the Opus orchestrator + Sonnet worker pattern?
This pattern uses the more capable (and expensive) Opus model as the orchestrator to plan and decompose tasks, and the faster (and cheaper) Sonnet model as workers to execute individual subtasks. This balances quality and cost. See Opus Orchestrator + Sonnet Worker.
How do I prevent subagents from overspending?
Set per-subagent token budgets using environment variables and hooks. Monitor aggregate spending with custom tracking hooks. Kill subagents that exceed their budget. See Subagent Token Usage Control.
Can I use Claude Code in CI/CD pipelines?
Yes. Claude Code supports headless mode for automated environments. Configure it with environment variables, use --dangerously-skip-permissions for non-interactive execution, and integrate with GitHub Actions, GitLab CI, or Jenkins. See GitHub Actions Setup.
Explore More Guides
- Foundation best practices
- Configuration for advanced setups
- Debug complex error scenarios
- Troubleshoot advanced features
- Review the fundamentals
The Full Arsenal
This page covers the advanced patterns. For complete implementation guides with production-tested code, multi-agent deployment templates, and cost optimization playbooks, get the Claude Code Mastery Playbook ($99). It includes 200 practices that power teams running 5+ parallel agents daily.