Claude Code Ultimate Guide: Full Content for AI Indexing
This file is optimized for AI/LLM consumption. It contains the condensed guide overview,
full cheatsheet, complete template list, and FAQ for Claude Code.Standard llms.txt: https://github.com/FlorianBruniaux/claude-code-ultimate-guide/blob/main/llms.txt
Machine-readable index: https://github.com/FlorianBruniaux/claude-code-ultimate-guide/blob/main/machine-readable/reference.yaml
Metadata
- Title: Claude Code Ultimate Guide
- Author: Florian Bruniaux (Founding Engineer @ MΓ©thode Aristote)
- Version: 3.44.1
- Last Updated: October 6, 2026
- License: CC BY-SA 4.0
- Repository: https://github.com/FlorianBruniaux/claude-code-ultimate-guide
- Landing: https://cc.bruniaux.com
- Lines of Documentation: 26,187
- Production Templates: 278
- Quiz Questions: 473
- Whitepapers: 13 titles (FR + EN)
What Is Claude Code
Claude Code is Anthropic's official CLI for AI-assisted development. It lets developers interact with Claude directly from the terminal to write, edit, debug, and review code. Unlike IDE plugins, it has full filesystem access, can run shell commands, and works autonomously on multi-step tasks.
This guide is the most comprehensive community resource for Claude Code. It covers everything from installation to production security, with 278 ready-to-use templates for agents, hooks, commands, and skills.
Who This Guide Is For
- Beginners: Install Claude Code, complete first task in 15 minutes
- Intermediate: Configure CLAUDE.md memory files, custom agents, hooks
- Power users: MCP servers, Trinity pattern, CI/CD integration, multi-agent workflows
- Tech leads: Team adoption, security hardening, governance patterns
- CTOs/CIOs: ROI, risk, security posture
Guide Structure (11 Sections + Architecture)
AI Concept Boundaries (guide/core/ai-concept-boundaries.md): seven practical distinctions covering context/memory, model/harness responsibilities, workflow versus agent decisions, tools/MCP, instructions versus access controls, evaluation versus production evidence, and architecture/size/modality/task labels. Includes seven original comprehension scenarios with corrections. Selectively adapted from Anthony Capirchio / The Operating Shift's Lexigraph under CC BY 4.0; source review and export limitations are in docs/resource-evaluations/lexigraph-ai-lexicon.md. No source quiz bank is imported, and the exercises are not a validated proficiency assessment.
Architecture Deep Dive (guide/core/architecture.md):
- Master Loop:
while(tool_call), no DAGs, no classifiers, no RAG - 8 Core Tools: Bash, Read, Edit, Write, Grep, Glob, Task, TodoWrite
- Context: ~200K tokens, auto-compact at 75-92%
- Sub-agents: isolated context, max depth=1
- Philosophy: "less scaffolding, more model"
Main Guide Sections (guide/ultimate-guide.md, 26,695 lines):
- Quick Start: Installation, first workflow, essential commands
- Core Concepts: Context management, Plan Mode, Rewind, Mental Model
- Memory & Settings: CLAUDE.md files, .claude/ folder, precedence rules
- Agents: Custom AI personas, Tool SEO, orchestration patterns
- Skills: Reusable knowledge modules (Skills 2.0: Capability Uplift + Encoded Preference, Evals)
- Commands: Custom slash commands, variable interpolation
- Hooks: Event-driven automation (PreToolUse, PostToolUse, UserPromptSubmit)
- MCP Servers: Serena, Context7, Sequential, Playwright, Postgres, grepai
- Advanced Patterns: Trinity, CI/CD, Tasks API, multi-agent teams, feedback loops
- Reference: Commands, shortcuts, troubleshooting, checklists
- AI Ecosystem: Complementary tools matrix, practical multi-tool workflows, integration patterns
Security & Sandboxing (guide/security/sandbox-native.md, guide/core/settings-reference.md):
- Two independent layers: filesystem (write CWD + session temp, read the whole machine) and network (no domain pre-allowed, proxy does not terminate TLS)
- The default read policy covers
~/.sshand~/.awsand there is no built-in denylist;sandbox.credentials.filesandcredentials.envVarsare what actually protect them excludedCommandsbare-name form never matches, use the glob form; since v2.1.277 every command in a call must match, so a chained, piped, redirected orcd-prefixed call stays sandboxed (anthropics/claude-code#10524, #81157)- Git over SSH needs an exception on macOS only (its SSH tunnel cannot authenticate to the sandbox proxy); on Linux/WSL2 it works once the host is allowed, and an HTTPS remote avoids it everywhere
- No curl/wget blocklist exists; a missing domain prompts in manual mode and is refused, naming the host, in auto mode, where commands can declare hosts per command (
allowed_domains, v2.1.271+) failIfUnavailable: truestops a sandbox that cannot start from silently running commands unsandboxed; native Windows has no sandbox- Writes to Claude Code's own settings.json are denied at every scope, so a sandboxed script cannot widen its own policy
Agent Harnesses and Orchestration (guide/core/agent-harness.md, guide/ecosystem/agent-harness-landscape.md, guide/ecosystem/agentic-tools.md):
- The catalog separates 42 strict runtimes from 16 adjacent control planes.
- Multica is classified as an adjacent control plane: its server coordinates issue, chat, and scheduled runs while a daemon on a connected computer executes external coding-agent CLIs.
- Its profile documents the server/local execution split, server-stored run data, daemon-user permission boundary, Git enforcement boundary, restricted licence, and untested runtime status.
- WikiSkill separates execution traces, accumulated knowledge and active skills. Rejected proposal diffs and validation outcomes persist while active skills roll back; pattern pages remain revisable. See
guide/core/memory-systems.mdsection 6.8 anddocs/resource-evaluations/wikiskill-persistent-skill-evolution.mdfor reported benchmarks, negative transfer and the limits of full skill injection. No native skill-routing or production benefit was measured here.
For the October 6, 2026 Mistral Large 4 preview, read docs/resource-evaluations/mistral-large-4.md and its integration map. The ecosystem, market snapshot, subscription strategy, and local-inference pages distinguish sale pricing, independent evaluations, regional endpoint constraints, unresolved specifications, and future weights. No native Claude Code or self-hosted Large 4 integration was tested.
Full Cheatsheet
title: "Claude Code Cheatsheet" tags: [cheatsheet, reference]
Claude Code cheatsheet
Daily reference. For compact printable editions, use the English and French cheatsheets.
Author: Florian BRUNIAUX | Founding Engineer @MΓ©thode Aristote
Written with: Claude (Anthropic)
Version: 3.44.1 | Last Updated: Sep 24, 2026
Essential commands
These are selected daily commands. Availability depends on your version, provider, and plan: the complete list is in Β§10.1 of the guide, and the always-current official reference is code.claude.com/docs/en/commands.
| Command | Action |
|---|---|
/help |
Contextual help |
/powerup |
Interactive animated lessons teaching Claude Code features |
/clear |
Reset conversation |
/compact |
Free up context |
/status |
Session state + context usage |
/context |
Detailed token breakdown |
/plan |
Enter Plan Mode (no changes). Exit by approving the plan or Shift+Tab |
/model |
Select model and save the default; press s in the picker for this session only |
/autocompact [auto|500k] |
Choose the auto-compaction window or restore the model default |
/output-style [style] |
Select Default, Proactive, Concise, Explanatory, Learning, or a custom style |
/insights |
Usage analytics + optimization report |
/code-review [level] |
Review the diff for correctness bugs, --fix applies them, ultra runs it in the cloud |
/simplify |
Cleanup-only review of changed code: reuse, simplification, efficiency (applies cleanup fixes; use /code-review for correctness bugs) |
/security-review |
Scan the branch diff for injection, auth, and data-exposure risks |
/batch |
Large-scale refactors via 5β30 parallel worktree agents |
/subtask <task> |
Hand a side task to a forked subagent that reports back here (v2.1.212+) |
/teleport |
Teleport session from web |
/tasks |
Monitor background tasks |
/remote-env |
Configure cloud environment |
/remote-control (/rc) |
Connect this local session to web/mobile; Team/Enterprise require owner enablement |
/mobile |
Get Claude mobile app download links |
/fast |
Toggle faster Opus output; Opus 5.5 costs $8/$40 per MTok in fast mode |
/voice |
Toggle voice input (hold Space to speak, release to send) |
/recap |
Session context summary on return to a break (v2.1.108) |
/effort [level] |
Thinking depth: low/medium/high/xhigh/max/ultracode; no arg = interactive slider (v2.1.111) |
/tui [fullscreen] |
Full-screen flicker-free TUI rendering (v2.1.110) |
/focus |
Toggle minimal focus view, separate from Ctrl+O (v2.1.110) |
/fewer-permission-prompts |
Scan transcripts and propose a read-only tool allowlist (shipped as /less-permission-prompts in v2.1.111) |
/btw [question] |
Side question overlay: read-only ephemeral agent, no history pollution, no tools |
/loop [interval] [prompt] |
Repeat on a fixed interval, or let Claude choose the interval when omitted; recurring tasks expire after 7 days (see scheduling reference) |
/usage (/cost, /stats) |
Token + cost usage per model, plan limits, activity graph (merged in v2.1.118) |
/ultrareview |
Multi-agent cloud code review, now an alias of /code-review ultra (v2.1.114) |
/goal [condition] |
Autonomous multi-turn mode: Claude works until condition is met, live overlay shows elapsed/turns/tokens (v2.1.139) |
/scroll-speed |
Tune mouse wheel scroll speed with interactive live-preview slider (v2.1.139) |
/rename [name] |
Name or rename the current session |
/copy |
Interactive picker to copy a code block or full response |
/doctor |
Full setup checkup: install, settings, hooks, CLAUDE.md bloat, unused skills (v2.1.205+) |
/debug |
Systematic troubleshooting |
/exit |
Quit (or Ctrl+D) |
Keyboard shortcuts
| Shortcut | Action |
|---|---|
Shift+Tab |
Cycle permission modes |
Esc Γ 2 |
Rewind (undo) |
Ctrl+C |
Interrupt |
Ctrl+R |
Search command history |
Ctrl+L |
Clear screen (keeps context) |
Tab |
Autocomplete |
Shift+Enter |
New line |
Ctrl+B |
Background tasks |
Ctrl+X Ctrl+K |
Stop running background subagents |
Ctrl+Enter / Ctrl+X Ctrl+S |
Send queued messages now, interrupting the current turn |
Option+T / Alt+T |
Toggle thinking where supported; no effect on Opus 5.5 or Fable |
Space (hold) |
Voice input (requires /voice enabled) |
Ctrl+D |
Exit |
File references
@path/to/file.ts β Reference a file
@agent-name β Call an agent
@session-name β Message another live Claude session (v2.1.232+)
!shell-command β Run shell command| IDE | Shortcut |
|---|---|
| VS Code | Alt+K |
| JetBrains | Cmd+Option+K |
Features MΓ©connues (But Official!)
| Feature | Since | What It Does |
|---|---|---|
| Tasks API | v2.1.16 | Persistent task lists with dependencies; opt in on newer models with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 |
| Background Agents | v2.0.60 | Sub-agents work while you code. Since v2.1.232 forking is the default: a subagent_type: "fork" agent inherits the full conversation and prompt cache, and non-teammate spawns go background on their own |
| Agent Teams | v2.1.32 | Multi-agent coordination (TeamCreate/SendMessage) |
| Cross-Session Messaging | v2.1.224 | Sessions message each other across all your machines. ListAgents to discover, SendMessage to talk, @name to mention (v2.1.232). macOS, Linux, Windows (v2.1.234+). Full guide β |
| Self-Hosted Environments | v2.1.224 | claude self-hosted-runner makes your own machine or container the place web, mobile, and desktop sessions execute. Team and Enterprise |
| Auto-Memories | v2.1.32 | Automatic cross-session context capture |
| Session Forking | v2.1.19 | Rewind + create parallel timeline |
| LSP Tool | v2.0.74 | IDE-like navigation: symbols, types, refs. ~50ms vs 45s with grep. 11 languages |
| Voice Mode | v2.1.x | Native voice input, free transcription, no rate limit impact |
| Remote Control | v2.1.51 | Control a local session from phone/browser; subscription required, with owner enablement on Team/Enterprise |
/loop |
v2.1.71 | Session-scoped recurring scheduler: /loop 5m check the deploy (stops when session ends). Min 1 min, max 50 tasks/session |
/goal |
v2.1.139 | Autonomous completion loop: set a condition, Claude works across turns until a separate evaluator (Haiku by default on the Claude API) judges the surfaced evidence. Live overlay shows elapsed time, turns, and tokens. Three-element formula: measurable end state + verification mechanism + constraints. |
| Cloud Scheduled Tasks | 2026 | Machine-off scheduling via /schedule or claude.ai/code/scheduled. Runs on Anthropic infra, clones repo fresh each run, min 1h interval. Pro/Max/Team/Enterprise |
| Desktop Scheduled Tasks | 2026 | Local machine scheduling via Desktop app. Min 1 min, full local file access, no session required |
| Skill Evals | Mar 2026 | Two skill types: Capability Uplift (fills model gap, fades) / Encoded Preference (encodes workflow, stays). Benchmark Mode, A/B testing, Trigger Tuning. |
| Output Styles | v2.1.269 command | /output-style selects Default, Proactive, Concise, Explanatory, Learning, or a custom style. Coding-oriented custom styles need keep-coding-instructions: true. |
Activate LSP: Add to ~/.claude/settings.json β { "env": { "ENABLE_LSP_TOOL": "1" } } (requires LSP server installed for your language: tsserver, pylsp, gopls, rust-analyzer, sourcekit-lsp...)
Pro tip: These are public, documented in the CHANGELOG. Read it!
Permission modes
| Mode | Editing | Execution |
|---|---|---|
Manual (default) |
Permission rules apply | Permission rules apply |
| acceptEdits | Auto | Asks |
| Plan Mode | No file changes | Read-only exploration tools allowed |
| auto | Classifier decides | Classifier decides |
| dontAsk | Only if in allow rules | Only if in allow rules |
| bypassPermissions | Auto | Auto (CI/CD only) |
Shift+Tab to switch modes
Memory & Settings (2 levels)
| Level | macOS/Linux | Windows | Scope | Git |
|---|---|---|---|---|
| Project | .claude/ |
.claude\ |
Team | β |
| Personal | ~/.claude/ |
%USERPROFILE%\.claude\ |
You (all projects) | β |
Priority: Project overrides Personal
| File | Where | Usage |
|---|---|---|
CLAUDE.md |
Project root | Team memory (instructions) |
settings.json |
.claude/ |
Team settings (hooks) |
settings.local.json |
.claude/ |
Your setting overrides |
CLAUDE.md |
~/.claude/ (Win: %USERPROFILE%\.claude\) |
Personal memory |
.claude/ folder structure
.claude/
βββ CLAUDE.md # Local memory (gitignored)
βββ settings.json # Hooks (committed)
βββ settings.local.json # Permissions (not committed)
βββ agents/ # Custom agents
βββ hooks/ # Event scripts
βββ rules/ # Auto-loaded rules
βββ skills/ # Slash commands + knowledge modules (unified)Typical workflow
1. Start session β claude
2. Check context β /status
3. Plan Mode β Shift+Tab Γ 2 (for complex tasks)
4. Describe task β Clear, specific prompt
5. Review changes β Always read the diff!
6. Accept/Reject β y/n
7. Verify β Run tests
8. Commit β When task complete
9. /compact β When context >70%Context management (CRITICAL)
Statusline
Model: Sonnet | Ctx: 89.5k | Cost: $2.11 | Ctx(u): 56.0%Watch Ctx(u): β >70% = /compact, >85% = /clear
Enhanced statusline (ccstatusline): Add to ~/.claude/settings.json:
{ "statusLine": { "type": "command", "command": "npx -y ccstatusline@latest", "padding": 0 } }Context thresholds
| Context % | Status | Action |
|---|---|---|
| 0-50% | Green | Work freely |
| 50-70% | Yellow | Be selective |
| 70-90% | Orange | /compact now |
| 90%+ | Red | /clear required |
Actions by symptom
| Sign | Action |
|---|---|
| Short responses | /compact |
| Frequent forgetting | /clear |
| >70% context | /compact |
| Task complete | /clear |
Context recovery commands
| Command | Usage |
|---|---|
/compact |
Summarize and free context |
/clear |
Fresh start |
/rewind |
Undo recent changes |
claude -c |
Resume last session (CLI flag) |
claude -r |
Resume specific session (CLI flag) |
Under the hood (quick facts)
| Concept | Key Point |
|---|---|
| Master Loop | Model/tool loop; permissions and auto-mode review are separate controls |
| Tools | Bash, Read, Edit, Write, Grep, Glob, Agent and more (tool reference) |
| Context | Model-dependent: native 1M on current Opus, Sonnet and Fable; 200K on Haiku 4.5. Inspect /context |
| Sub-agents | Isolated context, max depth=1 |
| Philosophy | "Less scaffolding, more model" (trust Claude's reasoning) |
Deep dive: Architecture & Internals
Harness choice in four layers
| Layer | Owns | Start here |
|---|---|---|
| Model | Reasoning and tool-call proposals | Glossary |
| Runtime harness | Tool loop, permissions, and recovery | Agent Harness Engineering |
| Repository harness | Instructions, task state, and verification | Repository Harness Engineering |
| Orchestrator | Coordination between runtimes or sessions | Agent Tools |
Choose the smallest control structure that safely solves the need: a bounded loop for one repeated task; an explicit graph for routing, joins, parallelism, interruption, or durable recovery; a repository harness for repeatable project behavior; and an orchestrator for several runs or queues. Specify success, failure, timeout, budget, and escalation before execution. See Loop & Graph Engineering and compare products in the Agent Harness Map.
Architect-engineer handoffs use a self-contained versioned contract, applicable ADRs, an assigned next owner, and revision-bound review evidence. Task status, run status, and decision status are distinct. Reconcile historical completion claims with live state on resume. See guide/workflows/dual-instance-planning.md and docs/resource-evaluations/honkonen-architect-engineer.md; separation does not guarantee lower cost, better quality, or reviewer independence.
Repository context routes to authorized owners of stable contracts, organizational knowledge, and live operational state. MLD (Mistakes, Learnings, Desires) supplies observations for corroboration before promotion. Curated candidates stay outside served context until reviewed publication with provenance, audience, revision, and expiry. See docs/resource-evaluations/lopopolo-harness-engineering.md for the anthology's evidence limits and integrated locations.
Requalify after material model, host, harness, or action-interface changes. Measure feedback latency, run duration, human attention, and time to accepted outcome separately. See guide/roles/agent-evaluation.md#evaluation-epochs-and-four-clocks.
Evaluate the exact model-harness pair for a bounded coding task. Introduce orchestration only when coordination is the constraint. A harness optimizer sits outside the four operating layers and changes candidate harnesses under a separate evaluation protocol.
Plan mode & thinking
| Feature | Activation | Usage |
|---|---|---|
| Plan Mode | Shift+Tab Γ 2 or /plan |
Explore without modifying |
| OpusPlan | /model opusplan |
Opus for planning, Sonnet for execution |
Verified September 24, 2026: Opus 5.5 defaults to
medium; Sonnet 5 and Fable 5.1 default tohigh. Haiku 4.5 has no effort parameter.ultrathinkadds a reasoning instruction for the turn without changing API effort.
| Control | Action | Persistence |
|---|---|---|
| Option+T / Alt+T | Toggle thinking on supported models; Opus 5.5 and Fable always think | Session |
/effort or /model slider |
Choose a supported level; Enter saves per model, s applies once |
Per model or session |
/effort max |
Highest supported effort | Session |
CLAUDE_CODE_EFFORT_LEVEL |
Override effort in the launching environment | Process environment |
modelSettings / effortLevel |
Persist low, medium, high, or xhigh; not max |
Settings |
effort in skill frontmatter |
Override effort while the skill runs | Invocation |
Cost tip: try a lower supported effort for bounded tasks, then verify the result. On Opus 5.5, changing effort is the control; disabling thinking has no effect.
Per-skill effort: add effort: low to mechanical skills (commit, sync, scaffold) and effort: high to analytical ones (security-audit, architecture-review). Overrides session setting automatically.
OpusPlan workflow: /model opusplan β Shift+Tab Γ 2 (plan with Opus) β Shift+Tab (execute with Sonnet)
Required for: features >3 files, architecture, complex debugging
Quick model selection
| Task | Model | Effort |
|---|---|---|
| Rename, boilerplate, test gen | Haiku 4.5 | Not supported |
| Feature dev, debug, refactor | Sonnet 5 or Opus 5.5 | Start at the model default |
| Architecture, security audit | Opus 5.5; evaluate Fable 5.1 if needed | Increase with evidence |
Full decision table and pricing boundaries: Section 2.5 Model Selection & Thinking Guide
Dynamic model switching (mid-session)
Pattern: Start Sonnet (speed) β swap Opus (complexity) β back Sonnet
Workflow:
# Select Sonnet explicitly for this session
claude --model sonnet
# Complex feature encountered
> "Implement OAuth2 flow with PKCE"
/model opus # Switch to deep reasoning
# Feature complete, back to routine
/model sonnet # Speed + cost optimizationBest Practices:
- β Swap on task boundaries, not mid-task
- β Use Opus for: architecture decisions, complex debugging, security-critical code
- β Use Sonnet for: routine edits, refactoring, test writing
- β Use Haiku for: simple fixes, typos, validation checks
- Model switches keep conversation history but can invalidate prompt caches; switch at a useful task boundary.
Standard Anthropic API rates, USD per million tokens, checked September 24, 2026:
| Model | Input | Output | Context |
|---|---|---|---|
| Opus 5.5 | $4 | $20 | 1M |
| Sonnet 5 | $2 | $10 | 1M |
| Haiku 4.5 | $1 | $5 | 200K |
| Fable 5.1 | $10 | $50 | 1M |
Opus 5.5 fast mode costs $8/$40. Subscription allowances, usage credits, cache tokens, and cloud-provider pricing are separate. Official pricing.
On the direct Anthropic service, the account default and opus select Opus 5.5; sonnet selects Sonnet 5. Provider aliases differ: check the provider table. fable normally selects Fable 5.1, while Claude apps gateway sessions resolve it to Fable 5.
Source: Gur Sannikov embedded engineering workflow
MCP servers
| Server | Purpose |
|---|---|
| Serena | Indexation + session memory + symbol search |
| grepai | Semantic search + call graph analysis |
| Context7 | Library documentation |
| Sequential | Structured reasoning |
| Playwright | Browser automation |
| Postgres | Database queries |
| doobidoo | Semantic memory + multi-client + Knowledge Graph |
Serena memory: write_memory() / read_memory() / list_memories()
Serena indexation:
# Initial index
uvx --from git+https://github.com/oraios/serena serena project index
# Force rebuild
serena project index --force-full
# Incremental update (faster)
serena project index --incremental --parallel 4Check status: /mcp
Creating custom components
Agent (`.claude/agents/my-agent.md`)
---
name: my-agent
description: Use when [trigger]
model: sonnet
tools: Read, Write, Edit, Bash
---
# Instructions hereSkill: user-invocable (`.claude/skills/my-command/SKILL.md`)
---
description: Brief description
argument-hint: "<required_arg> [--flag]"
disable-model-invocation: true
---
# Command Name
Instructions for what to do...
$ARGUMENTS[0] $ARGUMENTS[1] (or $0 $1) - user argsDynamic workflow (`.claude/workflows/name.js`)
export const meta = {
name: 'my-workflow',
description: 'What this orchestrates',
phases: [{ title: 'Analyze' }, { title: 'Verify' }],
};
// meta must be the first statement, a pure literal (no variables/spreads)
export default async function ({ agent, parallel, pipeline, phase, log, args, budget }) {
phase('Analyze');
const results = await parallel(
ITEMS.map((item) => () => agent(`Analyze ${item}.`, { schema: MY_SCHEMA }))
);
return results.filter(Boolean);
}Trigger: type ultracode in the prompt (or ask in your own words). Monitor: /workflows.
| Primitive | Behavior |
|---|---|
agent(prompt, { schema }) |
Spawn one subagent; returns text or validated JSON |
parallel([() => agent(...)]) |
Barrier: all run concurrently, return when slowest finishes |
pipeline(items, stage1, stage2) |
No barrier: items flow through stages independently |
phase(title) |
Update progress label in /workflows UI |
log(msg) |
Emit progress message |
budget.remaining() |
Guard open-ended loops (budget hits 1000-agent cap otherwise) |
Key rules: orchestrator consumes 0 tokens; Date.now()/Math.random() unavailable (breaks resume); filter parallel() results with .filter(Boolean).
Full reference: Dynamic Workflows
Hook (macOS/Linux: `.sh` | Windows: `.ps1`)
Bash (macOS/Linux):
#!/bin/bash
INPUT=$(cat)
# Process JSON input
exit 0 # 0=continue, 2=blockPowerShell (Windows):
$input = [Console]::In.ReadToEnd() | ConvertFrom-Json
# Process JSON input
exit 0 # 0=continue, 2=blockAnti-patterns
| β Don't | β Do |
|---|---|
| Vague prompts | Specify file + line with @references |
| Accept without reading | Read every diff |
| Ignore warnings | Use /compact at 70% |
| Skip permissions | Never in production |
| Negative constraints only | Provide alternatives |
Quick prompting formula
WHAT: [Concrete deliverable]
WHERE: [File paths]
HOW: [Constraints, approach]
VERIFY: [Success criteria]Example:
Add input validation to the login form.
WHERE: src/components/LoginForm.tsx
HOW: Use Zod schema, show inline errors
VERIFY: Empty email shows error, invalid format shows errorCLI flags quick reference
| Flag | Usage |
|---|---|
-p "query" |
Non-interactive mode (CI/CD) |
-c / --continue |
Continue last session |
-r / --resume |
Resume specific session |
--teleport |
Teleport session from web |
remote-control |
Subcommand: start remote control session |
--model sonnet |
Change model |
--add-dir ../lib |
Allow access outside CWD |
--permission-mode plan |
Plan mode |
--tools "Tool1,Tool2" |
Enable specific tools for session |
--max-budget-usd 5.00 |
Max API spend limit (print mode) |
--system-prompt "..." |
Replace the entire default system prompt |
--append-system-prompt "..." |
Append text to the default system prompt |
--worktree / -w |
Run in isolated git worktree |
--dangerously-skip-permissions |
Auto-accept (use carefully) |
--debug |
Debug output |
--allowedTools "Edit,Read" |
Allow these tools without prompting; use --tools to restrict availability |
--effort medium |
Choose session effort on a supported model |
--system-prompt-file ./prompt.txt |
Replace the prompt from a file |
--append-system-prompt-file ./rules.txt |
Append prompt text from a file |
Use the official CLI reference for the full flag list. Self-hosted runners and command hooks must use the file-based system-prompt flags.
Key CLI subcommands
| Command | Description |
|---|---|
claude project purge [path] |
Delete all Claude Code state for a project (transcripts, tasks, config). --dry-run for preview. (v2.1.126) |
claude ultrareview [target] |
Non-interactive cloud code review for CI. --json output. Exits 0/1. (v2.1.120) |
claude plugin prune |
Remove orphaned auto-installed plugin deps. (v2.1.121) |
claude plugin details <name> |
Show plugin inventory and token cost estimate. (v2.1.139) |
claude --plugin-url |
Load plugin .zip from URL for this session. (v2.1.129) |
claude self-hosted-runner |
Run web/mobile/desktop sessions on your own machine or container. Windows needs an explicit --base-dir. Team and Enterprise. (v2.1.224) |
Debug commands
claude --version # Version
claude update # Check/install updates
claude doctor # Diagnostic
claude --debug # Verbose mode
claude --debug='mcp' # Debug MCP connections
/mcp # MCP status (inside Claude)CI/CD mode (headless)
# Non-interactive execution
claude -p "analyze this file" src/api.ts
# JSON output
claude -p "review" --output-format json
# Economic model
claude -p "lint" --model haiku
# With auto-accept
claude -p "fix typos" --dangerously-skip-permissionsRemote Control: Mobile access
Available with Pro, Max, Team, and Enterprise subscriptions. Team and Enterprise owners must enable it first. API keys and third-party provider connections are not supported.
# Start a server in the project directory
claude remote-control
# Or connect an existing session
/remote-controlOpen the displayed URL or scan the QR code from a browser or the Claude mobile app. The local process must keep running; the files and tools stay on your machine. Server mode can run multiple sessions with --spawn worktree and --capacity; /remote-control connects the current session. Available commands vary by client, so check the current limitations.
Full doc: Remote Control | Security notes
Task management (v2.1.16+)
Availability: newer models, including Opus 5.5, Sonnet 5, and Fable, do not receive task-tracking tools by default. Start with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude to opt in. CLAUDE_CODE_ENABLE_TASKS=0 selects legacy TodoWrite only where task tools are enabled. Official tool availability.
Two systems available:
| System | When to Use | Persistence |
|---|---|---|
| Tasks API (v2.1.16+) | Multi-session projects, dependencies | β
Disk (~/.claude/tasks/) |
| TodoWrite (Legacy) | Simple single-session | β Session only |
Tasks API commands
# Enable persistence across sessions
export CLAUDE_CODE_TASK_LIST_ID="project-name"
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude
# Inside Claude: Create task hierarchy
> "Create tasks for auth system with dependencies"
# Resume later (new session)
export CLAUDE_CODE_TASK_LIST_ID="project-name"
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 claude
> "TaskList to see current state"Key capabilities:
- π Persistent: Survives session end, context compaction
- π Dependencies: Task A blocks Task B
- π Multi-session: Broadcast state to multiple terminals
- π Status: pending β in_progress β completed
β οΈ Limitation: TaskList shows id, subject, status, blockedBy only.
For description/metadata β use TaskGet(taskId) per task.
Tip: Store key info in subject for quick scanning.
Migration flag (v2.1.19+):
# Revert to old TodoWrite system
CLAUDE_CODE_ENABLE_TODO_TOOLS=1 CLAUDE_CODE_ENABLE_TASKS=0 claudeβ Full workflow: guide/workflows/task-management.md
The golden rules
- Always review diffs before accepting
- Use
/compactbefore context gets critical (>70%) - Be specific in requests (WHAT, WHERE, HOW, VERIFY)
- Plan Mode first for complex/risky tasks
- Create CLAUDE.md for every project
- Commit frequently after each completed task
- Know what's sent: prompts, files, MCP results β Anthropic (opt-out training)
Quick decision tree
Simple task β Just ask Claude
Complex task β Tasks API to plan first
Risky change β Plan Mode first
Repeating task β Create agent or command
Context full β /compact or /clear
Need docs β Use Context7 MCP
Deep analysis β Use Opus (thinking on by default)Common issues quick fix
| Problem | Solution |
|---|---|
| "Command not found" | Check PATH, reinstall: curl -fsSL https://claude.ai/install.sh | sh |
| Context too high (>70%) | /compact immediately |
| Slow responses | /compact or /clear |
| MCP not working | claude mcp list, check config |
| Permission denied | Check settings.local.json |
| Hook blocking | Check hook exit code, review logic |
Health Check Script (save & run):
# macOS/Linux
which claude && claude doctor && claude mcp list
# Windows PowerShell
where.exe claude; claude doctor; claude mcp listCost optimization
| Model | Use For | Cost |
|---|---|---|
| Haiku | Simple fixes, reviews | $ |
| Sonnet | Most development | $$ |
| Opus | Architecture, complex bugs | $$$ |
| OpusPlan | Plan (Opus) + Execute (Sonnet) | $$ |
Tip: Use --add-dir to allow tool access to directories outside your current working directory
Community tools
| Tool | Purpose | Install |
|---|---|---|
| ccusage | Cost tracking & reports | bunx ccusage daily |
| RTK | Shell-output reduction (up to 90%) | brew install rtk (or cargo install --git https://github.com/rtk-ai/rtk) Β· Site (author is a core contributor) |
| claude-code-viewer | Session history UI | npx @kimuson/claude-code-viewer |
| Entire CLI | Session checkpoints + governance | entire.io (Feb 2026) |
Entire CLI: Agent-native platform by ex-GitHub CEO with rewindable checkpoints, approval gates, audit trails. For compliance (SOC2, HIPAA) or multi-agent workflows.
Search tools quick reference
Quick decision (5 seconds): exact text β rg | exact name β rg/Serena | concept β grepai | structure β ast-grep
| Task | Tool | Command |
|---|---|---|
| "Find TODO comments" | rg |
rg "TODO" |
| "Find auth code" | grepai |
grepai search "authentication" |
| "Who calls login?" | grepai |
grepai trace callers "login" |
| "Get file structure" | Serena |
serena get_symbols_overview |
| "Async without try/catch" | ast-grep |
ast-grep "async function $F" |
Speed: rg (~20ms) β Serena (~100ms) β ast-grep (~200ms) β grepai (~500ms)
Full workflows: workflows/search-tools-mastery.md
Resources
- Official docs: docs.anthropic.com/claude-code
- Advanced guide: Claudelog.com - Tips & patterns
- Full guide:
ultimate-guide.md(this repo) - Whitepapers (FR + EN): cc.bruniaux.com/whitepapers, 13 focused PDFs
- Project memory: Create
CLAUDE.mdat project root - DeepSeek (cost-effective): Configure via
ANTHROPIC_BASE_URL
Author: Florian BRUNIAUX | @MΓ©thode Aristote | Written with Claude
Last updated: Sep 24, 2026 | Version 3.44.1
Template Library (278 templates)
Agents (21 files)
adr-writer.md: Architecture Decision Recordsarchitecture-reviewer.md: System architecture reviewcode-reviewer.md: Code quality reviewdevops-sre.md: DevOps/SRE operationsimplementer.md: Feature implementationintegration-reviewer.md: API integration reviewloop-monitor.md: Autonomous loop progress monitoringoutput-evaluator.md: AI output evaluationplan-challenger.md: Challenge implementation plansplanner.md: Task planningplanning-coordinator.md: Multi-agent coordinationrefactoring-specialist.md: Code refactoringsecurity-auditor.md: Security auditingsecurity-patcher.md: Security patch applicationtest-writer.md: Test generationanalytics-with-eval/: Full analytics agent with eval framework (analytics-agent.md + eval/report-template.md)cyber-defense/: Multi-agent cyber defense team (anomaly-detector.md, log-ingestor.md, risk-classifier.md, threat-reporter.md)
Commands (legacy, pre-CC 2.1.3)
Since Claude Code 2.1.3, .claude/commands/ merged into .claude/skills/; every file below is now a redirect stub pointing to its examples/skills/<name>/SKILL.md equivalent, kept for backward compatibility.
audit-agents-skills.md: Quality audit for .claude/ configsaudit-codebase.md: Full codebase auditcatchup.md: Daily catchup briefingcommit.md: Smart git commitdiagnose.md: Problem diagnosisexplain.md: Code explanationgenerate-tests.md: Test suite generationgit-worktree.md: Isolated git worktree workflowgit-worktree-status.md: Worktree statusgit-worktree-clean.md: Worktree cleanupgit-worktree-remove.md: Worktree removaloptimize.md: Performance optimizationplan-execute.md: Plan then execute workflowplan-start.md: Plan mode startupplan-validate.md: Plan validationpr.md: Pull request creationrefactor.md: Code refactoringrelease-notes.md: Release notes generationlearn/: Interactive learning command
Hooks (bash + PowerShell)
Bash hooks (36 files in examples/hooks/bash/, a representative sample):
dangerous-actions-blocker.sh: Block destructive commands (PreToolUse)prompt-injection-detector.sh: Detect prompt injection attempts (PreToolUse)security-check.sh: Block commands containing secrets (PreToolUse)pre-commit-secrets.sh: Detect secrets in staged files before commitauto-format.sh: Auto-format edited files (PostToolUse)test-on-change.sh: Run tests after code changestypecheck-on-save.sh: Type-check edited filesnotification.sh: macOS desktop alerts with contextual soundssession-logger.sh: Log all Claude Code operations for monitoring (PostToolUse)auto-checkpoint.sh: Automatic git checkpoints during a sessionlearning-capture.sh: Capture one learning insight at session end (Stop)output-validator.sh: Validate Claude's outputs for quality issues (PostToolUse)
PowerShell hooks (2 files in examples/hooks/powershell/, Windows equivalents for a subset, not a 1:1 mirror of the bash list):
auto-format.ps1,security-check.ps1
Skills (64 modules)
ast-grep-patterns.md: AST-based code search patternsaudit-agents-skills/: Agents/skills quality audit systemccboard/: Claude Code monitoring dashboardcyber-defense-team/: Security team coordinationdesign-patterns/: Software design pattern guidanceguide-recap/: CHANGELOG β social content generatorissue-triage/: GitHub issue prioritizationlanding-page-generator/: Landing page from repopdf-generator.md: Professional PDF generation (Quarto/Typst)pr-triage/: PR review prioritizationrelease-notes-generator/: Multi-format release notesrtk-optimizer/: Token reduction optimizationsecurity-checklist.md: Security audit checklistskill-creator/: Create new skills with proper structuretalk-pipeline/: Conference talk preparation pipelinetdd-workflow.md: Test-Driven Development workflowvoice-refine/: Voice input refinement
Scripts (15 utility scripts)
audit-scan.sh: Config security auditbridge.py: Tool bridging utilitycheck-claude.sh/.ps1: Installation health checkclean-reinstall-claude.sh/.ps1: Clean reinstallfresh-context-loop.sh: Automated fresh-context iterationmigrate-arguments-syntax.sh/.ps1: Update argument syntaxrtk-benchmark.sh: RTK token savings benchmarksession-search.sh: Search across sessionssession-stats.sh: Session statisticssonnetplan.sh: OpusPlan workflow automationsync-claude-config.sh: Sync .claude/ across machines
Additional Categories
claude-md/: CLAUDE.md templates (7 variants)config/: Configuration templates (settings.json, etc.)github-actions/: CI/CD workflow templatesintegrations/: Third-party integrationsmcp-configs/: MCP server configuration templatesmemory/: Memory file templatesmodes/: Custom mode configurationsmulti-provider/: Multi-LLM provider setupsplugins/: Plugin templatesrules/: Auto-loaded rules templatessemantic-anchors/: Semantic navigation patternsteam-config/: Team configuration examplestemplates/: Generic project templatesworkflows/: Step-by-step workflow guides
Contribution and verification workflows
guide/workflows/ai-assisted-open-source-contributions.md: prepare a contribution with project policy, reproduction, author understanding and verification evidence.examples/templates/ai-assisted-contribution.md: reusable contribution packet.examples/workflows/review-admission.md: proposed pause/resume policy for a shared verification queue, with illustrative tabletop cases.examples/learning-project/review-comprehension-exercise.md: proposed comprehension assessment, distinct from delivery metrics.
The 2025-2026 IFTTD additions extend Practitioner Insights to 75 attributed observations, including six public transcripts checked through episode 373. Field accounts and proposed procedures do not establish measured throughput or learning improvements.
FAQ
Q: What is the Claude Code Ultimate Guide?
A: The most comprehensive community guide for Claude Code (Anthropic's CLI). 26,187 lines in the canonical full guide, 278 production-ready templates, 473-question quiz, and security threat database. Free and open-source (CC BY-SA 4.0).
Q: Is this guide free?
A: Yes, completely free. The guide is CC BY-SA 4.0 (share and adapt with attribution). Templates are CC0 (copy-paste freely, no attribution needed). No paywall, no login required.
Q: What's the difference between this and Anthropic's official docs?
A: This guide goes 10x deeper on practical workflows, templates, security hardening, and real-world patterns. The official docs explain what Claude Code does; this guide teaches you how to use it effectively for production work.
Q: Do I need a paid Claude plan to use Claude Code?
A: A Claude subscription is not the only access path. Individuals can use Pro or Max, organizations can use Team or Enterprise for workforce access, and usage-based deployments can authenticate with supported API or cloud-provider credentials. These paths have different billing and administrative controls; see guide/ops/subscription-strategy.md.
Q: What are Hooks in Claude Code?
A: Hooks are shell scripts (bash or PowerShell) that run automatically before/after Claude tool calls. They enable event-driven automation: block dangerous commands, scan for secrets, auto-format code, run tests after edits, log activity for compliance. They use exit 0 (continue) or exit 2 (block) to control Claude's actions.
Q: What are MCP servers?
A: Model Context Protocol servers extend Claude's capabilities beyond its built-in tools. Examples: Serena (codebase indexation + session memory), Context7 (library documentation), Sequential (structured multi-step reasoning), Playwright (browser automation), Postgres (database queries). The community has built 1,000+ MCP servers; this guide teaches you to vet them for security.
Q: What is Plan Mode?
A: Plan Mode (Shift+Tab Γ 2 or /plan) is a read-only exploration mode where Claude can analyze your codebase without making any changes. Use it before complex or risky tasks to let Claude research the problem, then switch to execution mode.
Q: What are Agents in Claude Code?
A: Agents are custom Claude instances with specific instructions, tools, and personas stored in .claude/agents/ as markdown files. Examples: a security-auditor that only uses Read/Grep tools, a code-reviewer with specific standards, a devops-sre with infrastructure expertise. They're invoked via @agent-name in your prompt.
Q: What is CLAUDE.md?
A: CLAUDE.md is a memory file at your project root (or ~/.claude/) that Claude reads at the start of every session. Use it to define project conventions, tech stack, coding standards, and commands. It's the primary way to give Claude persistent project context without repeating yourself.
Q: What are Skills?
A: Skills are reusable knowledge modules stored in .claude/skills/. Two types: Capability Uplift (fills model gaps, becomes less necessary as models improve) and Encoded Preference (encodes your team's specific workflow preferences, stays durable). Skills 2.0 (March 2026) adds Benchmark Mode, A/B testing, and Trigger Tuning.
Q: How do I handle context limits?
A: Monitor context usage via /status. At 70%: run /compact to summarize and free context. At 90%: use /clear for a fresh start. Use Plan Mode early to explore without consuming context. For long projects, use Tasks API (CLAUDE_CODE_TASK_LIST_ID) for cross-session persistence.
Q: Is Claude Code safe for production use?
A: With proper hardening, yes. Key steps: never use bypassPermissions in production, vet all MCP servers against the threat database (28+ CVEs tracked), use hooks to block dangerous commands, enable audit logging, run claude doctor regularly. See guide/security/security-hardening.md for the complete checklist.
Privacy & Data
Agentic pentesting: guide/security/agentic-pentesting.md compares DarkMoon and Strix, separates configuration scans, source review, and active testing, and explains exploit evidence, model data exposure, and reproducible evaluation. guide/security/data-privacy.md covers reversible tokenization and error-path limits. The comparison records source inspection and bounded local checks; it does not establish a performance winner or production readiness.
Claude Code sends to Anthropic servers: your prompts, file contents you reference, MCP tool results.
- Default retention: 5 years (training enabled)
- Opt-out: 30 days retention, https://claude.ai/settings/data-privacy-controls
- Enterprise: 0 retention, no training
- The guide covers this in detail:
guide/security/data-privacy.md
Repository
claude-code-ultimate-guide/
βββ llms.txt # This file (short version, for AI indexing)
βββ llms-full.txt # Full content (you are here)
βββ guide/ # Core documentation
β βββ ultimate-guide.md # Complete guide (26,695 lines)
β βββ cheatsheet.md # 1-page reference
β βββ core/architecture.md # How Claude Code works internally
β βββ security/security-hardening.md # Security best practices
β βββ security/data-privacy.md # What data is sent to Anthropic
β βββ core/claude-code-releases.md # Official release tracking
βββ examples/ # 278 production-ready templates
β βββ agents/ # Custom AI personas
β βββ commands/ # Legacy slash commands (pre-CC 2.1.3)
β βββ hooks/ # Event automation (bash + PowerShell)
β βββ skills/ # User-invocable skills (unified since CC 2.1.3)
β βββ scripts/ # Utility scripts
βββ machine-readable/ # LLM/AI consumption
β βββ reference.yaml # Machine-optimized index (~2K tokens)
β βββ llms.txt # Short version
βββ whitepapers/ # 13 focused PDFs (FR + EN)
βββ quiz/ # 473-question interactive quizAuthor & License
Author: Florian Bruniaux, Founding Engineer @ MΓ©thode Aristote
GitHub: https://github.com/FlorianBruniaux
License: Guide = CC BY-SA 4.0 | Templates = CC0 1.0