docs: Sync all documentation with Claude Code February 2026 features

Update 23 files across all 10 tutorial directories and 7 reference
documents to match the latest Claude Code v2.1+ features and correct
outdated content including model names (4.5→4.6), permission modes,
hook events, CLI syntax, MCP config paths, plugin manifest format,
checkpoint commands, session management, and URLs. Add documentation
for new features: Auto Memory, Remote Control, Web Sessions, Desktop
App, Agent Teams, MCP OAuth, Task List, Sandboxing, and more.
This commit is contained in:
Luong NGUYEN
2026-02-25 23:19:08 +01:00
parent 20779dbf79
commit 487c96d950
26 changed files with 2263 additions and 1140 deletions
+12 -1
View File
@@ -30,9 +30,12 @@ Built-in commands are shortcuts for common actions. Type `/` in Claude Code to s
| `/context` | Visualize current context usage as a colored grid | | `/context` | Visualize current context usage as a colored grid |
| `/copy` | Copy the last assistant response to clipboard | | `/copy` | Copy the last assistant response to clipboard |
| `/cost` | Show token usage statistics | | `/cost` | Show token usage statistics |
| `/desktop` | Hand off CLI session to Desktop app (macOS/Windows) |
| `/doctor` | Checks the health of your Claude Code installation | | `/doctor` | Checks the health of your Claude Code installation |
| `/exit` | Exit the REPL | | `/exit` | Exit the REPL |
| `/export [filename]` | Export the current conversation to a file or clipboard | | `/export [filename]` | Export the current conversation to a file or clipboard |
| `/fast` | Toggle fast mode (same model, faster output) |
| `/fork` | Fork the current session into a new conversation |
| `/help` | Get usage help | | `/help` | Get usage help |
| `/hooks` | Manage hook configurations for tool events | | `/hooks` | Manage hook configurations for tool events |
| `/ide` | Manage IDE integrations and show status | | `/ide` | Manage IDE integrations and show status |
@@ -67,6 +70,14 @@ Built-in commands are shortcuts for common actions. Type `/` in Claude Code to s
| `/usage` | Show plan usage limits and rate limit status | | `/usage` | Show plan usage limits and rate limit status |
| `/vim` | Enter vim mode for alternating insert and command modes | | `/vim` | Enter vim mode for alternating insert and command modes |
### Recent Changes
- `/model` picker now shows human-readable labels (e.g., "Sonnet 4.5") instead of raw model IDs
- `/rename` auto-generates a session name from conversation context when called without arguments
- `/rename` now updates the terminal tab title by default
- `/resume` picker increased initial session count from 10 to 50
- MCP prompts are available as `/mcp__<server>__<prompt>` commands (see [MCP Prompts as Commands](#mcp-prompts-as-commands))
## Custom Commands (Now Skills) ## Custom Commands (Now Skills)
Custom slash commands have been **merged into skills**. Both approaches create commands you can invoke with `/command-name`: Custom slash commands have been **merged into skills**. Both approaches create commands you can invoke with `/command-name`:
@@ -76,7 +87,7 @@ Custom slash commands have been **merged into skills**. Both approaches create c
| **Skills (Recommended)** | `.claude/skills/<name>/SKILL.md` | Current standard | | **Skills (Recommended)** | `.claude/skills/<name>/SKILL.md` | Current standard |
| **Legacy Commands** | `.claude/commands/<name>.md` | Still works | | **Legacy Commands** | `.claude/commands/<name>.md` | Still works |
If a skill and a command share the same name, the **skill takes precedence**. If a skill and a command share the same name, the **skill takes precedence**. For example, when both `.claude/commands/review.md` and `.claude/skills/review/SKILL.md` exist, the skill version is used.
### Migration Path ### Migration Path
+161 -35
View File
@@ -159,7 +159,7 @@ The `/memory` command provides direct access to edit your CLAUDE.md memory files
/memory /memory
# Claude presents options: # Claude presents options:
# 1. Enterprise Policy Memory # 1. Managed Policy Memory
# 2. Project Memory (./CLAUDE.md) # 2. Project Memory (./CLAUDE.md)
# 3. User Memory (~/.claude/CLAUDE.md) # 3. User Memory (~/.claude/CLAUDE.md)
# 4. Local Project Memory # 4. Local Project Memory
@@ -180,12 +180,17 @@ CLAUDE.md files support the `@path/to/file` syntax to include external content:
See @README.md for project overview See @README.md for project overview
See @package.json for available npm commands See @package.json for available npm commands
See @docs/architecture.md for system design See @docs/architecture.md for system design
# Import from home directory using absolute path
@~/.claude/my-project-instructions.md
``` ```
**Import features:** **Import features:**
- Supports both relative and absolute paths - Both relative and absolute paths are supported (e.g., `@docs/api.md` or `@~/.claude/my-project-instructions.md`)
- Enables recursive nesting up to 5 levels deep - Recursive imports are supported with a maximum depth of 5
- First-time imports from external locations trigger an approval dialog for security
- Import directives are not evaluated inside markdown code spans or code blocks (so documenting them in examples is safe)
- Helps avoid duplication by referencing existing documentation - Helps avoid duplication by referencing existing documentation
- Automatically includes referenced content in Claude's context - Automatically includes referenced content in Claude's context
@@ -208,11 +213,11 @@ graph TB
## Memory Hierarchy in Claude Code ## Memory Hierarchy in Claude Code
Claude Code uses a four-tier hierarchical memory system. Memory files are automatically loaded when Claude Code launches, with higher-level files taking precedence. Claude Code uses a multi-tier hierarchical memory system. Memory files are automatically loaded when Claude Code launches, with higher-level files taking precedence.
**Complete Memory Hierarchy (in order of precedence):** **Complete Memory Hierarchy (in order of precedence):**
1. **Enterprise Policy** - Organization-wide instructions 1. **Managed Policy** - Organization-wide instructions
- macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md` - macOS: `/Library/Application Support/ClaudeCode/CLAUDE.md`
- Linux: `/etc/claude-code/CLAUDE.md` - Linux: `/etc/claude-code/CLAUDE.md`
- Windows: `C:\ProgramData\ClaudeCode\CLAUDE.md` - Windows: `C:\ProgramData\ClaudeCode\CLAUDE.md`
@@ -220,32 +225,51 @@ Claude Code uses a four-tier hierarchical memory system. Memory files are automa
2. **Project Memory** - Team-shared context (version controlled) 2. **Project Memory** - Team-shared context (version controlled)
- `./.claude/CLAUDE.md` or `./CLAUDE.md` (in repository root) - `./.claude/CLAUDE.md` or `./CLAUDE.md` (in repository root)
3. **User Memory** - Personal preferences 3. **Project Rules** - Modular, topic-specific project instructions
- `./.claude/rules/*.md`
4. **User Memory** - Personal preferences (all projects)
- `~/.claude/CLAUDE.md` - `~/.claude/CLAUDE.md`
4. **Local Project Memory** - Personal project-specific preferences (deprecated) 5. **User-Level Rules** - Personal rules (all projects)
- `~/.claude/rules/*.md`
6. **Local Project Memory** - Personal project-specific preferences
- `./CLAUDE.local.md` - `./CLAUDE.local.md`
7. **Auto Memory** - Claude's automatic notes and learnings
- `~/.claude/projects/<project>/memory/`
**Memory Discovery Behavior:** **Memory Discovery Behavior:**
Claude searches for memory files in this order, with earlier locations taking precedence: Claude searches for memory files in this order, with earlier locations taking precedence:
```mermaid ```mermaid
graph TD graph TD
A["Project Root"] -->|searches up| B["CLAUDE.md"] A["Managed Policy<br/>/Library/.../ClaudeCode/CLAUDE.md"] -->|highest priority| B["Project Memory<br/>./CLAUDE.md"]
B -->|highest priority| B1["Global instructions"] B --> C["Project Rules<br/>./.claude/rules/*.md"]
A -->|searches down| C["Subdirectory CLAUDE.md"] C --> D["User Memory<br/>~/.claude/CLAUDE.md"]
C -->|specific overrides| C1["Directory-specific rules"] D --> E["User Rules<br/>~/.claude/rules/*.md"]
H["User Home"] -->|fallback| D["~/.claude/CLAUDE.md"] E --> F["Local Project Memory<br/>./CLAUDE.local.md"]
D -->|personal preferences| D1["Personal settings"] F --> G["Auto Memory<br/>~/.claude/projects/.../memory/"]
B1 -->|imports| E["@docs/architecture.md"] B -->|imports| H["@docs/architecture.md"]
E -->|imports| F["@docs/api-standards.md"] H -->|imports| I["@docs/api-standards.md"]
style A fill:#fce4ec,stroke:#333,color:#333
style B fill:#e1f5fe,stroke:#333,color:#333
style C fill:#e1f5fe,stroke:#333,color:#333
style D fill:#f3e5f5,stroke:#333,color:#333
style E fill:#f3e5f5,stroke:#333,color:#333
style F fill:#e8f5e9,stroke:#333,color:#333
style G fill:#fff3e0,stroke:#333,color:#333
style H fill:#e1f5fe,stroke:#333,color:#333
style I fill:#e1f5fe,stroke:#333,color:#333
``` ```
## Modular Rules System ## Modular Rules System
Create organized, path-specific rules using the `.claude/rules/` directory structure: Create organized, path-specific rules using the `.claude/rules/` directory structure. Rules can be defined at both the project level and user level:
``` ```
your-project/ your-project/
@@ -254,9 +278,20 @@ your-project/
│ └── rules/ │ └── rules/
│ ├── code-style.md │ ├── code-style.md
│ ├── testing.md │ ├── testing.md
── security.md ── security.md
│ └── api/ # Subdirectories supported
│ ├── conventions.md
│ └── validation.md
~/.claude/
├── CLAUDE.md
└── rules/ # User-level rules (all projects)
├── personal-style.md
└── preferred-patterns.md
``` ```
Rules are discovered recursively within the `rules/` directory, including any subdirectories. User-level rules at `~/.claude/rules/` are loaded before project-level rules, allowing personal defaults that projects can override.
### Path-Specific Rules with YAML Frontmatter ### Path-Specific Rules with YAML Frontmatter
Define rules that apply only to specific file paths: Define rules that apply only to specific file paths:
@@ -281,23 +316,26 @@ paths: src/api/**/*.ts
- `src/**/*.{ts,tsx}` - Multiple extensions - `src/**/*.{ts,tsx}` - Multiple extensions
- `{src,lib}/**/*.ts, tests/**/*.test.ts` - Multiple patterns - `{src,lib}/**/*.ts, tests/**/*.test.ts` - Multiple patterns
### Symlinks Support ### Subdirectories and Symlinks
Rules in `.claude/rules/` support symlinks for file references and external documentation. Rules in `.claude/rules/` support two organizational features:
- **Subdirectories**: Rules are discovered recursively, so you can organize them into topic-based folders (e.g., `rules/api/`, `rules/testing/`, `rules/security/`)
- **Symlinks**: Symlinks are supported for sharing rules across multiple projects. For example, you can symlink a shared rule file from a central location into each project's `.claude/rules/` directory
## Memory Locations Table ## Memory Locations Table
| Location | Scope | Priority | Shared | Access | Best For | | Location | Scope | Priority | Shared | Access | Best For |
|----------|-------|----------|--------|--------|----------| |----------|-------|----------|--------|--------|----------|
| `/Library/Application Support/ClaudeCode/CLAUDE.md` (macOS) | Enterprise | Highest | Organization | System | Company-wide policies | | `/Library/Application Support/ClaudeCode/CLAUDE.md` (macOS) | Managed Policy | 1 (Highest) | Organization | System | Company-wide policies |
| `/etc/claude-code/CLAUDE.md` (Linux) | Enterprise | Highest | Organization | System | Organization standards | | `/etc/claude-code/CLAUDE.md` (Linux) | Managed Policy | 1 (Highest) | Organization | System | Organization standards |
| `C:\ProgramData\ClaudeCode\CLAUDE.md` (Windows) | Enterprise | Highest | Organization | System | Corporate guidelines | | `C:\ProgramData\ClaudeCode\CLAUDE.md` (Windows) | Managed Policy | 1 (Highest) | Organization | System | Corporate guidelines |
| `./CLAUDE.md` | Project | High | Team | Git | Team standards, shared architecture | | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Project Memory | 2 | Team | Git | Team standards, shared architecture |
| `./.claude/CLAUDE.md` | Project | High | Team | Git | Alternative project location | | `./.claude/rules/*.md` | Project Rules | 3 | Team | Git | Path-specific, modular rules |
| `./.claude/rules/` | Project Rules | High | Team | Git | Path-specific, modular rules | | `~/.claude/CLAUDE.md` | User Memory | 4 | Individual | Filesystem | Personal preferences (all projects) |
| `./subdir/CLAUDE.md` | Directory | Medium | Team | Git | Directory-specific rules | | `~/.claude/rules/*.md` | User Rules | 5 | Individual | Filesystem | Personal rules (all projects) |
| `~/.claude/CLAUDE.md` | Personal | Low | Individual | Filesystem | Personal preferences | | `./CLAUDE.local.md` | Project Local | 6 | Individual | Git (ignored) | Personal project-specific preferences |
| `./CLAUDE.local.md` | Project Local | Deprecated | Individual | Git (ignored) | Personal project notes (deprecated) | | `~/.claude/projects/<project>/memory/` | Auto Memory | 7 (Lowest) | Individual | Filesystem | Claude's automatic notes and learnings |
## Memory Update Lifecycle ## Memory Update Lifecycle
@@ -320,6 +358,89 @@ sequenceDiagram
Claude-->>User: "Memory saved!" Claude-->>User: "Memory saved!"
``` ```
## Auto Memory
Auto memory is a persistent directory where Claude automatically records learnings, patterns, and insights as it works with your project. Unlike CLAUDE.md files which you write and maintain manually, auto memory is written by Claude itself during sessions.
### How Auto Memory Works
- **Location**: `~/.claude/projects/<project>/memory/`
- **Entrypoint**: `MEMORY.md` serves as the main file in the auto memory directory
- **Topic files**: Optional additional files for specific subjects (e.g., `debugging.md`, `api-conventions.md`)
- **Loading behavior**: The first 200 lines of `MEMORY.md` are loaded into the system prompt at session start. Topic files are loaded on demand, not at startup.
- **Read/write**: Claude reads and writes memory files during sessions as it discovers patterns and project-specific knowledge
### Auto Memory Architecture
```mermaid
graph TD
A["Claude Session Starts"] --> B["Load MEMORY.md<br/>(first 200 lines)"]
B --> C["Session Active"]
C --> D["Claude discovers<br/>patterns & insights"]
D --> E{"Write to<br/>auto memory"}
E -->|General notes| F["MEMORY.md"]
E -->|Topic-specific| G["debugging.md"]
E -->|Topic-specific| H["api-conventions.md"]
C --> I["On-demand load<br/>topic files"]
I --> C
style A fill:#e1f5fe,stroke:#333,color:#333
style B fill:#e1f5fe,stroke:#333,color:#333
style C fill:#e8f5e9,stroke:#333,color:#333
style D fill:#f3e5f5,stroke:#333,color:#333
style E fill:#fff3e0,stroke:#333,color:#333
style F fill:#fce4ec,stroke:#333,color:#333
style G fill:#fce4ec,stroke:#333,color:#333
style H fill:#fce4ec,stroke:#333,color:#333
style I fill:#f3e5f5,stroke:#333,color:#333
```
### Auto Memory Directory Structure
```
~/.claude/projects/<project>/memory/
├── MEMORY.md # Entrypoint (first 200 lines loaded at startup)
├── debugging.md # Topic file (loaded on demand)
├── api-conventions.md # Topic file (loaded on demand)
└── testing-patterns.md # Topic file (loaded on demand)
```
### Controlling Auto Memory
Auto memory can be controlled via the `CLAUDE_CODE_DISABLE_AUTO_MEMORY` environment variable:
| Value | Behavior |
|-------|----------|
| `0` | Force auto memory **on** |
| `1` | Force auto memory **off** |
| *(unset)* | Default behavior (auto memory enabled) |
```bash
# Disable auto memory for a session
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 claude
# Force auto memory on explicitly
CLAUDE_CODE_DISABLE_AUTO_MEMORY=0 claude
```
## Additional Directories with `--add-dir`
The `--add-dir` flag allows Claude Code to load CLAUDE.md files from additional directories beyond the current working directory. This is useful for monorepos or multi-project setups where context from other directories is relevant.
To enable this feature, set the environment variable:
```bash
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1
```
Then launch Claude Code with the flag:
```bash
claude --add-dir /path/to/other/project
```
Claude will load CLAUDE.md from the specified additional directory alongside the memory files from your current working directory.
## Practical Examples ## Practical Examples
### Example 1: Project Memory Structure ### Example 1: Project Memory Structure
@@ -686,7 +807,7 @@ graph LR
- **Keep organized**: Structure memory files with clear markdown sections and headings - **Keep organized**: Structure memory files with clear markdown sections and headings
- **Use appropriate hierarchy levels**: - **Use appropriate hierarchy levels**:
- **Enterprise memory**: Company-wide policies, security standards, compliance requirements - **Managed policy**: Company-wide policies, security standards, compliance requirements
- **Project memory**: Team standards, architecture, coding conventions (commit to git) - **Project memory**: Team standards, architecture, coding conventions (commit to git)
- **User memory**: Personal preferences, communication style, tooling choices - **User memory**: Personal preferences, communication style, tooling choices
- **Directory memory**: Module-specific rules and overrides - **Directory memory**: Module-specific rules and overrides
@@ -728,7 +849,7 @@ graph LR
| Use Case | Memory Level | Rationale | | Use Case | Memory Level | Rationale |
|----------|-------------|-----------| |----------|-------------|-----------|
| Company security policy | Enterprise | Applies to all projects organization-wide | | Company security policy | Managed Policy | Applies to all projects organization-wide |
| Team code style guide | Project | Shared with team via git | | Team code style guide | Project | Shared with team via git |
| Your preferred editor shortcuts | User | Personal preference, not shared | | Your preferred editor shortcuts | User | Personal preference, not shared |
| API module standards | Directory | Specific to that module only | | API module standards | Directory | Specific to that module only |
@@ -911,17 +1032,22 @@ For the most up-to-date information, refer to the official Claude Code documenta
**Import Syntax:** **Import Syntax:**
- Use `@path/to/file` to include external content - Use `@path/to/file` to include external content (e.g., `@~/.claude/my-project-instructions.md`)
- Supports both relative and absolute paths - Supports both relative and absolute paths
- Recursive nesting supported up to 5 levels deep - Recursive imports supported with a maximum depth of 5
- First-time external imports trigger an approval dialog
- Not evaluated inside markdown code spans or code blocks
- Automatically includes referenced content in Claude's context - Automatically includes referenced content in Claude's context
**Memory Hierarchy Precedence:** **Memory Hierarchy Precedence:**
1. Enterprise Policy (highest precedence) 1. Managed Policy (highest precedence)
2. Project Memory 2. Project Memory
3. User Memory 3. Project Rules (`.claude/rules/`)
4. Local Project Memory (deprecated, lowest precedence) 4. User Memory
5. User-Level Rules (`~/.claude/rules/`)
6. Local Project Memory
7. Auto Memory (lowest precedence)
## Related Concepts Links ## Related Concepts Links
+52 -11
View File
@@ -21,7 +21,7 @@ Agent Skills are reusable, filesystem-based capabilities that extend Claude's fu
Skills follow the [Agent Skills](https://agentskills.io) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection. Skills follow the [Agent Skills](https://agentskills.io) open standard, which works across multiple AI tools. Claude Code extends the standard with additional features like invocation control, subagent execution, and dynamic context injection.
> **Note**: Custom slash commands have been merged into skills. A file at `.claude/commands/review.md` and a skill at `.claude/skills/review/SKILL.md` both create `/review` and work the same way. Your existing `.claude/commands/` files keep working. > **Note**: Custom slash commands have been merged into skills. `.claude/commands/` files still work and support the same frontmatter fields. Skills are recommended for new development. When both exist at the same path (e.g., `.claude/commands/review.md` and `.claude/skills/review/SKILL.md`), the skill takes precedence.
## How Skills Work: Progressive Disclosure ## How Skills Work: Progressive Disclosure
@@ -196,13 +196,13 @@ Deploy the application:
## Controlling Skill Invocation ## Controlling Skill Invocation
By default, both you and Claude can invoke any skill. Two frontmatter fields control this: By default, both you and Claude can invoke any skill. Two frontmatter fields control the three invocation modes:
| Frontmatter | You can invoke | Claude can invoke | When loaded | | Frontmatter | You can invoke | Claude can invoke |
|-------------|---------------|-------------------|-------------| |---|---|---|
| (default) | Yes | Yes | Description always in context | | (default) | Yes | Yes |
| `disable-model-invocation: true` | Yes | No | Description not in context | | `disable-model-invocation: true` | Yes | No |
| `user-invocable: false` | No | Yes | Description always in context | | `user-invocable: false` | No | Yes |
**Use `disable-model-invocation: true`** for workflows with side effects: `/commit`, `/deploy`, `/send-slack-message`. You don't want Claude deciding to deploy because your code looks ready. **Use `disable-model-invocation: true`** for workflows with side effects: `/commit`, `/deploy`, `/send-slack-message`. You don't want Claude deciding to deploy because your code looks ready.
@@ -260,7 +260,27 @@ Commands execute immediately; Claude only sees the final output.
## Running Skills in Subagents ## Running Skills in Subagents
Add `context: fork` to run a skill in isolation: Add `context: fork` to run a skill in an isolated subagent context. The skill content becomes the task for a dedicated subagent with its own context window, keeping the main conversation uncluttered.
The `agent` field specifies which agent type to use:
| Agent Type | Best For |
|---|---|
| `Explore` | Read-only research, codebase analysis |
| `Plan` | Creating implementation plans |
| `general-purpose` | Broad tasks requiring all tools |
| Custom agents | Specialized agents defined in your configuration |
**Example frontmatter:**
```yaml
---
context: fork
agent: Explore
---
```
**Full skill example:**
```yaml ```yaml
--- ---
@@ -276,8 +296,6 @@ Research $ARGUMENTS thoroughly:
3. Summarize findings with specific file references 3. Summarize findings with specific file references
``` ```
The skill content becomes the task for a dedicated subagent with its own context. The `agent` field specifies which agent type to use (`Explore`, `Plan`, `general-purpose`, or custom agents).
## Practical Examples ## Practical Examples
### Example 1: Code Review Skill ### Example 1: Code Review Skill
@@ -513,6 +531,29 @@ For code smell catalog, see [references/code-smells.md](references/code-smells.m
For refactoring techniques, see [references/refactoring-catalog.md](references/refactoring-catalog.md). For refactoring techniques, see [references/refactoring-catalog.md](references/refactoring-catalog.md).
``` ```
## Supporting Files
Skills can include multiple files in their directory beyond `SKILL.md`. These supporting files (templates, examples, scripts, reference documents) let you keep the main skill file focused while providing Claude with additional resources it can load as needed.
```
my-skill/
├── SKILL.md # Main instructions (required, keep under 500 lines)
├── templates/ # Templates for Claude to fill in
│ └── output-format.md
├── examples/ # Example outputs showing expected format
│ └── sample-output.md
├── references/ # Domain knowledge and specifications
│ └── api-spec.md
└── scripts/ # Scripts Claude can execute
└── validate.sh
```
Guidelines for supporting files:
- Keep `SKILL.md` under **500 lines**. Move detailed reference material, large examples, and specifications to separate files.
- Reference additional files from `SKILL.md` using **relative paths** (e.g., `[API reference](references/api-spec.md)`).
- Supporting files are loaded at Level 3 (as needed), so they do not consume context until Claude actually reads them.
## Managing Skills ## Managing Skills
### Viewing Available Skills ### Viewing Available Skills
@@ -660,7 +701,7 @@ If Claude uses your skill when you don't want it:
### Claude Doesn't See All Skills ### Claude Doesn't See All Skills
Skill descriptions have a character budget (default 15,000 characters). Run `/context` to check for warnings about excluded skills. Set `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to increase the limit. Skill descriptions are loaded at **2% of the context window** (fallback: **16,000 characters**). Run `/context` to check for warnings about excluded skills. Override the budget with the `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable.
## Security Considerations ## Security Considerations
+256 -18
View File
@@ -18,13 +18,19 @@ Subagents are specialized AI assistants that Claude Code can delegate tasks to.
7. [Using Subagents](#using-subagents) 7. [Using Subagents](#using-subagents)
8. [Resumable Agents](#resumable-agents) 8. [Resumable Agents](#resumable-agents)
9. [Chaining Subagents](#chaining-subagents) 9. [Chaining Subagents](#chaining-subagents)
10. [Architecture](#architecture) 10. [Persistent Memory for Subagents](#persistent-memory-for-subagents)
11. [Context Management](#context-management) 11. [Background Subagents](#background-subagents)
12. [When to Use Subagents](#when-to-use-subagents) 12. [Worktree Isolation](#worktree-isolation)
13. [Best Practices](#best-practices) 13. [Restrict Spawnable Subagents](#restrict-spawnable-subagents)
14. [Example Subagents in This Folder](#example-subagents-in-this-folder) 14. [`claude agents` CLI Command](#claude-agents-cli-command)
15. [Installation Instructions](#installation-instructions) 15. [Agent Teams (Experimental)](#agent-teams-experimental)
16. [Related Concepts](#related-concepts) 16. [Architecture](#architecture)
17. [Context Management](#context-management)
18. [When to Use Subagents](#when-to-use-subagents)
19. [Best Practices](#best-practices)
20. [Example Subagents in This Folder](#example-subagents-in-this-folder)
21. [Installation Instructions](#installation-instructions)
22. [Related Concepts](#related-concepts)
--- ---
@@ -82,9 +88,15 @@ Subagents are defined in YAML frontmatter followed by the system prompt in markd
name: your-sub-agent-name name: your-sub-agent-name
description: Description of when this subagent should be invoked description: Description of when this subagent should be invoked
tools: tool1, tool2, tool3 # Optional - inherits all tools if omitted tools: tool1, tool2, tool3 # Optional - inherits all tools if omitted
model: sonnet # Optional - specify model alias or 'inherit' disallowedTools: tool4 # Optional - explicitly disallowed tools
model: sonnet # Optional - sonnet, opus, haiku, or inherit
permissionMode: default # Optional - permission mode permissionMode: default # Optional - permission mode
skills: skill1, skill2 # Optional - skills to auto-load maxTurns: 20 # Optional - limit agentic turns
skills: skill1, skill2 # Optional - skills to preload into context
mcpServers: server1 # Optional - MCP servers to make available
memory: user # Optional - persistent memory scope (user, project, local)
background: false # Optional - run as background task
isolation: worktree # Optional - git worktree isolation
hooks: # Optional - component-scoped hooks hooks: # Optional - component-scoped hooks
PreToolUse: PreToolUse:
- matcher: "Bash" - matcher: "Bash"
@@ -104,11 +116,17 @@ to solving problems.
|-------|----------|-------------| |-------|----------|-------------|
| `name` | Yes | Unique identifier (lowercase letters and hyphens) | | `name` | Yes | Unique identifier (lowercase letters and hyphens) |
| `description` | Yes | Natural language description of purpose. Include "use PROACTIVELY" to encourage automatic invocation | | `description` | Yes | Natural language description of purpose. Include "use PROACTIVELY" to encourage automatic invocation |
| `tools` | No | Comma-separated list of specific tools. Omit to inherit all tools | | `tools` | No | Comma-separated list of specific tools. Omit to inherit all tools. Supports `Task(agent_name)` syntax to restrict spawnable subagents |
| `disallowedTools` | No | Comma-separated list of tools the subagent must not use |
| `model` | No | Model to use: `sonnet`, `opus`, `haiku`, or `inherit`. Defaults to configured subagent model | | `model` | No | Model to use: `sonnet`, `opus`, `haiku`, or `inherit`. Defaults to configured subagent model |
| `permissionMode` | No | `default`, `acceptEdits`, `bypassPermissions`, `plan`, `ignore` | | `permissionMode` | No | `default`, `acceptEdits`, `bypassPermissions`, `plan`, `ignore` |
| `skills` | No | Comma-separated list of skills to auto-load | | `maxTurns` | No | Maximum number of agentic turns the subagent can take |
| `skills` | No | Comma-separated list of skills to preload. Injects full skill content into the subagent's context at startup |
| `mcpServers` | No | MCP servers to make available to the subagent |
| `hooks` | No | Component-scoped hooks (PreToolUse, PostToolUse, Stop) | | `hooks` | No | Component-scoped hooks (PreToolUse, PostToolUse, Stop) |
| `memory` | No | Persistent memory directory scope: `user`, `project`, or `local` |
| `background` | No | Set to `true` to always run this subagent as a background task |
| `isolation` | No | Set to `worktree` to give the subagent its own git worktree |
### Tool Configuration Options ### Tool Configuration Options
@@ -179,29 +197,38 @@ This allows CLI definitions to override both user and project agents for a singl
## Built-in Subagents ## Built-in Subagents
Claude Code includes three built-in subagents that are always available: Claude Code includes several built-in subagents that are always available:
### 1. General-Purpose Subagent | Agent | Model | Purpose |
|-------|-------|---------|
| **general-purpose** | Inherits | Complex, multi-step tasks |
| **Plan** | Inherits | Research for plan mode |
| **Explore** | Haiku | Read-only codebase exploration (quick/medium/very thorough) |
| **Bash** | Inherits | Terminal commands in separate context |
| **statusline-setup** | Sonnet | Configure status line |
| **Claude Code Guide** | Haiku | Answer Claude Code feature questions |
### General-Purpose Subagent
| Property | Value | | Property | Value |
|----------|-------| |----------|-------|
| **Model** | Sonnet | | **Model** | Inherits from parent |
| **Tools** | All tools | | **Tools** | All tools |
| **Purpose** | Complex research tasks, multi-step operations, code modifications | | **Purpose** | Complex research tasks, multi-step operations, code modifications |
**When used**: Tasks requiring both exploration and modification with complex reasoning. **When used**: Tasks requiring both exploration and modification with complex reasoning.
### 2. Plan Subagent ### Plan Subagent
| Property | Value | | Property | Value |
|----------|-------| |----------|-------|
| **Model** | Sonnet | | **Model** | Inherits from parent |
| **Tools** | Read, Glob, Grep, Bash | | **Tools** | Read, Glob, Grep, Bash |
| **Purpose** | Used automatically in plan mode to research codebase | | **Purpose** | Used automatically in plan mode to research codebase |
**When used**: When Claude needs to understand the codebase before presenting a plan. **When used**: When Claude needs to understand the codebase before presenting a plan.
### 3. Explore Subagent ### Explore Subagent
| Property | Value | | Property | Value |
|----------|-------| |----------|-------|
@@ -217,6 +244,36 @@ Claude Code includes three built-in subagents that are always available:
- **"medium"** - Moderate exploration, balanced speed and thoroughness, default approach - **"medium"** - Moderate exploration, balanced speed and thoroughness, default approach
- **"very thorough"** - Comprehensive analysis across multiple locations and naming conventions, may take longer - **"very thorough"** - Comprehensive analysis across multiple locations and naming conventions, may take longer
### Bash Subagent
| Property | Value |
|----------|-------|
| **Model** | Inherits from parent |
| **Tools** | Bash |
| **Purpose** | Execute terminal commands in a separate context window |
**When used**: When running shell commands that benefit from isolated context.
### Statusline Setup Subagent
| Property | Value |
|----------|-------|
| **Model** | Sonnet |
| **Tools** | Read, Write, Bash |
| **Purpose** | Configure the Claude Code status line display |
**When used**: When setting up or customizing the status line.
### Claude Code Guide Subagent
| Property | Value |
|----------|-------|
| **Model** | Haiku (fast, low-latency) |
| **Tools** | Read-only |
| **Purpose** | Answer questions about Claude Code features and usage |
**When used**: When users ask questions about how Claude Code works or how to use specific features.
--- ---
## Managing Subagents ## Managing Subagents
@@ -319,6 +376,187 @@ This enables complex workflows where the output of one subagent feeds into anoth
--- ---
## Persistent Memory for Subagents
The `memory` field gives subagents a persistent directory that survives across conversations. This allows subagents to build up knowledge over time, storing notes, findings, and context that persist between sessions.
### Memory Scopes
| Scope | Directory | Use Case |
|-------|-----------|----------|
| `user` | `~/.claude/agent-memory/<name>/` | Personal notes and preferences across all projects |
| `project` | `.claude/agent-memory/<name>/` | Project-specific knowledge shared with the team |
| `local` | `.claude/agent-memory-local/<name>/` | Local project knowledge not committed to version control |
### How It Works
- The first 200 lines of `MEMORY.md` in the memory directory are automatically loaded into the subagent's system prompt
- The `Read`, `Write`, and `Edit` tools are automatically enabled for the subagent to manage its memory files
- The subagent can create additional files in its memory directory as needed
### Example Configuration
```yaml
---
name: researcher
memory: user
---
You are a research assistant. Use your memory directory to store findings,
track progress across sessions, and build up knowledge over time.
Check your MEMORY.md file at the start of each session to recall previous context.
```
```mermaid
graph LR
A["Subagent<br/>Session 1"] -->|writes| M["MEMORY.md<br/>(persistent)"]
M -->|loads into| B["Subagent<br/>Session 2"]
B -->|updates| M
M -->|loads into| C["Subagent<br/>Session 3"]
style A fill:#e1f5fe,stroke:#333,color:#333
style B fill:#e1f5fe,stroke:#333,color:#333
style C fill:#e1f5fe,stroke:#333,color:#333
style M fill:#f3e5f5,stroke:#333,color:#333
```
---
## Background Subagents
Subagents can run in the background, freeing up the main conversation for other tasks.
### Configuration
Set `background: true` in the frontmatter to always run the subagent as a background task:
```yaml
---
name: long-runner
background: true
description: Performs long-running analysis tasks in the background
---
```
### Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| `Ctrl+B` | Background a currently running subagent task |
| `Ctrl+F` | Kill all background agents (press twice to confirm) |
### Disabling Background Tasks
Set the environment variable to disable background task support entirely:
```bash
export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1
```
---
## Worktree Isolation
The `isolation: worktree` setting gives a subagent its own git worktree, allowing it to make changes independently without affecting the main working tree.
### Configuration
```yaml
---
name: feature-builder
isolation: worktree
description: Implements features in an isolated git worktree
tools: Read, Write, Edit, Bash, Grep, Glob
---
```
### How It Works
```mermaid
graph TB
Main["Main Working Tree"] -->|spawns| Sub["Subagent with<br/>Isolated Worktree"]
Sub -->|makes changes in| WT["Separate Git<br/>Worktree + Branch"]
WT -->|no changes| Clean["Auto-cleaned"]
WT -->|has changes| Return["Returns worktree<br/>path and branch"]
style Main fill:#e1f5fe,stroke:#333,color:#333
style Sub fill:#f3e5f5,stroke:#333,color:#333
style WT fill:#e8f5e9,stroke:#333,color:#333
style Clean fill:#fff3e0,stroke:#333,color:#333
style Return fill:#fff3e0,stroke:#333,color:#333
```
- The subagent operates in its own git worktree on a separate branch
- If the subagent makes no changes, the worktree is automatically cleaned up
- If changes exist, the worktree path and branch name are returned to the main agent for review or merging
---
## Restrict Spawnable Subagents
You can control which subagents a given subagent is allowed to spawn by using the `Task(agent_type)` syntax in the `tools` field. This provides a way to allowlist specific subagents for delegation.
### Example
```yaml
---
name: coordinator
description: Coordinates work between specialized agents
tools: Task(worker, researcher), Read, Bash
---
You are a coordinator agent. You can delegate work to the "worker" and
"researcher" subagents only. Use Read and Bash for your own exploration.
```
In this example, the `coordinator` subagent can only spawn the `worker` and `researcher` subagents. It cannot spawn any other subagents, even if they are defined elsewhere.
---
## `claude agents` CLI Command
The `claude agents` command lists all configured agents grouped by source (built-in, user-level, project-level):
```bash
claude agents
```
This command:
- Shows all available agents from all sources
- Groups agents by their source location
- Indicates **overrides** when an agent at a higher priority level shadows one at a lower level (e.g., a project-level agent with the same name as a user-level agent)
---
## Agent Teams (Experimental)
Agent teams allow multiple agents to work together on complex tasks, coordinating across separate contexts.
### Enabling Agent Teams
```bash
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
```
### Display Mode
Control how teammate activity is displayed using the `--teammate-mode` flag:
| Mode | Description |
|------|-------------|
| `auto` | Automatically choose the best display mode |
| `in-process` | Show teammate output inline in the current terminal |
| `tmux` | Show each teammate in a separate tmux pane |
```bash
claude --teammate-mode tmux
```
> **Note**: Agent teams is an experimental feature and may change in future releases.
---
## Architecture ## Architecture
### High-Level Architecture ### High-Level Architecture
@@ -710,6 +948,6 @@ graph TD
--- ---
*Last updated: December 2024* *Last updated: February 2026*
*This guide covers complete subagent configuration, delegation patterns, and best practices for Claude Code.* *This guide covers complete subagent configuration, delegation patterns, and best practices for Claude Code.*
+169 -25
View File
@@ -35,6 +35,10 @@ graph TB
B -->|Action| C B -->|Action| C
C -->|Result| B C -->|Result| B
B -->|Response| A B -->|Response| A
style A fill:#e1f5fe,stroke:#333,color:#333
style B fill:#f3e5f5,stroke:#333,color:#333
style C fill:#e8f5e9,stroke:#333,color:#333
``` ```
## MCP Ecosystem ## MCP Ecosystem
@@ -52,6 +56,18 @@ graph TB
D -->|Query| I["PostgreSQL/MySQL"] D -->|Query| I["PostgreSQL/MySQL"]
E -->|Messages| J["Slack Workspace"] E -->|Messages| J["Slack Workspace"]
F -->|Docs| K["Google Drive"] F -->|Docs| K["Google Drive"]
style A fill:#e1f5fe,stroke:#333,color:#333
style B fill:#f3e5f5,stroke:#333,color:#333
style C fill:#f3e5f5,stroke:#333,color:#333
style D fill:#f3e5f5,stroke:#333,color:#333
style E fill:#f3e5f5,stroke:#333,color:#333
style F fill:#f3e5f5,stroke:#333,color:#333
style G fill:#e8f5e9,stroke:#333,color:#333
style H fill:#e8f5e9,stroke:#333,color:#333
style I fill:#e8f5e9,stroke:#333,color:#333
style J fill:#e8f5e9,stroke:#333,color:#333
style K fill:#e8f5e9,stroke:#333,color:#333
``` ```
## MCP Installation Methods ## MCP Installation Methods
@@ -97,6 +113,35 @@ On native Windows (not WSL), use `cmd /c` for npx commands:
claude mcp add --transport stdio my-server -- cmd /c npx -y @some/package claude mcp add --transport stdio my-server -- cmd /c npx -y @some/package
``` ```
### OAuth 2.0 Authentication
Claude Code supports OAuth 2.0 for MCP servers that require it. When connecting to an OAuth-enabled server, Claude Code handles the entire authentication flow:
```bash
# Connect to an OAuth-enabled MCP server (interactive flow)
claude mcp add --transport http my-service https://my-service.example.com/mcp
# Pre-configure OAuth credentials for non-interactive setup
claude mcp add --transport http my-service https://my-service.example.com/mcp \
--client-id "your-client-id" \
--client-secret "your-client-secret" \
--callback-port 8080
```
| Feature | Description |
|---------|-------------|
| **Interactive OAuth** | Use `/mcp` to trigger the browser-based OAuth flow |
| **Pre-configured credentials** | `--client-id`, `--client-secret`, `--callback-port` flags for automated setup |
| **Token storage** | Tokens are stored securely in your system keychain |
| **Step-up auth** | Supports step-up authentication for privileged operations |
| **Discovery caching** | OAuth discovery metadata is cached for faster reconnections |
### Claude.ai MCP Connectors
MCP servers configured in your Claude.ai account are automatically available in Claude Code. This means any MCP connections you set up through the Claude.ai web interface will be accessible without additional configuration.
> **Note:** This feature is only available for users logged in with Claude.ai accounts.
## MCP Setup Process ## MCP Setup Process
```mermaid ```mermaid
@@ -117,6 +162,39 @@ sequenceDiagram
Claude->>User: ✅ MCP connected! Claude->>User: ✅ MCP connected!
``` ```
## MCP Tool Search
When MCP tool descriptions exceed 10% of the context window, Claude Code automatically enables tool search to efficiently select the right tools without overwhelming the model context.
| Setting | Value | Description |
|---------|-------|-------------|
| `ENABLE_TOOL_SEARCH` | `auto` (default) | Automatically enables when tool descriptions exceed 10% of context |
| `ENABLE_TOOL_SEARCH` | `auto:<N>` | Automatically enables at a custom threshold of `N` tools |
| `ENABLE_TOOL_SEARCH` | `true` | Always enabled regardless of tool count |
| `ENABLE_TOOL_SEARCH` | `false` | Disabled; all tool descriptions sent in full |
> **Note:** Tool search requires Sonnet 4 or later, or Opus 4 or later. Haiku models are not supported for tool search.
## Dynamic Tool Updates
Claude Code supports MCP `list_changed` notifications. When an MCP server dynamically adds, removes, or modifies its available tools, Claude Code receives the update and adjusts its tool list automatically -- no reconnection or restart required.
## MCP Resources via @ Mentions
You can reference MCP resources directly in your prompts using the `@` mention syntax:
```
@server-name:protocol://resource/path
```
For example, to reference a specific database resource:
```
@database:postgres://mydb/users
```
This allows Claude to fetch and include MCP resource content inline as part of the conversation context.
## MCP Scopes ## MCP Scopes
MCP configurations can be stored at different scopes with varying levels of sharing: MCP configurations can be stored at different scopes with varying levels of sharing:
@@ -188,7 +266,7 @@ claude mcp add-from-claude-desktop
### Example 1: GitHub MCP Configuration ### Example 1: GitHub MCP Configuration
**File:** `.claude/mcp.json` **File:** `.mcp.json` (project root)
```json ```json
{ {
@@ -247,12 +325,13 @@ Reviewers: @bob, @charlie
**Setup**: **Setup**:
```bash ```bash
export GITHUB_TOKEN="your_github_token" export GITHUB_TOKEN="your_github_token"
cp github-mcp.json ~/.claude/mcp.json # Or use the CLI to add directly:
claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github
``` ```
### Environment Variable Expansion in Configuration ### Environment Variable Expansion in Configuration
MCP configurations support environment variable expansion with fallback defaults: MCP configurations support environment variable expansion with fallback defaults. The `${VAR}` and `${VAR:-default}` syntax works in the following fields: `command`, `args`, `env`, `url`, and `headers`.
```json ```json
{ {
@@ -264,6 +343,13 @@ MCP configurations support environment variable expansion with fallback defaults
"Authorization": "Bearer ${API_KEY}", "Authorization": "Bearer ${API_KEY}",
"X-Custom-Header": "${CUSTOM_HEADER:-default-value}" "X-Custom-Header": "${CUSTOM_HEADER:-default-value}"
} }
},
"local-server": {
"command": "${MCP_BIN_PATH:-npx}",
"args": ["${MCP_PACKAGE:-@company/mcp-server}"],
"env": {
"DB_URL": "${DATABASE_URL:-postgresql://localhost/dev}"
}
} }
} }
} }
@@ -315,7 +401,8 @@ ORDER BY order_count DESC;
**Setup**: **Setup**:
```bash ```bash
export DATABASE_URL="postgresql://user:pass@localhost/mydb" export DATABASE_URL="postgresql://user:pass@localhost/mydb"
cp database-mcp.json ~/.claude/mcp.json # Or use the CLI to add directly:
claude mcp add --transport stdio database -- npx @modelcontextprotocol/server-database
``` ```
### Example 3: Multi-MCP Workflow ### Example 3: Multi-MCP Workflow
@@ -370,7 +457,7 @@ Final Output:
export GITHUB_TOKEN="your_github_token" export GITHUB_TOKEN="your_github_token"
export DATABASE_URL="postgresql://user:pass@localhost/mydb" export DATABASE_URL="postgresql://user:pass@localhost/mydb"
export SLACK_TOKEN="your_slack_token" export SLACK_TOKEN="your_slack_token"
cp multi-mcp.json ~/.claude/mcp.json # Add each MCP server via the CLI or configure them in .mcp.json
``` ```
### Example 4: Filesystem MCP Operations ### Example 4: Filesystem MCP Operations
@@ -401,7 +488,8 @@ cp multi-mcp.json ~/.claude/mcp.json
**Setup**: **Setup**:
```bash ```bash
cp filesystem-mcp.json ~/.claude/mcp.json # Use the CLI to add directly:
claude mcp add --transport stdio filesystem -- npx @modelcontextprotocol/server-filesystem /home/user/projects
``` ```
## MCP vs Memory: Decision Matrix ## MCP vs Memory: Decision Matrix
@@ -417,8 +505,12 @@ graph TD
B -->|Stores| E["Preferences<br/>Context<br/>History"] B -->|Stores| E["Preferences<br/>Context<br/>History"]
D -->|Accesses| F["Live APIs<br/>Databases<br/>Services"] D -->|Accesses| F["Live APIs<br/>Databases<br/>Services"]
style B fill:#e1f5ff style A fill:#fff3e0,stroke:#333,color:#333
style D fill:#fff9c4 style B fill:#e1f5fe,stroke:#333,color:#333
style C fill:#fff3e0,stroke:#333,color:#333
style D fill:#f3e5f5,stroke:#333,color:#333
style E fill:#e8f5e9,stroke:#333,color:#333
style F fill:#e8f5e9,stroke:#333,color:#333
``` ```
## Request/Response Pattern ## Request/Response Pattern
@@ -460,19 +552,26 @@ Then reference them in MCP config:
} }
``` ```
## Claude as MCP Server ## Claude as MCP Server (`claude mcp serve`)
Claude Code itself can act as an MCP server for other applications: Claude Code itself can act as an MCP server for other applications. This enables external tools, editors, and automation systems to leverage Claude's capabilities through the standard MCP protocol.
```bash ```bash
# Start Claude Code as an MCP server on stdio
claude mcp serve claude mcp serve
``` ```
This starts Claude Code in MCP server mode, allowing other MCP clients to connect and use Claude's capabilities as a service. Other applications can then connect to this server as they would any stdio-based MCP server. For example, to add Claude Code as an MCP server in another Claude Code instance:
```bash
claude mcp add --transport stdio claude-agent -- claude mcp serve
```
This is useful for building multi-agent workflows where one Claude instance orchestrates another.
## Managed MCP Configuration (Enterprise) ## Managed MCP Configuration (Enterprise)
For enterprise deployments, MCP servers can be managed centrally via configuration files: For enterprise deployments, IT administrators can enforce MCP server policies through the `managed-mcp.json` configuration file. This file provides exclusive control over which MCP servers are permitted or blocked organization-wide.
**Location:** **Location:**
- macOS: `/Library/Application Support/ClaudeCode/managed-mcp.json` - macOS: `/Library/Application Support/ClaudeCode/managed-mcp.json`
@@ -480,16 +579,17 @@ For enterprise deployments, MCP servers can be managed centrally via configurati
- Windows: `%APPDATA%\ClaudeCode\managed-mcp.json` - Windows: `%APPDATA%\ClaudeCode\managed-mcp.json`
**Features:** **Features:**
- Allowlist/denylist controls - `allowedMcpServers` -- whitelist of permitted servers
- Restrict by server name, command, or URL - `deniedMcpServers` -- blocklist of prohibited servers
- Organization-wide MCP policies - Supports matching by server name, command, and URL patterns
- Organization-wide MCP policies enforced before user configuration
- Prevents unauthorized server connections - Prevents unauthorized server connections
**Example configuration:** **Example configuration:**
```json ```json
{ {
"allowlist": [ "allowedMcpServers": [
{ {
"serverName": "github", "serverName": "github",
"serverUrl": "https://api.github.com/mcp" "serverUrl": "https://api.github.com/mcp"
@@ -499,14 +599,59 @@ For enterprise deployments, MCP servers can be managed centrally via configurati
"serverCommand": "company-mcp-server" "serverCommand": "company-mcp-server"
} }
], ],
"denylist": [ "deniedMcpServers": [
{ {
"serverName": "untrusted-*" "serverName": "untrusted-*"
},
{
"serverUrl": "http://*"
} }
] ]
} }
``` ```
> **Note:** When both `allowedMcpServers` and `deniedMcpServers` match a server, the deny rule takes precedence.
## Plugin-Provided MCP Servers
Plugins can bundle their own MCP servers, making them available automatically when the plugin is installed. Plugin-provided MCP servers can be defined in two ways:
1. **Standalone `.mcp.json`** -- Place a `.mcp.json` file in the plugin root directory
2. **Inline in `plugin.json`** -- Define MCP servers directly within the plugin manifest
Use the `${CLAUDE_PLUGIN_ROOT}` variable to reference paths relative to the plugin's installation directory:
```json
{
"mcpServers": {
"plugin-tools": {
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/dist/mcp-server.js"],
"env": {
"CONFIG_PATH": "${CLAUDE_PLUGIN_ROOT}/config.json"
}
}
}
}
```
## MCP Output Limits
Claude Code enforces limits on MCP tool output to prevent context overflow:
| Limit | Threshold | Behavior |
|-------|-----------|----------|
| **Warning** | 10,000 tokens | A warning is displayed that the output is large |
| **Default max** | 25,000 tokens | Output is truncated beyond this limit |
| **Disk persistence** | 50,000 characters | Tool results exceeding 50K characters are persisted to disk |
The maximum output limit is configurable via the `MAX_MCP_OUTPUT_TOKENS` environment variable:
```bash
# Increase the max output to 50,000 tokens
export MAX_MCP_OUTPUT_TOKENS=50000
```
## Best Practices ## Best Practices
### Security Considerations ### Security Considerations
@@ -537,7 +682,7 @@ For enterprise deployments, MCP servers can be managed centrally via configurati
### Configuration Best Practices ### Configuration Best Practices
1. **Version Control**: Keep `.claude/mcp.json` in git but use environment variables for secrets 1. **Version Control**: Keep `.mcp.json` in git but use environment variables for secrets
2. **Least Privilege**: Grant minimum permissions needed for each MCP server 2. **Least Privilege**: Grant minimum permissions needed for each MCP server
3. **Isolation**: Run different MCP servers in separate processes when possible 3. **Isolation**: Run different MCP servers in separate processes when possible
4. **Monitoring**: Log all MCP requests and errors for audit trails 4. **Monitoring**: Log all MCP requests and errors for audit trails
@@ -560,13 +705,12 @@ For enterprise deployments, MCP servers can be managed centrally via configurati
### Step-by-Step Setup ### Step-by-Step Setup
1. **Create MCP configuration file:** 1. **Add your first MCP server** using the CLI (example: GitHub):
```bash ```bash
mkdir -p ~/.claude claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github
touch ~/.claude/mcp.json
``` ```
2. **Add your first MCP server** (example: GitHub): Or create a `.mcp.json` file in your project root:
```json ```json
{ {
"mcpServers": { "mcpServers": {
@@ -581,17 +725,17 @@ touch ~/.claude/mcp.json
} }
``` ```
3. **Set environment variables:** 2. **Set environment variables:**
```bash ```bash
export GITHUB_TOKEN="your_github_personal_access_token" export GITHUB_TOKEN="your_github_personal_access_token"
``` ```
4. **Test the connection:** 3. **Test the connection:**
```bash ```bash
claude /mcp claude /mcp
``` ```
5. **Use MCP tools:** 4. **Use MCP tools:**
```bash ```bash
/mcp__github__list_prs /mcp__github__list_prs
/mcp__github__create_issue "Title" "Description" /mcp__github__create_issue "Title" "Description"
+122 -15
View File
@@ -14,7 +14,7 @@ Hooks are shell commands or LLM prompts that execute automatically when specific
**Key features:** **Key features:**
- Event-driven automation - Event-driven automation
- JSON-based input/output - JSON-based input/output
- Support for command and prompt-based hooks - Support for command, prompt, and HTTP hook types
- Pattern matching for tool-specific hooks - Pattern matching for tool-specific hooks
## Configuration ## Configuration
@@ -52,7 +52,7 @@ Hooks are configured in settings files with a specific structure:
|-------|-------------|---------| |-------|-------------|---------|
| `matcher` | Pattern to match tool names (case-sensitive) | `"Write"`, `"Edit\|Write"`, `"*"` | | `matcher` | Pattern to match tool names (case-sensitive) | `"Write"`, `"Edit\|Write"`, `"*"` |
| `hooks` | Array of hook definitions | `[{ "type": "command", ... }]` | | `hooks` | Array of hook definitions | `[{ "type": "command", ... }]` |
| `type` | Hook type: `"command"` (bash) or `"prompt"` (LLM) | `"command"` | | `type` | Hook type: `"command"` (bash), `"prompt"` (LLM), or `"http"` (webhook) | `"command"` |
| `command` | Shell command to execute | `"$CLAUDE_PROJECT_DIR/.claude/hooks/format.sh"` | | `command` | Shell command to execute | `"$CLAUDE_PROJECT_DIR/.claude/hooks/format.sh"` |
| `timeout` | Optional timeout in seconds (default 60) | `30` | | `timeout` | Optional timeout in seconds (default 60) | `30` |
@@ -65,22 +65,80 @@ Hooks are configured in settings files with a specific structure:
| Wildcard | Matches all tools | `"*"` or `""` | | Wildcard | Matches all tools | `"*"` or `""` |
| MCP tools | Server and tool pattern | `"mcp__memory__.*"` | | MCP tools | Server and tool pattern | `"mcp__memory__.*"` |
## Hook Types
Claude Code supports three hook types:
### Command Hooks
The default hook type. Executes a shell command and communicates via JSON stdin/stdout and exit codes.
```json
{
"type": "command",
"command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/hooks/validate.py\"",
"timeout": 60
}
```
### HTTP Hooks
Remote webhook endpoints that receive the same JSON input as command hooks. HTTP hooks are routed through the sandbox when sandboxing is enabled. Environment variable interpolation in URLs requires an explicit `allowedEnvVars` list for security.
```json
{
"hooks": {
"PostToolUse": [{
"type": "http",
"url": "https://my-webhook.example.com/hook",
"matcher": "Write"
}]
}
}
```
**Key properties:**
- `"type": "http"` -- identifies this as an HTTP hook
- `"url"` -- the webhook endpoint URL
- Routed through sandbox when sandbox is enabled
- Requires explicit `allowedEnvVars` list for any environment variable interpolation in the URL
### Prompt Hooks
LLM-evaluated prompts where the hook content is a prompt that Claude evaluates. Primarily used with `Stop` and `SubagentStop` events for intelligent task completion checking.
```json
{
"type": "prompt",
"prompt": "Evaluate if Claude completed all requested tasks.",
"timeout": 30
}
```
The LLM evaluates the prompt and returns a structured decision (see [Prompt-Based Hooks](#prompt-based-hooks) for details).
## Hook Events ## Hook Events
Claude Code supports **9 hook events**: Claude Code supports **16 hook events**:
| Event | When Triggered | Supports Matchers | Can Block | Common Use | | Event | When Triggered | Matcher Input | Can Block | Common Use |
|-------|---------------|-------------------|-----------|------------| |-------|---------------|---------------|-----------|------------|
| **PreToolUse** | Before tool execution | Yes (tool names) | Yes | Validate, modify inputs | | **PreToolUse** | Before tool execution | Tool name | Yes | Validate, modify inputs |
| **PermissionRequest** | Permission dialog shown | Yes (tool names) | Yes | Auto-approve/deny | | **PostToolUse** | After tool completion | Tool name | Yes (block) | Add context, feedback |
| **PostToolUse** | After tool completion | Yes (tool names) | Yes (block) | Add context, feedback | | **PermissionRequest** | Permission dialog shown | Tool name | Yes | Auto-approve/deny |
| **Notification** | Notification sent | Yes (notification types) | No | Custom notifications | | **Notification** | Notification sent | Notification type | No | Custom notifications |
| **UserPromptSubmit** | Before prompt processed | No | Yes | Validate prompts | | **UserPromptSubmit** | Before prompt processed | (none) | Yes | Validate prompts |
| **Stop** | Agent finishes responding | No | Yes | Task completion check | | **Stop** | Session or subagent finishes | (none) | Yes | Task completion check |
| **SubagentStop** | Subagent finishes | No | Yes | Subagent validation | | **SubagentStart** | Subagent begins execution | Agent type name | No | Subagent setup |
| **PreCompact** | Before compact operation | Yes (manual/auto) | No | Pre-compact actions | | **SubagentStop** | Subagent completes | Agent type name | Yes | Subagent validation |
| **SessionStart** | Session begins/resumes | Yes (startup/resume/clear/compact) | No | Environment setup | | **PreCompact** | Before compact operation | manual/auto | No | Pre-compact actions |
| **SessionEnd** | Session ends (cleanup only) | No | No | Cleanup, final logging | | **SessionStart** | Session begins/resumes | startup/resume/clear/compact | No | Environment setup |
| **SessionEnd** | Session ends (cleanup only) | (none) | No | Cleanup, final logging |
| **WorktreeCreate** | Worktree created | (none) | No | Worktree initialization |
| **WorktreeRemove** | Worktree removed | (none) | No | Worktree cleanup |
| **ConfigChange** | Configuration files change | (none) | No | React to config updates |
| **TeammateIdle** | Agent team teammate about to idle | (none) | No | Teammate coordination |
| **TaskCompleted** | Task being marked complete | (none) | No | Post-task actions |
### PreToolUse ### PreToolUse
@@ -170,6 +228,8 @@ Runs when user submits a prompt, before Claude processes it.
Run when Claude finishes responding (Stop) or a subagent completes (SubagentStop). Supports prompt-based evaluation for intelligent task completion checking. Run when Claude finishes responding (Stop) or a subagent completes (SubagentStop). Supports prompt-based evaluation for intelligent task completion checking.
**Additional input field:** Both `Stop` and `SubagentStop` hooks receive a `last_assistant_message` field in their JSON input, containing the final message from Claude or the subagent before stopping. This is useful for evaluating task completion.
**Configuration:** **Configuration:**
```json ```json
{ {
@@ -189,6 +249,29 @@ Run when Claude finishes responding (Stop) or a subagent completes (SubagentStop
} }
``` ```
### SubagentStart
Runs when a subagent begins execution. The matcher input is the agent type name, allowing hooks to target specific subagent types.
**Configuration:**
```json
{
"hooks": {
"SubagentStart": [
{
"matcher": "code-review",
"hooks": [
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/subagent-init.sh"
}
]
}
]
}
}
```
### SessionStart ### SessionStart
Runs when session starts or resumes. Can persist environment variables. Runs when session starts or resumes. Can persist environment variables.
@@ -265,6 +348,23 @@ hooks:
This allows defining hooks directly in the component that uses them, keeping related code together. This allows defining hooks directly in the component that uses them, keeping related code together.
### Hooks in Subagent Frontmatter
When a `Stop` hook is defined in a subagent's frontmatter, it is automatically converted to a `SubagentStop` hook scoped to that subagent. This ensures that the stop hook only fires when that specific subagent completes, rather than when the main session stops.
```yaml
---
name: code-review-agent
description: Automated code review subagent
hooks:
Stop:
- hooks:
- type: prompt
prompt: "Verify the code review is thorough and complete."
# The above Stop hook auto-converts to SubagentStop for this subagent
---
```
## PermissionRequest Event ## PermissionRequest Event
Handles permission requests with custom output format: Handles permission requests with custom output format:
@@ -802,6 +902,12 @@ MCP tools follow the pattern `mcp__<server>__<tool>`:
- Potential data loss or system damage - Potential data loss or system damage
- Testing hooks in safe environments before production use - Testing hooks in safe environments before production use
### Security Notes
- **Workspace trust required:** The `statusLine` and `fileSuggestion` hook output commands now require workspace trust acceptance before they take effect.
- **HTTP hooks and environment variables:** HTTP hooks require an explicit `allowedEnvVars` list to use environment variable interpolation in URLs. This prevents accidental leakage of sensitive environment variables to remote endpoints.
- **Managed settings hierarchy:** The `disableAllHooks` setting now respects the managed settings hierarchy, meaning organization-level settings can enforce hook disablement that individual users cannot override.
### Best Practices ### Best Practices
| Do | Don't | | Do | Don't |
@@ -812,6 +918,7 @@ MCP tools follow the pattern `mcp__<server>__<tool>`:
| Use absolute paths with `$CLAUDE_PROJECT_DIR` | Hardcode paths | | Use absolute paths with `$CLAUDE_PROJECT_DIR` | Hardcode paths |
| Skip sensitive files (`.env`, `.git/`, keys) | Process all files | | Skip sensitive files (`.env`, `.git/`, keys) | Process all files |
| Test hooks in isolation first | Deploy untested hooks | | Test hooks in isolation first | Deploy untested hooks |
| Use explicit `allowedEnvVars` for HTTP hooks | Expose all env vars to webhooks |
## Debugging ## Debugging
+3 -1
View File
@@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
# Run tests before commit # Run tests before commit
# Hook: PreCommit # Hook: PreToolUse (matcher: Bash) - checks if the command is a git commit
# Note: There is no "PreCommit" hook event. Use PreToolUse with a Bash matcher
# and inspect the command to detect git commit operations.
echo "🧪 Running tests before commit..." echo "🧪 Running tests before commit..."
+60 -14
View File
@@ -90,22 +90,23 @@ Plugin manifest uses JSON format in `.claude-plugin/plugin.json`:
``` ```
my-plugin/ my-plugin/
├── .claude-plugin/ ├── .claude-plugin/
│ └── plugin.json # NOT plugin.yaml │ └── plugin.json # Manifest (name, description, version, author)
├── commands/ # Outside .claude-plugin ├── commands/ # Skills as Markdown files
│ ├── task-1.md │ ├── task-1.md
│ ├── task-2.md │ ├── task-2.md
│ └── workflows/ │ └── workflows/
├── agents/ ├── agents/ # Custom agent definitions
│ ├── specialist-1.md │ ├── specialist-1.md
│ ├── specialist-2.md │ ├── specialist-2.md
│ └── configs/ │ └── configs/
├── skills/ ├── skills/ # Agent Skills with SKILL.md files
│ ├── skill-1.md │ ├── skill-1.md
│ └── skill-2.md │ └── skill-2.md
├── hooks/ ├── hooks/ # Event handlers in hooks.json
│ └── hooks.json │ └── hooks.json
├── .mcp.json ├── .mcp.json # MCP server configurations
├── .lsp.json # NEW: LSP server config ├── .lsp.json # LSP server configurations
├── settings.json # Default settings
├── templates/ ├── templates/
│ └── issue-template.md │ └── issue-template.md
├── scripts/ ├── scripts/
@@ -134,6 +135,18 @@ Plugins can include Language Server Protocol (LSP) support via `.lsp.json`:
} }
``` ```
## Plugin Settings
Plugins can ship a `settings.json` file to provide default configuration. This currently supports the `agent` key, which sets the main thread agent for the plugin:
```json
{
"agent": "agents/specialist-1.md"
}
```
When a plugin includes `settings.json`, its defaults are applied on installation. Users can override these settings in their own project or user configuration.
## Standalone vs Plugin Approach ## Standalone vs Plugin Approach
| Approach | Command Names | Configuration | Best For | | Approach | Command Names | Configuration | Best For |
@@ -267,12 +280,14 @@ documentation/
## Plugin Marketplace ## Plugin Marketplace
The official Anthropic-managed plugin directory is `anthropics/claude-plugins-official`. Enterprise admins can also create private plugin marketplaces for internal distribution.
```mermaid ```mermaid
graph TB graph TB
A["Plugin Marketplace"] A["Plugin Marketplace"]
B["Official<br/>Anthropic"] B["Official<br/>anthropics/claude-plugins-official"]
C["Community<br/>Marketplace"] C["Community<br/>Marketplace"]
D["Enterprise<br/>Registry"] D["Enterprise<br/>Private Registry"]
A --> B A --> B
A --> C A --> C
@@ -289,8 +304,29 @@ graph TB
D -->|Internal| D1["Company Standards"] D -->|Internal| D1["Company Standards"]
D -->|Internal| D2["Legacy Systems"] D -->|Internal| D2["Legacy Systems"]
D -->|Internal| D3["Compliance"] D -->|Internal| D3["Compliance"]
style A fill:#e1f5fe,stroke:#333,color:#333
style B fill:#e8f5e9,stroke:#333,color:#333
style C fill:#f3e5f5,stroke:#333,color:#333
style D fill:#fff3e0,stroke:#333,color:#333
``` ```
### Marketplace Configuration
Enterprise and advanced users can control marketplace behavior through settings:
| Setting | Description |
|---------|-------------|
| `extraKnownMarketplaces` | Add additional marketplace sources beyond the defaults |
| `blockedMarketplaces` | Admin-managed setting to restrict specific marketplaces |
| `strictKnownMarketplaces` | Control which marketplaces users are allowed to add |
### Additional Marketplace Features
- **Default git timeout**: Increased from 30s to 120s for large plugin repositories
- **Custom npm registries**: Plugins can specify custom npm registry URLs for dependency resolution
- **Version pinning**: Lock plugins to specific versions for reproducible environments
## Plugin Installation & Lifecycle ## Plugin Installation & Lifecycle
```mermaid ```mermaid
@@ -324,14 +360,22 @@ graph LR
## Installation Methods ## Installation Methods
### Official Plugin ### From Marketplace
```bash ```bash
/plugin install plugin-name /plugin install plugin-name
``` ```
### Enable / Disable (with auto-detected scope)
```bash
/plugin enable plugin-name
/plugin disable plugin-name
```
### Local Plugin (for development) ### Local Plugin (for development)
```bash ```bash
/plugin install ./path/to/plugin # CLI flag for local testing (repeatable for multiple plugins)
claude --plugin-dir ./path/to/plugin
claude --plugin-dir ./plugin-a --plugin-dir ./plugin-b
``` ```
### From Git Repository ### From Git Repository
@@ -369,10 +413,11 @@ graph TD
## Testing a Plugin ## Testing a Plugin
Before publishing, test your plugin locally using the CLI flag: Before publishing, test your plugin locally using the `--plugin-dir` CLI flag (repeatable for multiple plugins):
```bash ```bash
claude --plugin-dir ./my-plugin claude --plugin-dir ./my-plugin
claude --plugin-dir ./my-plugin --plugin-dir ./another-plugin
``` ```
This launches Claude Code with your plugin loaded, allowing you to: This launches Claude Code with your plugin loaded, allowing you to:
@@ -380,6 +425,7 @@ This launches Claude Code with your plugin loaded, allowing you to:
- Test subagents and agents function correctly - Test subagents and agents function correctly
- Confirm MCP servers connect properly - Confirm MCP servers connect properly
- Validate hook execution - Validate hook execution
- Check LSP server configurations
- Check for any configuration errors - Check for any configuration errors
## Publishing a Plugin ## Publishing a Plugin
@@ -573,12 +619,12 @@ The following Claude Code features work together with plugins:
### Plugin Won't Install ### Plugin Won't Install
- Check Claude Code version compatibility: `/version` - Check Claude Code version compatibility: `/version`
- Verify `plugin.yaml` syntax with `yaml` validator - Verify `plugin.json` syntax with a JSON validator
- Check internet connection (for remote plugins) - Check internet connection (for remote plugins)
- Review permissions: `ls -la plugin/` - Review permissions: `ls -la plugin/`
### Components Not Loading ### Components Not Loading
- Verify paths in `plugin.yaml` match actual directory structure - Verify paths in `plugin.json` match actual directory structure
- Check file permissions: `chmod +x scripts/` - Check file permissions: `chmod +x scripts/`
- Review component file syntax - Review component file syntax
- Check logs: `/plugin debug plugin-name` - Check logs: `/plugin debug plugin-name`
@@ -0,0 +1,9 @@
{
"name": "devops-automation",
"version": "1.0.0",
"description": "Complete DevOps automation for deployment, monitoring, and incident response",
"author": {
"name": "Community"
},
"license": "MIT"
}
-31
View File
@@ -1,31 +0,0 @@
---
name: devops-automation
version: "1.0.0"
description: Complete DevOps automation for deployment, monitoring, and incident response
author: Community
license: MIT
tags:
- devops
- deployment
- monitoring
- automation
requires:
- claude-code: ">=1.0.0"
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
- type: scripts
path: scripts/
config:
auto_load: true
enabled_by_default: true
---
@@ -0,0 +1,9 @@
{
"name": "documentation",
"version": "1.0.0",
"description": "Comprehensive documentation generation and maintenance",
"author": {
"name": "Community"
},
"license": "MIT"
}
-28
View File
@@ -1,28 +0,0 @@
---
name: documentation
version: "1.0.0"
description: Comprehensive documentation generation and maintenance
author: Community
license: MIT
tags:
- documentation
- api
- guides
requires:
- claude-code: ">=1.0.0"
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: templates
path: templates/
config:
auto_load: true
enabled_by_default: true
---
@@ -0,0 +1,9 @@
{
"name": "pr-review",
"version": "1.0.0",
"description": "Complete PR review workflow with security, testing, and docs",
"author": {
"name": "Anthropic"
},
"license": "MIT"
}
-28
View File
@@ -1,28 +0,0 @@
---
name: pr-review
version: "1.0.0"
description: Complete PR review workflow with security, testing, and docs
author: Anthropic
license: MIT
tags:
- code-review
- quality
- security
requires:
- claude-code: ">=1.0.0"
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
config:
auto_load: true
enabled_by_default: true
---
+13 -38
View File
@@ -42,11 +42,13 @@ Use the `/rewind` command for quick access:
## Rewind Options ## Rewind Options
When you rewind, you can choose what to restore: When you rewind, you are presented with a menu of five options:
- **Conversation only** - Restore chat history and context, keep current code 1. **Restore code and conversation** -- Revert both files and messages to that checkpoint
- **Code only** - Restore file changes, keep current conversation 2. **Restore conversation** -- Rewind messages only, keep your current code as-is
- **Both** - Restore both conversation and code to the checkpoint state 3. **Restore code** -- Revert file changes only, keep the full conversation history
4. **Summarize from here** -- Compress the conversation from this point forward into an AI-generated summary instead of discarding it. The original messages are preserved in the transcript. You can optionally provide instructions to focus the summary on specific topics.
5. **Never mind** -- Cancel and return to the current state
## Automatic Checkpoints ## Automatic Checkpoints
@@ -54,7 +56,7 @@ Claude Code automatically creates checkpoints for you:
- **Every user prompt** - A new checkpoint is created with each user input - **Every user prompt** - A new checkpoint is created with each user input
- **Persistent** - Checkpoints persist across sessions - **Persistent** - Checkpoints persist across sessions
- **Auto-cleaned** - Checkpoints are automatically cleaned up after 30 days (configurable) - **Auto-cleaned** - Checkpoints are automatically cleaned up after 30 days
This means you can always rewind to any previous point in your conversation, from a few minutes ago to days before. This means you can always rewind to any previous point in your conversation, from a few minutes ago to days before.
@@ -154,7 +156,6 @@ Claude Code automatically manages your checkpoints:
- Checkpoints are created automatically with every user prompt - Checkpoints are created automatically with every user prompt
- Old checkpoints are retained for up to 30 days - Old checkpoints are retained for up to 30 days
- You can configure the retention period in your settings
- Checkpoints are cleaned up automatically to prevent unlimited storage growth - Checkpoints are cleaned up automatically to prevent unlimited storage growth
## Workflow Patterns ## Workflow Patterns
@@ -194,7 +195,7 @@ Since checkpoints are created automatically, you can focus on your work without
- Review available checkpoints before rewinding - Review available checkpoints before rewinding
- Use rewind when you want to explore different directions - Use rewind when you want to explore different directions
- Keep checkpoints to compare different approaches - Keep checkpoints to compare different approaches
- Understand what each rewind option does (conversation, code, or both) - Understand what each rewind option does (restore code and conversation, restore conversation, restore code, or summarize)
**Don't:** **Don't:**
- Rely on checkpoints alone for code preservation - Rely on checkpoints alone for code preservation
@@ -203,27 +204,15 @@ Since checkpoints are created automatically, you can focus on your work without
## Configuration ## Configuration
Configure checkpoint behavior in settings. Here's the comprehensive configuration with all available options: You can toggle automatic checkpoints in your settings:
```json ```json
{ {
"checkpoints": { "autoCheckpoint": true
"autoCheckpoint": true,
"autoCheckpointInterval": 30,
"maxCheckpoints": 20,
"compressionEnabled": true,
"includeFileContents": true
}
} }
``` ```
### Configuration Options - `autoCheckpoint`: Enable or disable automatic checkpoint creation on every user prompt (default: `true`)
- `autoCheckpoint`: Enable automatic checkpoints (default: true)
- `autoCheckpointInterval`: Minutes between auto-checkpoints (default: 30)
- `maxCheckpoints`: Maximum number of checkpoints to retain (default: 20)
- `compressionEnabled`: Compress checkpoint data to save space (default: true)
- `includeFileContents`: Include full file contents in checkpoints (default: true)
## Limitations ## Limitations
@@ -235,27 +224,13 @@ Checkpoints have the following limitations:
## Troubleshooting ## Troubleshooting
### Checkpoint Too Large
**Problem**: Checkpoint creation is slow or fails
**Solution**:
```json
{
"checkpoints": {
"includeFileContents": false,
"compressionEnabled": true
}
}
```
### Missing Checkpoints ### Missing Checkpoints
**Problem**: Expected checkpoint not found **Problem**: Expected checkpoint not found
**Solution**: **Solution**:
- Check if checkpoints were cleared - Check if checkpoints were cleared
- Verify checkpoint retention settings - Verify that `autoCheckpoint` is enabled in your settings
- Check disk space - Check disk space
### Rewind Failed ### Rewind Failed
@@ -292,7 +267,7 @@ Use both together:
1. **Work normally** - Claude Code creates checkpoints automatically 1. **Work normally** - Claude Code creates checkpoints automatically
2. **Want to go back?** - Press `Esc` twice or use `/rewind` 2. **Want to go back?** - Press `Esc` twice or use `/rewind`
3. **Choose checkpoint** - Select from the list to rewind 3. **Choose checkpoint** - Select from the list to rewind
4. **Select what to restore** - Choose conversation, code, or both 4. **Select what to restore** - Choose from restore code and conversation, restore conversation, restore code, summarize from here, or cancel
5. **Continue working** - You're back at that point 5. **Continue working** - You're back at that point
### Keyboard Shortcuts ### Keyboard Shortcuts
+88 -101
View File
@@ -2,6 +2,8 @@
Real-world examples of using checkpoints effectively in Claude Code. Real-world examples of using checkpoints effectively in Claude Code.
Note: Checkpoints are created automatically with every user prompt. You do not need to manually save them. To rewind, press `Esc` twice (`Esc+Esc`) or use `/rewind` to open the checkpoint browser.
## Example 1: Database Migration ## Example 1: Database Migration
### Scenario ### Scenario
@@ -10,53 +12,32 @@ You need to migrate from MySQL to PostgreSQL but want to explore both a direct m
### Workflow ### Workflow
``` ```
User: /checkpoint save "Before database migration"
User: Let's implement a direct migration from MySQL to PostgreSQL User: Let's implement a direct migration from MySQL to PostgreSQL
[Checkpoint A created automatically]
Claude: I'll implement the direct migration... Claude: I'll implement the direct migration...
[Changes database driver, updates queries, modifies schema] [Changes database driver, updates queries, modifies schema]
User: /checkpoint save "Direct migration complete"
User: Run the tests User: Run the tests
[Checkpoint B created automatically]
Claude: Running tests... Claude: Running tests...
❌ 15 tests failing - connection pool issues ❌ 15 tests failing - connection pool issues
User: This approach has issues. Let's try the dual-write pattern instead. User: This approach has issues. Let's try the dual-write pattern instead.
[User presses Esc+Esc, selects Checkpoint A, chooses "Restore code and conversation"]
Claude: I'll rewind to the starting point...
/checkpoint rewind "Before database migration"
User: Now implement a dual-write pattern where we write to both databases User: Now implement a dual-write pattern where we write to both databases
Claude: I'll implement dual-write migration... Claude: I'll implement dual-write migration...
[Implements dual-write layer, gradual migration strategy] [Implements dual-write layer, gradual migration strategy]
User: /checkpoint save "Dual-write migration complete"
User: Run the tests User: Run the tests
Claude: Running tests... Claude: Running tests...
✅ All tests passing ✅ All tests passing
User: /checkpoint compare "Direct migration complete" "Dual-write migration complete" User: The dual-write approach is clearly safer. Let's commit this.
Claude: Comparison of the two approaches:
Direct Migration:
- Faster to implement
- All-or-nothing cutover
- Higher risk
- Failed integration tests
Dual-Write Migration:
- More complex implementation
- Gradual, safer migration
- Can rollback easily
- All tests passing
- Recommended approach ✅
``` ```
## Example 2: Performance Optimization ## Example 2: Performance Optimization
@@ -67,47 +48,47 @@ Multiple performance optimization strategies to try.
### Workflow ### Workflow
``` ```
User: /checkpoint save "Baseline performance"
User: Let's optimize the API response time. Current: 450ms User: Let's optimize the API response time. Current: 450ms
[Checkpoint "Baseline" created automatically]
Claude: I'll add database query caching... Claude: I'll add database query caching...
[Implements Redis caching] [Implements Redis caching]
User: /checkpoint save "Redis caching"
User: Run performance tests User: Run performance tests
Claude: Results: 280ms average response time (38% improvement) Claude: Results: 280ms average response time (38% improvement)
User: /checkpoint rewind "Baseline performance" User: Let me try a different approach.
[User presses Esc+Esc, selects "Baseline" checkpoint, chooses "Restore code and conversation"]
User: Try database query optimization instead User: Try database query optimization instead
Claude: I'll optimize database queries... Claude: I'll optimize database queries...
[Adds indexes, optimizes N+1 queries] [Adds indexes, optimizes N+1 queries]
User: /checkpoint save "Query optimization"
User: Run performance tests User: Run performance tests
Claude: Results: 180ms average response time (60% improvement) Claude: Results: 180ms average response time (60% improvement)
User: /checkpoint rewind "Baseline performance" User: Let me also try a third approach.
[User presses Esc+Esc, selects "Baseline" checkpoint, chooses "Restore code and conversation"]
User: Try response compression and CDN User: Try response compression and CDN
Claude: I'll add compression and CDN... Claude: I'll add compression and CDN...
[Implements gzip, sets up CDN] [Implements gzip, sets up CDN]
User: /checkpoint save "Compression + CDN"
User: Run performance tests User: Run performance tests
Claude: Results: 320ms average response time (29% improvement) Claude: Results: 320ms average response time (29% improvement)
User: Let's combine query optimization with caching User: Query optimization was the best. Let me go back and combine it with caching.
[User presses Esc+Esc, selects the checkpoint after query optimization, chooses "Restore code and conversation"]
Claude: I'll rewind to query optimization and add caching... User: Now add Redis caching on top of these optimized queries
/checkpoint rewind "Query optimization"
[Adds Redis caching on top of optimized queries] Claude: [Adds Redis caching on top of optimized queries]
User: /checkpoint save "Combined approach"
User: Run performance tests User: Run performance tests
Claude: Results: 95ms average response time (79% improvement) 🎉 Claude: Results: 95ms average response time (79% improvement) 🎉
@@ -123,39 +104,43 @@ Trying different layouts for a dashboard.
### Workflow ### Workflow
``` ```
User: /checkpoint save "Dashboard - current layout"
User: Let's redesign the dashboard with a sidebar layout User: Let's redesign the dashboard with a sidebar layout
[Checkpoint "Start" created automatically]
Claude: [Implements sidebar layout] Claude: [Implements sidebar layout]
User: /checkpoint save "Sidebar layout"
User: Show me a screenshot User: Show me a screenshot
Claude: [Shows screenshot] Claude: [Shows screenshot]
User: The sidebar feels cramped. Let's try a top navigation instead. User: The sidebar feels cramped. Let's try a top navigation instead.
[User presses Esc+Esc, selects "Start" checkpoint, chooses "Restore code and conversation"]
User: Try a top navigation layout
Claude: [Implements top navigation]
Claude: /checkpoint rewind "Dashboard - current layout"
[Implements top navigation]
User: /checkpoint save "Top navigation layout"
User: Show me a screenshot User: Show me a screenshot
Claude: [Shows screenshot] Claude: [Shows screenshot]
User: Better, but let's try a card-based grid layout User: Better, but let's try a card-based grid layout
[User presses Esc+Esc, selects "Start" checkpoint, chooses "Restore code and conversation"]
User: Try a card-based grid layout
Claude: [Implements card grid]
Claude: /checkpoint rewind "Dashboard - current layout"
[Implements card grid]
User: /checkpoint save "Card grid layout"
User: Show me a screenshot User: Show me a screenshot
Claude: [Shows screenshot] Claude: [Shows screenshot]
User: This is great! But can we combine the top nav with the card grid? User: This is great! But can we combine the top nav with the card grid?
[User presses Esc+Esc, selects the checkpoint after the card grid, chooses "Restore code and conversation"]
Claude: /checkpoint rewind "Card grid layout" User: Add top navigation to the card grid layout
[Adds top navigation to card grid]
User: /checkpoint save "Top nav + card grid" Claude: [Adds top navigation to card grid]
User: Perfect! This is the final design. User: Perfect! This is the final design.
``` ```
@@ -169,34 +154,37 @@ Hunting down a tricky bug with multiple hypotheses.
``` ```
User: There's a memory leak in the application User: There's a memory leak in the application
[Checkpoint "Before debugging" created automatically]
Claude: Let me investigate... Claude: Let me investigate...
[Analyzes code] [Analyzes code]
User: /checkpoint save "Before debugging"
User: I think it's in the event listeners. Let's fix those. User: I think it's in the event listeners. Let's fix those.
Claude: [Fixes event listener cleanup] Claude: [Fixes event listener cleanup]
User: /checkpoint save "Event listener fix"
User: Run memory profiler User: Run memory profiler
Claude: Still leaking memory - event listeners weren't the issue Claude: Still leaking memory - event listeners weren't the issue
User: /checkpoint rewind "Before debugging" User: Let me go back and try a different hypothesis.
[User presses Esc+Esc, selects "Before debugging" checkpoint, chooses "Restore code and conversation"]
User: Maybe it's the database connections? User: Maybe it's the database connections?
Claude: [Implements connection pooling fixes] Claude: [Implements connection pooling fixes]
User: /checkpoint save "Connection pooling fix"
User: Run memory profiler User: Run memory profiler
Claude: Still leaking - not the connections either Claude: Still leaking - not the connections either
User: /checkpoint rewind "Before debugging" User: Let me go back and try another angle.
[User presses Esc+Esc, selects "Before debugging" checkpoint, chooses "Restore code and conversation"]
User: Let's check for circular references User: Let's check for circular references
Claude: [Finds and fixes circular references in cache] Claude: [Finds and fixes circular references in cache]
User: /checkpoint save "Circular reference fix"
User: Run memory profiler User: Run memory profiler
Claude: ✅ Memory leak fixed! The circular references in the caching layer were the culprit. Claude: ✅ Memory leak fixed! The circular references in the caching layer were the culprit.
@@ -212,51 +200,30 @@ Designing a REST API with multiple iterations.
### Workflow ### Workflow
``` ```
User: /checkpoint save "Before API design"
User: Create a REST API for our blog platform User: Create a REST API for our blog platform
[Checkpoint "Before API design" created automatically]
Claude: [Creates basic CRUD API] Claude: [Creates basic CRUD API]
User: /checkpoint save "Basic CRUD API"
User: This is too simple. Let's add pagination and filtering User: This is too simple. Let's add pagination and filtering
Claude: [Adds pagination and filtering] Claude: [Adds pagination and filtering]
User: /checkpoint save "API with pagination"
User: We need better resource relationships User: We need better resource relationships
Claude: [Implements HATEOAS links] Claude: [Implements HATEOAS links]
User: /checkpoint save "API with HATEOAS"
User: Actually, let's try GraphQL instead of REST User: Actually, let's try GraphQL instead of REST
[User presses Esc+Esc, selects "Before API design" checkpoint, chooses "Restore code and conversation"]
Claude: /checkpoint rewind "Before API design" User: Implement a GraphQL API for our blog platform instead
[Implements GraphQL API]
User: /checkpoint save "GraphQL API"
User: /checkpoint compare "API with HATEOAS" "GraphQL API" Claude: [Implements GraphQL API]
Claude: Comparison: User: I think REST is better for our use case.
[User presses Esc+Esc, selects the checkpoint after HATEOAS, chooses "Restore code and conversation"]
REST with HATEOAS: User: Let's finalize the REST approach.
+ Simple, well-understood
+ Easy to cache
+ Works with existing tools
- Multiple round trips
- Over-fetching data
GraphQL:
+ Single endpoint
+ Client specifies data needs
+ No over-fetching
- More complex setup
- Harder to cache
- Steeper learning curve
User: For our use case, REST is better. Let's go with that.
Claude: /checkpoint rewind "API with HATEOAS"
``` ```
## Example 6: Configuration Management ## Example 6: Configuration Management
@@ -267,21 +234,22 @@ Testing different configuration approaches.
### Workflow ### Workflow
``` ```
User: /checkpoint save "Original config"
User: Move configuration to environment variables User: Move configuration to environment variables
[Checkpoint "Original config" created automatically]
Claude: [Implements env var configuration] Claude: [Implements env var configuration]
User: /checkpoint save "Env var config"
User: Test in development User: Test in development
Claude: Works locally but deployment issues in production Claude: Works locally but deployment issues in production
User: /checkpoint rewind "Original config" User: Let me try a different approach.
[User presses Esc+Esc, selects "Original config" checkpoint, chooses "Restore code and conversation"]
User: Try a config file approach with validation User: Try a config file approach with validation
Claude: [Implements YAML config with JSON schema validation] Claude: [Implements YAML config with JSON schema validation]
User: /checkpoint save "Config file with validation"
User: Test in development User: Test in development
Claude: ✅ Works well, good validation errors Claude: ✅ Works well, good validation errors
@@ -289,7 +257,7 @@ Claude: ✅ Works well, good validation errors
User: Can we also support env vars for sensitive values? User: Can we also support env vars for sensitive values?
Claude: [Adds env var override for secrets] Claude: [Adds env var override for secrets]
User: /checkpoint save "Hybrid config approach"
User: Test deployment User: Test deployment
Claude: ✅ All environments working correctly Claude: ✅ All environments working correctly
@@ -305,12 +273,11 @@ Implementing comprehensive testing.
### Workflow ### Workflow
``` ```
User: /checkpoint save "Before adding tests"
User: Add unit tests for the auth module User: Add unit tests for the auth module
[Checkpoint created automatically]
Claude: [Adds Jest unit tests] Claude: [Adds Jest unit tests]
User: /checkpoint save "Unit tests only"
User: Run tests User: Run tests
Claude: 45 tests passing, 78% coverage Claude: 45 tests passing, 78% coverage
@@ -318,7 +285,7 @@ Claude: 45 tests passing, 78% coverage
User: Add integration tests too User: Add integration tests too
Claude: [Adds integration tests] Claude: [Adds integration tests]
User: /checkpoint save "Unit + Integration tests"
User: Run tests User: Run tests
Claude: 89 tests passing, 92% coverage, but tests are slow (3 minutes) Claude: 89 tests passing, 92% coverage, but tests are slow (3 minutes)
@@ -326,7 +293,7 @@ Claude: 89 tests passing, 92% coverage, but tests are slow (3 minutes)
User: The tests are too slow. Let's optimize. User: The tests are too slow. Let's optimize.
Claude: [Optimizes test setup, adds parallel execution] Claude: [Optimizes test setup, adds parallel execution]
User: /checkpoint save "Optimized tests"
User: Run tests User: Run tests
Claude: 89 tests passing, 92% coverage, 35 seconds ✅ Claude: 89 tests passing, 92% coverage, 35 seconds ✅
@@ -334,7 +301,7 @@ Claude: 89 tests passing, 92% coverage, 35 seconds ✅
User: Great! Now add E2E tests for critical paths User: Great! Now add E2E tests for critical paths
Claude: [Adds Playwright E2E tests] Claude: [Adds Playwright E2E tests]
User: /checkpoint save "Full test suite"
User: Run all tests User: Run all tests
Claude: 112 tests passing, 94% coverage, 2 minutes Claude: 112 tests passing, 94% coverage, 2 minutes
@@ -342,11 +309,31 @@ Claude: 112 tests passing, 94% coverage, 2 minutes
User: Perfect balance of coverage and speed! User: Perfect balance of coverage and speed!
``` ```
## Example 8: Using Summarize from Checkpoint
### Scenario
After a long debugging session, you want to condense the conversation while preserving context.
### Workflow
```
User: [After 20+ messages of debugging and exploration]
[User presses Esc+Esc, selects an early checkpoint, chooses "Summarize from here"]
[Optionally provides instructions: "Focus on what we tried and what worked"]
Claude: [Generates a summary of the conversation from that point forward]
[Original messages are preserved in the transcript]
[The summary replaces the visible conversation, reducing context window usage]
User: Now let's continue with the approach that worked.
```
## Key Takeaways ## Key Takeaways
1. **Checkpoint before major changes**: Always create a checkpoint before significant modifications 1. **Checkpoints are automatic**: Every user prompt creates a checkpoint -- no manual saving needed
2. **Name checkpoints descriptively**: Use clear names that explain what was accomplished 2. **Use Esc+Esc or /rewind**: These are the two ways to access the checkpoint browser
3. **Compare approaches**: Use checkpoint diff to evaluate different solutions 3. **Choose the right restore option**: Restore code, conversation, both, or summarize depending on your needs
4. **Don't fear experimentation**: Checkpoints make it safe to try radical changes 4. **Don't fear experimentation**: Checkpoints make it safe to try radical changes
5. **Clean up regularly**: Delete old checkpoints to keep things organized 5. **Combine with git**: Use checkpoints for exploration, git for finalized work
6. **Combine with git**: Use checkpoints for exploration, git for finalized work 6. **Summarize long sessions**: Use "Summarize from here" to keep conversations manageable
+423 -272
View File
@@ -5,7 +5,7 @@
# Advanced Features # Advanced Features
Comprehensive guide to Claude Code's advanced capabilities including planning mode, extended thinking, background tasks, permission modes, headless operation, session management, interactive features, and configuration. Comprehensive guide to Claude Code's advanced capabilities including planning mode, extended thinking, background tasks, permission modes, print mode (non-interactive), session management, interactive features, remote control, web sessions, desktop app, task list, prompt suggestions, git worktrees, sandboxing, managed settings, and configuration.
## Table of Contents ## Table of Contents
@@ -17,9 +17,17 @@ Comprehensive guide to Claude Code's advanced capabilities including planning mo
6. [Headless Mode](#headless-mode) 6. [Headless Mode](#headless-mode)
7. [Session Management](#session-management) 7. [Session Management](#session-management)
8. [Interactive Features](#interactive-features) 8. [Interactive Features](#interactive-features)
9. [Configuration and Settings](#configuration-and-settings) 9. [Remote Control](#remote-control)
10. [Best Practices](#best-practices) 10. [Web Sessions](#web-sessions)
11. [Related Concepts](#related-concepts) 11. [Desktop App](#desktop-app)
12. [Task List](#task-list)
13. [Prompt Suggestions](#prompt-suggestions)
14. [Git Worktrees](#git-worktrees)
15. [Sandboxing](#sandboxing)
16. [Managed Settings (Enterprise)](#managed-settings-enterprise)
17. [Configuration and Settings](#configuration-and-settings)
18. [Best Practices](#best-practices)
19. [Related Concepts](#related-concepts)
--- ---
@@ -31,10 +39,18 @@ Advanced features in Claude Code extend the core capabilities with planning, rea
- **Planning Mode**: Create detailed implementation plans before coding - **Planning Mode**: Create detailed implementation plans before coding
- **Extended Thinking**: Deep reasoning for complex problems - **Extended Thinking**: Deep reasoning for complex problems
- **Background Tasks**: Run long operations without blocking the conversation - **Background Tasks**: Run long operations without blocking the conversation
- **Permission Modes**: Control what Claude can do (unrestricted, confirm, read-only, custom) - **Permission Modes**: Control what Claude can do (`default`, `acceptEdits`, `plan`, `dontAsk`, `bypassPermissions`)
- **Headless Mode**: Run Claude Code without interactive input for automation and CI/CD - **Print Mode**: Run Claude Code non-interactively for automation and CI/CD (`claude -p`)
- **Session Management**: Manage multiple work sessions - **Session Management**: Manage multiple work sessions
- **Interactive Features**: Keyboard shortcuts, multi-line input, and command history - **Interactive Features**: Keyboard shortcuts, multi-line input, and command history
- **Remote Control**: Control Claude Code from Claude.ai or the Claude app
- **Web Sessions**: Run Claude Code in the browser at claude.ai/code
- **Desktop App**: Standalone app for visual diff review and multiple sessions
- **Task List**: Persistent task tracking across context compactions
- **Prompt Suggestions**: Smart command suggestions based on context
- **Git Worktrees**: Isolated worktree branches for parallel work
- **Sandboxing**: OS-level filesystem and network isolation
- **Managed Settings**: Enterprise deployment via plist, Registry, or managed files
- **Configuration**: Customize behavior with JSON configuration files - **Configuration**: Customize behavior with JSON configuration files
--- ---
@@ -154,17 +170,24 @@ Claude: [Implements modified plan]
### Planning Mode Configuration ### Planning Mode Configuration
```json Planning mode is activated via the CLI flag or slash command:
{
"planning": { ```bash
"autoEnter": true, # Activate plan mode via CLI
"complexityThreshold": 3, claude --permission-mode plan
"requireApproval": true,
"showTimeEstimates": true # Or use the /plan slash command inside the REPL
} /plan Implement user authentication system
}
``` ```
**Model alias for planning**: Use `opusplan` as a model alias to use Opus for planning and Sonnet for execution:
```bash
claude --model opusplan "design and implement the new API"
```
**Edit plan externally**: Press `Ctrl+G` to open the current plan in your external editor for detailed modifications.
--- ---
## Extended Thinking ## Extended Thinking
@@ -184,20 +207,27 @@ Extended thinking is a deliberate, step-by-step reasoning process where Claude:
**Keyboard shortcut**: **Keyboard shortcut**:
- `Option + T` (macOS) / `Alt + T` (Windows/Linux) - Toggle extended thinking - `Option + T` (macOS) / `Alt + T` (Windows/Linux) - Toggle extended thinking
**Per-request activation**:
```bash
ultrathink: Should we use microservices or monolith?
```
**Automatic activation**: **Automatic activation**:
- Enabled by default on Sonnet 4.5 and Opus 4.5 - Enabled by default for all models (Opus 4.6, Sonnet 4.6, Haiku 4.5)
- For sufficiently complex queries, Claude automatically uses extended thinking - Opus 4.6: Adaptive reasoning with effort levels (low/medium/high)
- Other models: Fixed budget up to 31,999 tokens
**Configuration methods**:
- Toggle: `Alt+T` / `Option+T`, or via `/config`
- View reasoning: `Ctrl+O` (verbose mode)
**Custom budget**: **Custom budget**:
```bash ```bash
export MAX_THINKING_TOKENS=1024 export MAX_THINKING_TOKENS=1024
``` ```
**Effort level** (Opus 4.6 only):
```bash
export CLAUDE_CODE_EFFORT_LEVEL=high # low, medium, or high
```
> **Note:** Words like "think" or "ultrathink" in prompts are interpreted as regular prompt instructions, not special keywords or triggers.
### Benefits of Extended Thinking ### Benefits of Extended Thinking
- **Deep reasoning**: Spend more time thinking about complex problems - **Deep reasoning**: Spend more time thinking about complex problems
@@ -278,17 +308,18 @@ This approach balances your current constraints (team size, timeline, DevOps res
### Extended Thinking Configuration ### Extended Thinking Configuration
```json Extended thinking is controlled via environment variables and keyboard shortcuts rather than JSON config:
{
"extendedThinking": { ```bash
"enabled": true, # Set thinking token budget
"showThinkingProcess": true, export MAX_THINKING_TOKENS=16000
"minThinkingTime": 5,
"maxThinkingTime": 60 # Set effort level (Opus 4.6 only)
} export CLAUDE_CODE_EFFORT_LEVEL=high
}
``` ```
Toggle during a session with `Alt+T` / `Option+T`, or configure via `/config`.
--- ---
## Background Tasks ## Background Tasks
@@ -422,14 +453,13 @@ Permission modes control what actions Claude can take without explicit approval.
### Available Permission Modes ### Available Permission Modes
| Mode | Description | Use Case | | Mode | Behavior |
|------|-------------|----------| |---|---|
| **default** | Full access, asks for confirmation | Active development | | `default` | Standard: prompts for permission |
| **acceptEdits** | Automatically accepts file edits | Development workflow | | `acceptEdits` | Auto-accepts file edits |
| **dontAsk** | No confirmation needed | Fully automated | | `plan` | Read-only analysis mode |
| **bypassPermissions** | Bypass all permission checks | Trusted automation | | `dontAsk` | Auto-denies unless pre-approved |
| **plan** | Planning mode before implementation | Review before execution | | `bypassPermissions` | Skips all checks (dangerous) |
| **ignore** | Ignore permission restrictions | Advanced usage |
### Activation Methods ### Activation Methods
@@ -495,7 +525,7 @@ Claude: [Makes changes without asking]
**Code Review**: **Code Review**:
``` ```
User: /permission readonly User: claude --permission-mode plan
User: Review this PR and suggest improvements User: Review this PR and suggest improvements
Claude: [Reads code, provides feedback, but cannot modify] Claude: [Reads code, provides feedback, but cannot modify]
@@ -503,7 +533,7 @@ Claude: [Reads code, provides feedback, but cannot modify]
**Pair Programming**: **Pair Programming**:
``` ```
User: /permission confirm User: claude --permission-mode default
User: Let's implement the feature together User: Let's implement the feature together
Claude: [Asks for approval before each change] Claude: [Asks for approval before each change]
@@ -511,51 +541,51 @@ Claude: [Asks for approval before each change]
**Automated Tasks**: **Automated Tasks**:
``` ```
User: /permission unrestricted User: claude --permission-mode acceptEdits
User: Run the full deployment pipeline User: Fix all linting issues in the codebase
Claude: [Executes all steps without asking] Claude: [Auto-accepts file edits without asking]
``` ```
--- ---
## Headless Mode ## Headless Mode
Headless mode allows Claude Code to run without interactive input, perfect for automation and CI/CD. Print mode (`claude -p`) allows Claude Code to run without interactive input, perfect for automation and CI/CD. This is the non-interactive mode, replacing the older `--headless` flag.
### What is Headless Mode? ### What is Print Mode?
Headless mode enables: Print mode enables:
- Automated script execution - Automated script execution
- CI/CD integration - CI/CD integration
- Batch processing - Batch processing
- Scheduled tasks - Scheduled tasks
### Running in Headless Mode ### Running in Print Mode (Non-Interactive)
```bash ```bash
# Run specific task # Run specific task
claude-code --headless --task "Run all tests" claude -p "Run all tests"
# From script file # Process piped content
claude-code --headless --script ./deploy.claude cat error.log | claude -p "Analyze these errors"
# CI/CD integration (GitHub Actions) # CI/CD integration (GitHub Actions)
- name: AI Code Review - name: AI Code Review
run: claude-code --headless --task "Review PR" run: claude -p "Review PR"
``` ```
### Additional Headless Usage Examples ### Additional Print Mode Usage Examples
```bash ```bash
# Run a specific task with output capture # Run a specific task with output capture
claude-code --headless --task "Run all tests and generate coverage report" claude -p "Run all tests and generate coverage report"
# Run from a script file # With structured output
claude-code --headless --script ./tasks/deploy.claude claude -p --output-format json "Analyze code quality"
# With input from stdin # With input from stdin
echo "Analyze code quality" | claude-code --headless echo "Analyze code quality" | claude -p "explain this"
``` ```
### Example: CI/CD Integration ### Example: CI/CD Integration
@@ -571,62 +601,55 @@ jobs:
review: review:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Install Claude Code
run: npm install -g @anthropic-ai/claude-code
- name: Run Claude Code Review - name: Run Claude Code Review
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: | run: |
claude-code --headless --task "Review this PR for: claude -p --output-format json \
- Code quality issues --max-turns 3 \
- Security vulnerabilities "Review this PR for:
- Performance concerns - Code quality issues
- Test coverage - Security vulnerabilities
Output results to review-report.md" - Performance concerns
- Test coverage
Output results as JSON" > review.json
- name: Post Review Comment - name: Post Review Comment
uses: actions/github-script@v6 uses: actions/github-script@v7
with: with:
script: | script: |
const fs = require('fs'); const fs = require('fs');
const report = fs.readFileSync('review-report.md', 'utf8'); const review = JSON.parse(fs.readFileSync('review.json', 'utf8'));
github.rest.issues.createComment({ github.rest.issues.createComment({
issue_number: context.issue.number, issue_number: context.issue.number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
body: report body: JSON.stringify(review, null, 2)
}); });
``` ```
### Task Scripts ### Print Mode Configuration
**deploy.claude**: Print mode (`claude -p`) supports several flags for automation:
```
# Automated deployment script
1. Run full test suite
2. If tests pass, build production bundle
3. Run security scan
4. If scan passes, deploy to staging
5. Run smoke tests on staging
6. If smoke tests pass, deploy to production
7. Send notification to team
```
Run it:
```bash ```bash
claude-code --headless --script deploy.claude # Limit autonomous turns
``` claude -p --max-turns 5 "refactor this module"
### Configuration # Structured JSON output
claude -p --output-format json "analyze this codebase"
```json # With schema validation
{ claude -p --json-schema '{"type":"object","properties":{"issues":{"type":"array"}}}' \
"headless": { "find bugs in this code"
"exitOnError": true,
"verbose": true, # Disable session persistence
"timeout": 3600, claude -p --no-session-persistence "one-off analysis"
"logFile": "./claude-headless.log"
}
}
``` ```
--- ---
@@ -637,52 +660,42 @@ Manage multiple Claude Code sessions effectively.
### Session Management Commands ### Session Management Commands
| Command | Description |
|---------|-------------|
| `/resume` | Resume a conversation by ID or name |
| `/rename` | Name the current session |
| `/fork` | Fork current session into a new branch |
| `claude -c` | Continue most recent conversation |
| `claude -r "session"` | Resume session by name or ID |
### Resuming Sessions
**Continue last conversation**:
```bash ```bash
/session list # Show all sessions claude -c
/session new "Feature" # Create new session
/session switch "Bug" # Switch sessions
/session save # Save current state
/session load "name" # Load saved session
``` ```
### Session Commands Details **Resume a named session**:
```bash
**List sessions**: claude -r "auth-refactor" "finish this PR"
```
User: /session list
Active sessions:
1. [session-abc] Main development (started 2h ago)
2. [session-def] Bug investigation (started 30m ago)
3. [session-ghi] Refactoring (started 5m ago)
``` ```
**Switch sessions**: **Rename the current session** (inside the REPL):
``` ```
User: /session switch session-def /rename auth-refactor
Switched to session "Bug investigation"
``` ```
**Create new session**: ### Forking Sessions
```
User: /session new "Feature: User profiles"
Created new session: session-jkl Fork a session to try an alternative approach without losing the original:
```
/fork
``` ```
**Save session**: Or from the CLI:
``` ```bash
User: /session save "Before major refactor" claude --resume auth-refactor --fork-session "try OAuth instead"
Session saved as checkpoint
```
**Load session**:
```
User: /session load "Before major refactor"
Loaded session from checkpoint
``` ```
### Session Persistence ### Session Persistence
@@ -690,27 +703,14 @@ Loaded session from checkpoint
Sessions are automatically saved and can be resumed: Sessions are automatically saved and can be resumed:
```bash ```bash
# Resume last session # Continue last conversation
claude-code --resume claude -c
# Resume specific session # Resume specific session by name or ID
claude-code --session session-abc claude -r "auth-refactor"
# Start fresh session # Resume and fork for experimentation
claude-code --new claude --resume auth-refactor --fork-session "alternative approach"
```
### Session Configuration
```json
{
"sessions": {
"autoSave": true,
"autoSaveInterval": 300,
"maxSessions": 10,
"persistHistory": true
}
}
``` ```
--- ---
@@ -725,9 +725,11 @@ Claude Code supports keyboard shortcuts for efficiency. Here's the complete refe
|----------|-------------| |----------|-------------|
| `Ctrl+C` | Cancel current input/generation | | `Ctrl+C` | Cancel current input/generation |
| `Ctrl+D` | Exit Claude Code | | `Ctrl+D` | Exit Claude Code |
| `Ctrl+G` | Edit plan in external editor |
| `Ctrl+L` | Clear terminal screen | | `Ctrl+L` | Clear terminal screen |
| `Ctrl+O` | Toggle verbose output | | `Ctrl+O` | Toggle verbose output (view reasoning) |
| `Ctrl+R` | Reverse search history | | `Ctrl+R` | Reverse search history |
| `Ctrl+T` | Toggle task list view |
| `Ctrl+B` | Background running tasks | | `Ctrl+B` | Background running tasks |
| `Esc+Esc` | Rewind code/conversation | | `Esc+Esc` | Rewind code/conversation |
| `Shift+Tab` / `Alt+M` | Toggle permission modes | | `Shift+Tab` / `Alt+M` | Toggle permission modes |
@@ -752,17 +754,16 @@ Claude Code supports keyboard shortcuts for efficiency. Here's the complete refe
Claude Code provides intelligent tab completion: Claude Code provides intelligent tab completion:
``` ```
User: /che<TAB> User: /rew<TAB>
→ /checkpoint → /rewind
User: /checkpoint <TAB> User: /plu<TAB>
→ /checkpoint list → /plugin
→ /checkpoint save
→ /checkpoint rewind
→ /checkpoint delete
User: /checkpoint save<TAB> User: /plugin <TAB>
Shows recent checkpoint names /plugin install
→ /plugin enable
→ /plugin disable
``` ```
### Command History ### Command History
@@ -847,6 +848,218 @@ Use this for quick command execution without switching contexts.
--- ---
## Remote Control
Remote Control allows you to control a locally running Claude Code instance from Claude.ai or the Claude app. This is useful when you want to interact with Claude Code through a web interface while it runs against your local codebase.
### Starting Remote Control
```bash
claude remote-control
```
This starts a Remote Control session that bridges your local Claude Code environment with the Claude.ai web interface. You can then issue commands from the browser that execute against your local file system and tools.
### Use Cases
- Control Claude Code from a mobile device or tablet
- Collaborate with team members through a shared web interface
- Use the richer Claude.ai UI while maintaining local tool execution
---
## Web Sessions
Web Sessions allow you to run Claude Code directly in the browser at claude.ai/code, or create web sessions from the CLI.
### Creating a Web Session
```bash
# Create a new web session from the CLI
claude --remote "implement the new API endpoints"
```
This starts a Claude Code session on claude.ai that you can access from any browser.
### Resuming Web Sessions Locally
If you started a session on the web and want to continue it locally:
```bash
# Resume a web session in the local terminal
claude --teleport
```
Or from within an interactive REPL:
```
/teleport
```
### Use Cases
- Start work on one machine and continue on another
- Share a session URL with team members
- Use the web UI for visual diff review, then switch to terminal for execution
---
## Desktop App
The Claude Code Desktop App provides a standalone application for visual diff review and managing multiple sessions. Available for macOS and Windows.
### Handing Off from CLI
If you are in a CLI session and want to switch to the Desktop App:
```
/desktop
```
This transfers your current session to the Desktop App for a richer visual experience.
### Features
- Visual diff review for file changes
- Multiple simultaneous sessions in tabs
- Rich rendering of code, markdown, and diagrams
- Available for macOS and Windows
---
## Task List
The Task List feature provides persistent task tracking that survives context compactions (when the conversation history is trimmed to fit the context window).
### Toggling the Task List
Press `Ctrl+T` to toggle the task list view on or off during a session.
### Persistent Tasks
Tasks persist across context compactions, ensuring that long-running work items are not lost when the conversation context is trimmed. This is particularly useful for complex, multi-step implementations.
### Named Task Directories
Use the `CLAUDE_CODE_TASK_LIST_ID` environment variable to create named task directories shared across sessions:
```bash
export CLAUDE_CODE_TASK_LIST_ID=my-project-sprint-3
```
This allows multiple sessions to share the same task list, making it useful for team workflows or multi-session projects.
---
## Prompt Suggestions
Prompt Suggestions display grayed-out example commands based on your git history and current conversation context.
### How It Works
- Suggestions appear as grayed-out text below your input prompt
- Press `Tab` to accept the suggestion
- Press `Enter` to accept and immediately submit
- Suggestions are context-aware, drawing from git history and conversation state
### Disabling Prompt Suggestions
```bash
export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false
```
---
## Git Worktrees
Git Worktrees allow you to start Claude Code in an isolated worktree, enabling parallel work on different branches without stashing or switching.
### Starting in a Worktree
```bash
# Start Claude Code in an isolated worktree
claude --worktree
# or
claude -w
```
### Worktree Location
Worktrees are created at:
```
<repo>/.claude/worktrees/<name>
```
### Auto-Cleanup
If no changes are made in the worktree, it is automatically cleaned up when the session ends.
### Use Cases
- Work on a feature branch while keeping main branch untouched
- Run tests in isolation without affecting the working directory
- Try experimental changes in a disposable environment
---
## Sandboxing
Sandboxing provides OS-level filesystem and network isolation for Bash commands executed by Claude Code. This is complementary to permission rules and provides an additional security layer.
### How It Works
- Bash commands run in a sandboxed environment with restricted filesystem access
- Network access can be isolated to prevent unintended external connections
- Works alongside permission rules for defense in depth
### Use Cases
- Running untrusted or generated code safely
- Preventing accidental modifications to files outside the project
- Restricting network access during automated tasks
---
## Managed Settings (Enterprise)
Managed Settings enable enterprise administrators to deploy Claude Code configuration across an organization using platform-native management tools.
### Deployment Methods
| Platform | Method |
|----------|--------|
| macOS | Managed plist files (MDM) |
| Windows | Windows Registry |
| Cross-platform | Managed configuration files |
### Available Managed Settings
| Setting | Description |
|---------|-------------|
| `disableBypassPermissionsMode` | Prevent users from enabling bypass permissions |
| `availableModels` | Restrict which models users can select |
| Custom policies | Organization-specific permission and tool policies |
### Example: macOS Plist
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>disableBypassPermissionsMode</key>
<true/>
<key>availableModels</key>
<array>
<string>claude-sonnet-4-6</string>
<string>claude-haiku-4-5</string>
</array>
</dict>
</plist>
```
---
## Configuration and Settings ## Configuration and Settings
### Configuration File Locations ### Configuration File Locations
@@ -861,24 +1074,21 @@ Use this for quick command execution without switching contexts.
```json ```json
{ {
"planning": {
"autoEnter": true,
"requireApproval": true
},
"extendedThinking": {
"enabled": true,
"showThinkingProcess": true
},
"backgroundTasks": {
"enabled": true,
"maxConcurrentTasks": 5
},
"permissions": { "permissions": {
"mode": "unrestricted" "mode": "default"
}, },
"headless": { "hooks": {
"exitOnError": true, "PreToolUse:Edit": "eslint --fix ${file_path}",
"verbose": true "PostToolUse:Write": "~/.claude/hooks/security-scan.sh"
},
"mcp": {
"enabled": true,
"servers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"]
}
}
} }
} }
``` ```
@@ -887,60 +1097,16 @@ Use this for quick command execution without switching contexts.
```json ```json
{ {
"general": {
"model": "claude-sonnet-4-5",
"temperature": 0.7,
"maxTokens": 8000,
"theme": "dark"
},
"planning": {
"autoEnter": true,
"complexityThreshold": 3,
"requireApproval": true,
"showTimeEstimates": true
},
"extendedThinking": {
"enabled": true,
"showThinkingProcess": true,
"minThinkingTime": 5,
"maxThinkingTime": 60
},
"backgroundTasks": {
"enabled": true,
"maxConcurrentTasks": 5,
"notifyOnCompletion": true,
"autoCleanup": true,
"logOutput": true
},
"permissions": { "permissions": {
"mode": "unrestricted", "mode": "default",
"requireConfirmationFor": ["Bash:rm", "Git:push --force"], "allowedTools": ["Bash(git log:*)", "Read"],
"blockedCommands": ["dd", "mkfs", "format"] "disallowedTools": ["Bash(rm -rf:*)"]
},
"sessions": {
"autoSave": true,
"autoSaveInterval": 300,
"maxSessions": 10,
"persistHistory": true
},
"checkpoints": {
"autoCheckpoint": true,
"autoCheckpointInterval": 30,
"maxCheckpoints": 20,
"compressionEnabled": true
}, },
"hooks": { "hooks": {
"PreToolUse:Edit": "eslint --fix ${file_path}", "PreToolUse": [{ "matcher": "Edit", "hooks": ["eslint --fix ${file_path}"] }],
"PostToolUse:Write": "~/.claude/hooks/security-scan.sh", "PostToolUse": [{ "matcher": "Write", "hooks": ["~/.claude/hooks/security-scan.sh"] }],
"PreCommit": "npm test", "Stop": [{ "hooks": ["~/.claude/hooks/notify.sh"] }]
"UserPromptSubmit": "~/.claude/hooks/validate.sh"
}, },
"mcp": { "mcp": {
@@ -954,28 +1120,6 @@ Use this for quick command execution without switching contexts.
} }
} }
} }
},
"ui": {
"colorEnabled": true,
"emojiEnabled": true,
"showProgress": true,
"compactMode": false,
"lineNumbers": true
},
"performance": {
"cacheEnabled": true,
"cacheTTL": 3600,
"parallelTasks": true,
"maxParallelTasks": 3
},
"logging": {
"level": "info",
"file": "~/.claude/logs/claude-code.log",
"maxSize": "10MB",
"maxFiles": 5
} }
} }
``` ```
@@ -986,41 +1130,48 @@ Override config with environment variables:
```bash ```bash
# Model selection # Model selection
export CLAUDE_MODEL=claude-opus-4 export ANTHROPIC_MODEL=claude-opus-4-6
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-6
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5
# API configuration # API configuration
export ANTHROPIC_API_KEY=sk-ant-... export ANTHROPIC_API_KEY=sk-ant-...
# Thinking configuration
export MAX_THINKING_TOKENS=16000
export CLAUDE_CODE_EFFORT_LEVEL=high
# Feature toggles # Feature toggles
export CLAUDE_PLANNING_MODE=true export CLAUDE_CODE_DISABLE_AUTO_MEMORY=true
export CLAUDE_EXTENDED_THINKING=true export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=true
export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false
export CLAUDE_CODE_ENABLE_TASKS=true
# Permissions # MCP configuration
export CLAUDE_PERMISSION_MODE=confirm export MAX_MCP_OUTPUT_TOKENS=50000
export ENABLE_TOOL_SEARCH=true
# Logging # Task management
export CLAUDE_LOG_LEVEL=debug export CLAUDE_CODE_TASK_LIST_ID=my-project-tasks
# Agent teams (experimental)
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=true
``` ```
### Configuration Management Commands ### Configuration Management Commands
``` ```
User: /config show User: /config
[Shows current configuration] [Opens interactive configuration menu]
User: /config set planning.autoEnter false
[Updates configuration]
User: /config reset
[Resets to defaults]
User: /config export ~/my-claude-config.json
[Exports configuration]
User: /config import ~/my-claude-config.json
[Imports configuration]
``` ```
The `/config` command provides an interactive menu to toggle settings such as:
- Extended thinking on/off
- Verbose output
- Permission mode
- Model selection
### Per-Project Configuration ### Per-Project Configuration
Create `.claude/config.json` in your project: Create `.claude/config.json` in your project:
@@ -1028,10 +1179,10 @@ Create `.claude/config.json` in your project:
```json ```json
{ {
"hooks": { "hooks": {
"PreCommit": "npm test && npm run lint" "PreToolUse": [{ "matcher": "Bash", "hooks": ["npm test && npm run lint"] }]
}, },
"permissions": { "permissions": {
"mode": "confirm" "mode": "default"
}, },
"mcp": { "mcp": {
"servers": { "servers": {
@@ -1069,10 +1220,10 @@ Create `.claude/config.json` in your project:
- ❌ Don't start too many concurrent tasks - ❌ Don't start too many concurrent tasks
### Permissions ### Permissions
- ✅ Use read-only for code review - ✅ Use `plan` for code review (read-only)
- ✅ Use confirm for learning - ✅ Use `default` for interactive development
- ✅ Use unrestricted for automation - ✅ Use `acceptEdits` for automation workflows
- ❌ Don't stay in restrictive modes unnecessarily - ❌ Don't use `bypassPermissions` unless absolutely necessary
### Sessions ### Sessions
- ✅ Use separate sessions for different tasks - ✅ Use separate sessions for different tasks
+4 -9
View File
@@ -72,8 +72,7 @@
"showTimeEstimates": true "showTimeEstimates": true
}, },
"checkpoints": { "checkpoints": {
"autoCheckpoint": true, "autoCheckpoint": true
"autoCheckpointInterval": 15
} }
} }
}, },
@@ -96,8 +95,7 @@
"PostPush": "~/.claude/hooks/notify-team.sh" "PostPush": "~/.claude/hooks/notify-team.sh"
}, },
"checkpoints": { "checkpoints": {
"autoCheckpoint": true, "autoCheckpoint": true
"autoCheckpointInterval": 10
}, },
"planning": { "planning": {
"autoEnter": true, "autoEnter": true,
@@ -172,8 +170,7 @@
"maxConcurrentTasks": 5 "maxConcurrentTasks": 5
}, },
"checkpoints": { "checkpoints": {
"autoCheckpoint": true, "autoCheckpoint": true
"autoCheckpointInterval": 20
} }
} }
}, },
@@ -219,9 +216,7 @@
"showTimeEstimates": true "showTimeEstimates": true
}, },
"checkpoints": { "checkpoints": {
"autoCheckpoint": true, "autoCheckpoint": true
"autoCheckpointInterval": 10,
"maxCheckpoints": 30
}, },
"hooks": { "hooks": {
"PreToolUse:Edit": "~/.claude/hooks/backup-file.sh ${file_path}", "PreToolUse:Edit": "~/.claude/hooks/backup-file.sh ${file_path}",
+79 -3
View File
@@ -37,6 +37,12 @@ graph TD
| `claude -r "<session>" "query"` | Resume session by ID or name | `claude -r "auth-refactor" "finish this PR"` | | `claude -r "<session>" "query"` | Resume session by ID or name | `claude -r "auth-refactor" "finish this PR"` |
| `claude update` | Update to latest version | `claude update` | | `claude update` | Update to latest version | `claude update` |
| `claude mcp` | Configure MCP servers | See [MCP documentation](../05-mcp/) | | `claude mcp` | Configure MCP servers | See [MCP documentation](../05-mcp/) |
| `claude mcp serve` | Run Claude Code as an MCP server | `claude mcp serve` |
| `claude agents` | List all configured subagents | `claude agents` |
| `claude remote-control` | Start Remote Control session | `claude remote-control` |
| `claude auth login` | Log in (supports `--email`, `--sso`) | `claude auth login --email user@example.com` |
| `claude auth logout` | Log out of current account | `claude auth logout` |
| `claude auth status` | Check auth status (exit 0 if logged in, 1 if not) | `claude auth status` |
## Core Flags ## Core Flags
@@ -46,6 +52,15 @@ graph TD
| `-c, --continue` | Load most recent conversation | `claude --continue` | | `-c, --continue` | Load most recent conversation | `claude --continue` |
| `-r, --resume` | Resume specific session by ID or name | `claude --resume auth-refactor` | | `-r, --resume` | Resume specific session by ID or name | `claude --resume auth-refactor` |
| `-v, --version` | Output version number | `claude -v` | | `-v, --version` | Output version number | `claude -v` |
| `-w, --worktree` | Start in isolated git worktree | `claude -w` |
| `--from-pr <number>` | Resume sessions linked to GitHub PR | `claude --from-pr 42` |
| `--remote "task"` | Create web session on claude.ai | `claude --remote "implement API"` |
| `--teleport` | Resume web session locally | `claude --teleport` |
| `--teammate-mode` | Agent team display mode | `claude --teammate-mode tmux` |
| `--init` / `--init-only` | Run initialization hooks | `claude --init` |
| `--maintenance` | Run maintenance hooks and exit | `claude --maintenance` |
| `--disable-slash-commands` | Disable all skills and slash commands | `claude --disable-slash-commands` |
| `--no-session-persistence` | Disable session saving (print mode) | `claude -p --no-session-persistence "query"` |
### Interactive vs Print Mode ### Interactive vs Print Mode
@@ -90,17 +105,20 @@ claude -p "list todos" | grep "URGENT"
### Model Selection Examples ### Model Selection Examples
```bash ```bash
# Use Opus for complex tasks # Use Opus 4.6 for complex tasks
claude --model opus "design a caching strategy" claude --model opus "design a caching strategy"
# Use Haiku for quick tasks # Use Haiku 4.5 for quick tasks
claude --model haiku -p "format this JSON" claude --model haiku -p "format this JSON"
# Full model name # Full model name
claude --model claude-sonnet-4-5-20250929 "review this code" claude --model claude-sonnet-4-6-20250929 "review this code"
# With fallback for reliability # With fallback for reliability
claude -p --model opus --fallback-model sonnet "analyze architecture" claude -p --model opus --fallback-model sonnet "analyze architecture"
# Use opusplan (Opus plans, Sonnet executes)
claude --model opusplan "design and implement the caching layer"
``` ```
## System Prompt Customization ## System Prompt Customization
@@ -611,6 +629,64 @@ claude -p --output-format json "list improvements" | jq 'map({title: .title, pri
--- ---
## Models
Claude Code supports multiple models with different capabilities:
| Model | ID | Context Window | Notes |
|-------|-----|----------------|-------|
| Opus 4.6 | `claude-opus-4-6` | 1M tokens | Most capable, adaptive effort levels |
| Sonnet 4.6 | `claude-sonnet-4-6` | 1M tokens | Balanced speed and capability |
| Haiku 4.5 | `claude-haiku-4-5` | 1M tokens | Fastest, best for quick tasks |
### Model Selection
```bash
# Use short names
claude --model opus "complex architectural review"
claude --model sonnet "implement this feature"
claude --model haiku -p "format this JSON"
# Use opusplan alias (Opus plans, Sonnet executes)
claude --model opusplan "design and implement the API"
# Toggle fast mode during session
/fast
```
### Effort Levels (Opus 4.6)
Opus 4.6 supports adaptive reasoning with effort levels:
```bash
# Set effort level via environment variable
export CLAUDE_CODE_EFFORT_LEVEL=high # low, medium, or high
```
---
## Key Environment Variables
| Variable | Description |
|----------|-------------|
| `ANTHROPIC_API_KEY` | API key for authentication |
| `ANTHROPIC_MODEL` | Override default model |
| `ANTHROPIC_DEFAULT_OPUS_MODEL` | Override default Opus model ID |
| `ANTHROPIC_DEFAULT_SONNET_MODEL` | Override default Sonnet model ID |
| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Override default Haiku model ID |
| `MAX_THINKING_TOKENS` | Set extended thinking token budget |
| `CLAUDE_CODE_EFFORT_LEVEL` | Set effort level for Opus 4.6 (`low`/`medium`/`high`) |
| `CLAUDE_CODE_DISABLE_AUTO_MEMORY` | Disable automatic CLAUDE.md updates |
| `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` | Disable background task execution |
| `CLAUDE_CODE_ENABLE_TASKS` | Enable task list feature |
| `CLAUDE_CODE_TASK_LIST_ID` | Named task directory shared across sessions |
| `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION` | Toggle prompt suggestions (`true`/`false`) |
| `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` | Enable experimental agent teams |
| `ENABLE_TOOL_SEARCH` | Enable tool search capability |
| `MAX_MCP_OUTPUT_TOKENS` | Maximum tokens for MCP tool output |
---
## Quick Reference ## Quick Reference
### Most Common Commands ### Most Common Commands
+67 -27
View File
@@ -7,7 +7,7 @@
> Quick reference guide to all Claude Code features: commands, agents, skills, plugins, and hooks. > Quick reference guide to all Claude Code features: commands, agents, skills, plugins, and hooks.
**Navigation**: [Commands](#slash-commands) | [Sub-Agents](#sub-agents) | [Skills](#skills) | [Plugins](#plugins) | [MCP Servers](#mcp-servers) | [Hooks](#hooks) | [Memory](#memory-files) **Navigation**: [Commands](#slash-commands) | [Sub-Agents](#sub-agents) | [Skills](#skills) | [Plugins](#plugins) | [MCP Servers](#mcp-servers) | [Hooks](#hooks) | [Memory](#memory-files) | [New Features](#new-features-february-2026)
--- ---
@@ -15,14 +15,14 @@
| Feature | Built-in | Examples | Total | Reference | | Feature | Built-in | Examples | Total | Reference |
|---------|----------|----------|-------|-----------| |---------|----------|----------|-------|-----------|
| **Slash Commands** | 30 | 8 | 38 | [01-slash-commands/](01-slash-commands/) | | **Slash Commands** | 40 | 8 | 48 | [01-slash-commands/](01-slash-commands/) |
| **Sub-Agents** | 8 | 7 | 15 | [04-subagents/](04-subagents/) | | **Sub-Agents** | 6 | 10 | 16 | [04-subagents/](04-subagents/) |
| **Skills** | - | 4 | 4 | [03-skills/](03-skills/) | | **Skills** | - | 4 | 4 | [03-skills/](03-skills/) |
| **Plugins** | - | 3 | 3 | [07-plugins/](07-plugins/) | | **Plugins** | - | 3 | 3 | [07-plugins/](07-plugins/) |
| **MCP Servers** | 1 | 8 | 9 | [05-mcp/](05-mcp/) | | **MCP Servers** | 1 | 8 | 9 | [05-mcp/](05-mcp/) |
| **Hooks** | 9 events | 7 | 7 | [06-hooks/](06-hooks/) | | **Hooks** | 16 events | 7 | 7 | [06-hooks/](06-hooks/) |
| **Memory** | 3 types | 3 | 3 | [02-memory/](02-memory/) | | **Memory** | 7 types | 3 | 3 | [02-memory/](02-memory/) |
| **Total** | **51** | **40** | **79** | | | **Total** | **70** | **43** | **90** | |
--- ---
@@ -62,7 +62,18 @@ Commands are user-invoked shortcuts that execute specific actions.
| `/rename` | Rename current session | Organize sessions | | `/rename` | Rename current session | Organize sessions |
| `/resume` | Resume previous session | Continue work | | `/resume` | Resume previous session | Continue work |
| `/todo` | View/manage todo list | Track tasks | | `/todo` | View/manage todo list | Track tasks |
| `/todos` | View all project TODOs | Track outstanding items |
| `/tasks` | View background tasks | Monitor async operations | | `/tasks` | View background tasks | Monitor async operations |
| `/copy` | Copy last response to clipboard | Share output quickly |
| `/teleport` | Transfer session to another machine | Continue work remotely |
| `/desktop` | Open Claude Desktop app | Switch to desktop interface |
| `/theme` | Change color theme | Customize appearance |
| `/usage` | Show API usage statistics | Monitor quota and costs |
| `/fork` | Fork current conversation | Explore alternatives |
| `/stats` | Show session statistics | Review session metrics |
| `/statusline` | Configure status line | Customize status display |
| `/fast` | Toggle fast output mode | Speed up responses |
| `/terminal-setup` | Configure terminal integration | Setup terminal features |
### Custom Commands (Examples) ### Custom Commands (Examples)
@@ -96,20 +107,21 @@ Specialized AI assistants with isolated contexts for specific tasks.
| Agent | Description | Tools | Model | When to Use | | Agent | Description | Tools | Model | When to Use |
|-------|-------------|-------|-------|-------------| |-------|-------------|-------|-------|-------------|
| **general-purpose** | Multi-step tasks, research | All tools | Sonnet | Complex research, multi-file tasks | | **general-purpose** | Multi-step tasks, research | All tools | Inherits model | Complex research, multi-file tasks |
| **Explore** | Codebase exploration | Read, Glob, Grep | Haiku | Quick searches, understanding code | | **Plan** | Implementation planning | Read, Glob, Grep, Bash | Inherits model | Architecture design, planning |
| **Plan** | Implementation planning | Read, Glob, Grep, Bash | Sonnet | Architecture design, planning | | **Explore** | Codebase exploration | Read, Glob, Grep | Haiku 4.5 | Quick searches, understanding code |
| **Bash** | Command execution | Bash | Sonnet | Git operations, terminal tasks | | **Bash** | Command execution | Bash | Inherits model | Git operations, terminal tasks |
| **code-reviewer** | Code quality analysis | Read, Glob, Grep | Sonnet | PR reviews, quality checks | | **statusline-setup** | Status line configuration | Bash, Read, Write | Sonnet 4.6 | Configure status line display |
| **code-architect** | Feature architecture design | Read, Glob, Grep, LS | Sonnet | New feature planning | | **Claude Code Guide** | Help and documentation | Read, Glob, Grep | Haiku 4.5 | Getting help, learning features |
| **code-explorer** | Deep codebase analysis | Read, Glob, Grep, LS | Sonnet | Understanding existing features |
| **clean-code-reviewer** | Clean Code principles | Read, Grep, Glob, Bash | Sonnet | Maintainability review |
### Custom Sub-Agents (Examples) ### Custom Sub-Agents (Examples)
| Agent | Description | When to Use | Scope | Installation | | Agent | Description | When to Use | Scope | Installation |
|-------|-------------|-------------|-------|--------------| |-------|-------------|-------------|-------|--------------|
| `code-reviewer` | Comprehensive code quality | Code review sessions | Project | `cp 04-subagents/code-reviewer.md .claude/agents/` | | `code-reviewer` | Comprehensive code quality | Code review sessions | Project | `cp 04-subagents/code-reviewer.md .claude/agents/` |
| `code-architect` | Feature architecture design | New feature planning | Project | `cp 04-subagents/code-architect.md .claude/agents/` |
| `code-explorer` | Deep codebase analysis | Understanding existing features | Project | `cp 04-subagents/code-explorer.md .claude/agents/` |
| `clean-code-reviewer` | Clean Code principles review | Maintainability review | Project | `cp 04-subagents/clean-code-reviewer.md .claude/agents/` |
| `test-engineer` | Test strategy & coverage | Test planning | Project | `cp 04-subagents/test-engineer.md .claude/agents/` | | `test-engineer` | Test strategy & coverage | Test planning | Project | `cp 04-subagents/test-engineer.md .claude/agents/` |
| `documentation-writer` | Technical documentation | API docs, guides | Project | `cp 04-subagents/documentation-writer.md .claude/agents/` | | `documentation-writer` | Technical documentation | API docs, guides | Project | `cp 04-subagents/documentation-writer.md .claude/agents/` |
| `secure-reviewer` | Security-focused review | Security audits | Project | `cp 04-subagents/secure-reviewer.md .claude/agents/` | | `secure-reviewer` | Security-focused review | Security audits | Project | `cp 04-subagents/secure-reviewer.md .claude/agents/` |
@@ -208,9 +220,9 @@ Model Context Protocol servers for external tool and API access.
| Server | Description | When to Use | Scope | Installation | | Server | Description | When to Use | Scope | Installation |
|--------|-------------|-------------|-------|--------------| |--------|-------------|-------------|-------|--------------|
| **GitHub** | PR management, issues, code | GitHub workflows | Project | `cp 05-mcp/github-mcp.json .claude/mcp.json` | | **GitHub** | PR management, issues, code | GitHub workflows | Project | `claude mcp add github -- npx -y @modelcontextprotocol/server-github` |
| **Database** | SQL queries, data access | Database operations | Project | `cp 05-mcp/database-mcp.json .claude/mcp.json` | | **Database** | SQL queries, data access | Database operations | Project | `claude mcp add db -- npx -y @modelcontextprotocol/server-postgres` |
| **Filesystem** | Advanced file operations | Complex file tasks | User | `cp 05-mcp/filesystem-mcp.json .claude/mcp.json` | | **Filesystem** | Advanced file operations | Complex file tasks | User | `claude mcp add fs -- npx -y @modelcontextprotocol/server-filesystem` |
| **Slack** | Team communication | Notifications, updates | Project | Configure in settings | | **Slack** | Team communication | Notifications, updates | Project | Configure in settings |
| **Google Docs** | Document access | Doc editing, review | Project | Configure in settings | | **Google Docs** | Document access | Doc editing, review | Project | Configure in settings |
| **Asana** | Project management | Task tracking | Project | Configure in settings | | **Asana** | Project management | Task tracking | Project | Configure in settings |
@@ -218,7 +230,7 @@ Model Context Protocol servers for external tool and API access.
| **Memory** | Persistent memory | Cross-session recall | User | Configure in settings | | **Memory** | Persistent memory | Cross-session recall | User | Configure in settings |
| **Context7** | Library documentation | Up-to-date docs lookup | Built-in | Built-in | | **Context7** | Library documentation | Up-to-date docs lookup | Built-in | Built-in |
> **Scope**: `Project` = team (`.claude/mcp.json`), `User` = personal (`~/.claude/mcp.json`), `Built-in` = pre-installed > **Scope**: `Project` = team (`.mcp.json`), `User` = personal (`~/.claude.json`), `Built-in` = pre-installed
### MCP Configuration Example ### MCP Configuration Example
@@ -240,7 +252,7 @@ Model Context Protocol servers for external tool and API access.
**Quick Install (GitHub MCP)**: **Quick Install (GitHub MCP)**:
```bash ```bash
export GITHUB_TOKEN="your_token" && cp 05-mcp/github-mcp.json .claude/mcp.json export GITHUB_TOKEN="your_token" && claude mcp add github -- npx -y @modelcontextprotocol/server-github
``` ```
--- ---
@@ -256,12 +268,19 @@ Event-driven automation that executes shell commands on Claude Code events.
| `PreToolUse` | Before tool execution | Before any tool runs | Validation, logging | | `PreToolUse` | Before tool execution | Before any tool runs | Validation, logging |
| `PostToolUse` | After tool completion | After any tool completes | Formatting, notifications | | `PostToolUse` | After tool completion | After any tool completes | Formatting, notifications |
| `PermissionRequest` | Permission dialog shown | Before sensitive actions | Custom approval flows | | `PermissionRequest` | Permission dialog shown | Before sensitive actions | Custom approval flows |
| `UserPromptSubmit` | Before prompt processing | User sends message | Input validation |
| `Notification` | Notification sent | Claude sends notification | External alerts | | `Notification` | Notification sent | Claude sends notification | External alerts |
| `UserPromptSubmit` | Before prompt processing | User sends message | Input validation |
| `Stop` | Agent finishes responding | Response complete | Cleanup, reporting | | `Stop` | Agent finishes responding | Response complete | Cleanup, reporting |
| `SubagentStart` | Subagent begins | Subagent task starts | Initialize subagent context |
| `SubagentStop` | Subagent finishes | Subagent task complete | Chain actions | | `SubagentStop` | Subagent finishes | Subagent task complete | Chain actions |
| `PreCompact` | Before compact operation | Context compression | State preservation | | `PreCompact` | Before compact operation | Context compression | State preservation |
| `SessionStart` | Session begins/resumes | Session initialization | Setup tasks | | `SessionStart` | Session begins | Session initialization | Setup tasks |
| `SessionEnd` | Session ends | Session termination | Cleanup, save state |
| `WorktreeCreate` | Worktree created | Git worktree created | Setup worktree environment |
| `WorktreeRemove` | Worktree removed | Git worktree removed | Cleanup worktree resources |
| `ConfigChange` | Configuration updated | Settings modified | React to config changes |
| `TeammateIdle` | Teammate agent idle | Agent team coordination | Distribute work |
| `TaskCompleted` | Task finished | Background task done | Post-task processing |
### Example Hooks ### Example Hooks
@@ -315,11 +334,15 @@ Persistent context loaded automatically across sessions.
| Type | Location | Scope | When to Use | | Type | Location | Scope | When to Use |
|------|----------|-------|-------------| |------|----------|-------|-------------|
| **Project Memory** | `./CLAUDE.md` | Project (team) | Team standards, project rules | | **Managed Policy** | Org-managed policies | Organization | Enforce org-wide standards |
| **Directory Memory** | `./src/api/CLAUDE.md` | Directory | Module-specific rules | | **Project** | `./CLAUDE.md` | Project (team) | Team standards, project context |
| **Personal Memory** | `~/.claude/CLAUDE.md` | User (personal) | Personal preferences | | **Project Rules** | `.claude/rules/` | Project (team) | Modular project rules |
| **User** | `~/.claude/CLAUDE.md` | User (personal) | Personal preferences |
| **User Rules** | `~/.claude/rules/` | User (personal) | Modular personal rules |
| **Local** | `./CLAUDE.local.md` | Local (git-ignored) | Machine-specific overrides |
| **Auto Memory** | Automatic | Session | Auto-captured insights and corrections |
> **Scope**: `Project` = shared with team via git, `Directory` = module-specific, `User` = personal preferences > **Scope**: `Organization` = managed by admins, `Project` = shared with team via git, `User` = personal preferences, `Local` = not committed, `Session` = auto-managed
**Reference**: [02-memory/](02-memory/) | [Official Docs](https://docs.anthropic.com/en/docs/claude-code/memory) **Reference**: [02-memory/](02-memory/) | [Official Docs](https://docs.anthropic.com/en/docs/claude-code/memory)
@@ -331,6 +354,23 @@ cp 02-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md
--- ---
## New Features (February 2026)
| Feature | Description | How to Use |
|---------|-------------|------------|
| **Remote Control** | Control Claude Code sessions remotely via API | Use the remote control API to send prompts and receive responses programmatically |
| **Web Sessions** | Run Claude Code in a browser-based environment | Access via `claude web` or through the Anthropic Console |
| **Desktop App** | Native desktop application for Claude Code | Use `/desktop` or download from Anthropic website |
| **Agent Teams** | Coordinate multiple agents working on related tasks | Configure teammate agents that collaborate and share context |
| **Task List** | Background task management and monitoring | Use `/tasks` to view and manage background operations |
| **Prompt Suggestions** | Context-aware command suggestions | Suggestions appear automatically based on current context |
| **Git Worktrees** | Isolated git worktrees for parallel development | Use worktree commands for safe parallel branch work |
| **Sandboxing** | Isolated execution environments for safety | Use `/sandbox` to toggle; runs commands in restricted environments |
| **MCP OAuth** | OAuth authentication for MCP servers | Configure OAuth credentials in MCP server settings for secure access |
| **MCP Tool Search** | Search and discover MCP tools dynamically | Use tool search to find available MCP tools across connected servers |
---
## Quick Reference Matrix ## Quick Reference Matrix
### Feature Selection Guide ### Feature Selection Guide
@@ -353,7 +393,7 @@ cp 02-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md
| 2. Daily Use | Slash Commands | `cp 01-slash-commands/*.md .claude/commands/` | | 2. Daily Use | Slash Commands | `cp 01-slash-commands/*.md .claude/commands/` |
| 3. Quality | Sub-Agents | `cp 04-subagents/*.md .claude/agents/` | | 3. Quality | Sub-Agents | `cp 04-subagents/*.md .claude/agents/` |
| 4. Automation | Hooks | `cp 06-hooks/*.sh ~/.claude/hooks/ && chmod +x ~/.claude/hooks/*.sh` | | 4. Automation | Hooks | `cp 06-hooks/*.sh ~/.claude/hooks/ && chmod +x ~/.claude/hooks/*.sh` |
| 5. External | MCP | `cp 05-mcp/github-mcp.json .claude/mcp.json` | | 5. External | MCP | `claude mcp add github -- npx -y @modelcontextprotocol/server-github` |
| 6. Advanced | Skills | `cp -r 03-skills/* ~/.claude/skills/` | | 6. Advanced | Skills | `cp -r 03-skills/* ~/.claude/skills/` |
| 7. Complete | Plugins | `/plugin install pr-review` | | 7. Complete | Plugins | `/plugin install pr-review` |
@@ -387,4 +427,4 @@ chmod +x ~/.claude/hooks/*.sh
--- ---
**Last Updated**: January 2026 **Last Updated**: February 2026
+293 -176
View File
@@ -9,16 +9,16 @@ This document provides a complete index of all example files organized by featur
## Summary Statistics ## Summary Statistics
- **Total Files**: 90+ files - **Total Files**: 100+ files
- **Categories**: 9 feature categories - **Categories**: 10 feature categories
- **Plugins**: 3 complete plugins - **Plugins**: 3 complete plugins
- **Skills**: 3 complete skills - **Skills**: 6 complete skills
- **Hooks**: 6 example hooks - **Hooks**: 8 example hooks
- **Ready to Use**: All examples - **Ready to Use**: All examples
--- ---
## 📁 01. Slash Commands (4 files) ## 01. Slash Commands (10 files)
User-invoked shortcuts for common workflows. User-invoked shortcuts for common workflows.
@@ -27,34 +27,21 @@ User-invoked shortcuts for common workflows.
| `optimize.md` | Code optimization analyzer | Find performance issues | | `optimize.md` | Code optimization analyzer | Find performance issues |
| `pr.md` | Pull request preparation | PR workflow automation | | `pr.md` | Pull request preparation | PR workflow automation |
| `generate-api-docs.md` | API documentation generator | Generate API docs | | `generate-api-docs.md` | API documentation generator | Generate API docs |
| `commit.md` | Commit message helper | Standardized commits |
| `setup-ci-cd.md` | CI/CD pipeline setup | DevOps automation |
| `push-all.md` | Push all changes | Quick push workflow |
| `unit-test-expand.md` | Expand unit test coverage | Test automation |
| `doc-refactor.md` | Documentation refactoring | Doc improvements |
| `pr-slash-command.png` | Screenshot example | Visual reference |
| `README.md` | Documentation | Setup and usage guide | | `README.md` | Documentation | Setup and usage guide |
**Installation Path**: `.claude/commands/` **Installation Path**: `.claude/commands/`
**Usage**: `/optimize`, `/pr`, `/generate-api-docs` **Usage**: `/optimize`, `/pr`, `/generate-api-docs`, `/commit`, `/setup-ci-cd`, `/push-all`, `/unit-test-expand`, `/doc-refactor`
--- ---
## 🤖 02. Subagents (6 files) ## 02. Memory (6 files)
Specialized AI assistants with custom capabilities.
| File | Description | Tools | Use Case |
|------|-------------|-------|----------|
| `code-reviewer.md` | Code quality analysis | read, grep, diff, lint_runner | Comprehensive reviews |
| `test-engineer.md` | Test coverage analysis | read, write, bash, grep | Test automation |
| `documentation-writer.md` | Documentation creation | read, write, grep | Doc generation |
| `secure-reviewer.md` | Security review (read-only) | read, grep | Security audits |
| `implementation-agent.md` | Full implementation | read, write, bash, grep, edit, glob | Feature development |
| `README.md` | Documentation | - | Setup and usage guide |
**Installation Path**: `.claude/agents/`
**Usage**: Automatically delegated by main agent
---
## 💾 03. Memory (4 files)
Persistent context and project standards. Persistent context and project standards.
@@ -63,6 +50,8 @@ Persistent context and project standards.
| `project-CLAUDE.md` | Team project standards | Project-wide | `./CLAUDE.md` | | `project-CLAUDE.md` | Team project standards | Project-wide | `./CLAUDE.md` |
| `directory-api-CLAUDE.md` | API-specific rules | Directory | `./src/api/CLAUDE.md` | | `directory-api-CLAUDE.md` | API-specific rules | Directory | `./src/api/CLAUDE.md` |
| `personal-CLAUDE.md` | Personal preferences | User | `~/.claude/CLAUDE.md` | | `personal-CLAUDE.md` | Personal preferences | User | `~/.claude/CLAUDE.md` |
| `memory-saved.png` | Screenshot: memory saved | - | Visual reference |
| `memory-ask-claude.png` | Screenshot: ask Claude | - | Visual reference |
| `README.md` | Documentation | - | Reference | | `README.md` | Documentation | - | Reference |
**Installation**: Copy to appropriate location **Installation**: Copy to appropriate location
@@ -71,25 +60,7 @@ Persistent context and project standards.
--- ---
## 🔌 04. MCP Protocol (5 files) ## 03. Skills (28 files)
External tool and API integrations.
| File | Description | Integrates With | Use Case |
|------|-------------|-----------------|----------|
| `github-mcp.json` | GitHub integration | GitHub API | PR/issue management |
| `database-mcp.json` | Database queries | PostgreSQL/MySQL | Live data queries |
| `filesystem-mcp.json` | File operations | Local filesystem | File management |
| `multi-mcp.json` | Multiple servers | GitHub + DB + Slack | Complete integration |
| `README.md` | Documentation | - | Setup and usage guide |
**Installation Path**: `.claude/mcp.json`
**Usage**: `/mcp__github__list_prs`, etc.
---
## 🎯 05. Skills (11 files)
Auto-invoked capabilities with scripts and templates. Auto-invoked capabilities with scripts and templates.
@@ -138,20 +109,131 @@ doc-generator/
**Auto-invoked**: When creating/updating API documentation **Auto-invoked**: When creating/updating API documentation
---
### Refactor Skill (5 files)
```
refactor/
├── SKILL.md # Skill definition
├── scripts/
│ ├── analyze-complexity.py # Complexity analyzer
│ └── detect-smells.py # Code smell detector
├── references/
│ ├── code-smells.md # Code smells catalog
│ └── refactoring-catalog.md # Refactoring patterns
└── templates/
└── refactoring-plan.md # Refactoring plan template
```
**Purpose**: Systematic code refactoring with complexity analysis
**Auto-invoked**: When refactoring code
---
### Claude MD Skill (1 file)
```
claude-md/
└── SKILL.md # Skill definition
```
**Purpose**: Manage and optimize CLAUDE.md files
---
### Blog Draft Skill (3 files)
```
blog-draft/
├── SKILL.md # Skill definition
└── templates/
├── draft-template.md # Blog draft template
└── outline-template.md # Blog outline template
```
**Purpose**: Draft blog posts with consistent structure
**Plus**: `README.md` - Skills overview and usage guide **Plus**: `README.md` - Skills overview and usage guide
**Installation Path**: `~/.claude/skills/` or `.claude/skills/` **Installation Path**: `~/.claude/skills/` or `.claude/skills/`
--- ---
## 📦 06. Plugins (3 complete plugins, 40 files) ## 04. Subagents (9 files)
Specialized AI assistants with custom capabilities.
| File | Description | Tools | Use Case |
|------|-------------|-------|----------|
| `code-reviewer.md` | Code quality analysis | read, grep, diff, lint_runner | Comprehensive reviews |
| `test-engineer.md` | Test coverage analysis | read, write, bash, grep | Test automation |
| `documentation-writer.md` | Documentation creation | read, write, grep | Doc generation |
| `secure-reviewer.md` | Security review (read-only) | read, grep | Security audits |
| `implementation-agent.md` | Full implementation | read, write, bash, grep, edit, glob | Feature development |
| `debugger.md` | Debugging specialist | read, bash, grep | Bug investigation |
| `data-scientist.md` | Data analysis specialist | read, write, bash | Data workflows |
| `clean-code-reviewer.md` | Clean code standards | read, grep | Code quality |
| `README.md` | Documentation | - | Setup and usage guide |
**Installation Path**: `.claude/agents/`
**Usage**: Automatically delegated by main agent
---
## 05. MCP Protocol (5 files)
External tool and API integrations.
| File | Description | Integrates With | Use Case |
|------|-------------|-----------------|----------|
| `github-mcp.json` | GitHub integration | GitHub API | PR/issue management |
| `database-mcp.json` | Database queries | PostgreSQL/MySQL | Live data queries |
| `filesystem-mcp.json` | File operations | Local filesystem | File management |
| `multi-mcp.json` | Multiple servers | GitHub + DB + Slack | Complete integration |
| `README.md` | Documentation | - | Setup and usage guide |
**Installation Path**: `.mcp.json` (project scope) or `~/.claude.json` (user scope)
**Usage**: `/mcp__github__list_prs`, etc.
---
## 06. Hooks (9 files)
Event-driven automation scripts that execute automatically.
| File | Description | Event | Use Case |
|------|-------------|-------|----------|
| `format-code.sh` | Auto-format code | PreToolUse:Write | Code formatting |
| `pre-commit.sh` | Run tests before commit | PreToolUse:Bash | Test automation |
| `security-scan.sh` | Security scanning | PostToolUse:Write | Security checks |
| `log-bash.sh` | Log bash commands | PostToolUse:Bash | Command logging |
| `validate-prompt.sh` | Validate prompts | PreToolUse | Input validation |
| `notify-team.sh` | Send notifications | Notification | Team notifications |
| `context-tracker.py` | Track context window usage | PostToolUse | Context monitoring |
| `context-tracker-tiktoken.py` | Token-based context tracking | PostToolUse | Precise token counting |
| `README.md` | Documentation | - | Setup and usage guide |
**Installation Path**: Configure in `~/.claude/settings.json`
**Usage**: Configured in settings, executed automatically
**Hook Types**:
- Tool Hooks: PreToolUse:*, PostToolUse:*
- Session Hooks: Stop, SubagentStop, SubagentStart
- Lifecycle Hooks: Notification, ConfigChange, WorktreeCreate, WorktreeRemove
---
## 07. Plugins (3 complete plugins, 40 files)
Bundled collections of features. Bundled collections of features.
### PR Review Plugin (10 files) ### PR Review Plugin (10 files)
``` ```
pr-review/ pr-review/
├── plugin.yaml # Plugin manifest ├── .claude-plugin/
│ └── plugin.json # Plugin manifest
├── commands/ ├── commands/
│ ├── review-pr.md # Comprehensive review │ ├── review-pr.md # Comprehensive review
│ ├── check-security.md # Security check │ ├── check-security.md # Security check
@@ -178,7 +260,8 @@ pr-review/
### DevOps Automation Plugin (15 files) ### DevOps Automation Plugin (15 files)
``` ```
devops-automation/ devops-automation/
├── plugin.yaml # Plugin manifest ├── .claude-plugin/
│ └── plugin.json # Plugin manifest
├── commands/ ├── commands/
│ ├── deploy.md # Deployment │ ├── deploy.md # Deployment
│ ├── rollback.md # Rollback │ ├── rollback.md # Rollback
@@ -211,7 +294,8 @@ devops-automation/
### Documentation Plugin (14 files) ### Documentation Plugin (14 files)
``` ```
documentation/ documentation/
├── plugin.yaml # Plugin manifest ├── .claude-plugin/
│ └── plugin.json # Plugin manifest
├── commands/ ├── commands/
│ ├── generate-api-docs.md # API docs generation │ ├── generate-api-docs.md # API docs generation
│ ├── generate-readme.md # README creation │ ├── generate-readme.md # README creation
@@ -240,32 +324,7 @@ documentation/
--- ---
## ⚙️ 07. Hooks (7 files) ## 08. Checkpoints and Rewind (2 files)
Event-driven automation scripts that execute automatically.
| File | Description | Event | Use Case |
|------|-------------|-------|----------|
| `format-code.sh` | Auto-format code | PreToolUse:Write | Code formatting |
| `pre-commit.sh` | Run tests before commit | PreCommit | Test automation |
| `security-scan.sh` | Security scanning | PostToolUse:Write | Security checks |
| `log-bash.sh` | Log bash commands | PostToolUse:Bash | Command logging |
| `validate-prompt.sh` | Validate prompts | UserPromptSubmit | Input validation |
| `notify-team.sh` | Send notifications | PostPush | Team notifications |
| `README.md` | Documentation | - | Setup and usage guide |
**Installation Path**: `~/.claude/hooks/`
**Usage**: Configured in settings, executed automatically
**Hook Types**:
- Tool Hooks: PreToolUse:*, PostToolUse:*
- Session Hooks: UserPromptSubmit, SessionStart, SessionEnd
- Git Hooks: PreCommit, PostCommit, PrePush
---
## 💾 08. Checkpoints and Rewind (3 files)
Save conversation state and explore alternative approaches. Save conversation state and explore alternative approaches.
@@ -282,10 +341,11 @@ Save conversation state and explore alternative approaches.
**Usage**: **Usage**:
``` ```
/checkpoint save "Before refactoring" # Checkpoints are created automatically with every user prompt
/checkpoint list # To rewind, press Esc twice or use:
/checkpoint rewind "Before refactoring" /rewind
/checkpoint diff checkpoint-1 checkpoint-2 # Then choose: Restore code and conversation, Restore conversation,
# Restore code, Summarize from here, or Never mind
``` ```
**Use Cases**: **Use Cases**:
@@ -297,7 +357,7 @@ Save conversation state and explore alternative approaches.
--- ---
## 🚀 09. Advanced Features (4 files) ## 09. Advanced Features (3 files)
Advanced capabilities for complex workflows. Advanced capabilities for complex workflows.
@@ -326,12 +386,13 @@ Advanced capabilities for complex workflows.
- Task management and monitoring - Task management and monitoring
### Permission Modes ### Permission Modes
- **Unrestricted**: Full access (default) - **default**: Ask for approval on risky actions
- **Confirm**: Ask before actions - **acceptEdits**: Auto-accept file edits, ask for others
- **Read-only**: Analysis only - **plan**: Read-only analysis, no modifications
- **Custom**: Granular control - **dontAsk**: Accept all actions except risky ones
- **bypassPermissions**: Accept all (requires `--dangerously-skip-permissions`)
### Headless Mode ### Headless Mode (`claude -p`)
- CI/CD integration - CI/CD integration
- Automated task execution - Automated task execution
- Batch processing - Batch processing
@@ -354,26 +415,45 @@ Advanced capabilities for complex workflows.
--- ---
## 📚 Documentation Files (11 files) ## 10. CLI Usage (1 file)
Command-line interface usage patterns and reference.
| File | Description | Content |
|------|-------------|---------|
| `README.md` | CLI documentation | Flags, options, and usage patterns |
**Key CLI Features**:
- `claude` - Start interactive session
- `claude -p "prompt"` - Headless/non-interactive mode
- `claude web` - Launch web session
- `claude --model` - Select model (Sonnet 4.6, Opus 4.6)
- `claude --permission-mode` - Set permission mode
- `claude --remote` - Enable remote control via WebSocket
---
## Documentation Files (13 files)
| File | Location | Description | | File | Location | Description |
|------|----------|-------------| |------|----------|-------------|
| `README.md` | `/` | Main examples overview | | `README.md` | `/` | Main examples overview |
| `INDEX.md` | `/` | This complete index | | `INDEX.md` | `/` | This complete index |
| `QUICK_REFERENCE.md` | `/` | Quick reference card |
| `README.md` | `/01-slash-commands/` | Slash commands guide | | `README.md` | `/01-slash-commands/` | Slash commands guide |
| `README.md` | `/02-subagents/` | Subagents guide | | `README.md` | `/02-memory/` | Memory guide |
| `README.md` | `/03-memory/` | Memory guide | | `README.md` | `/03-skills/` | Skills guide |
| `README.md` | `/04-mcp/` | MCP guide | | `README.md` | `/04-subagents/` | Subagents guide |
| `README.md` | `/05-skills/` | Skills guide | | `README.md` | `/05-mcp/` | MCP guide |
| `README.md` | `/06-plugins/` | Plugins guide |
| `README.md` | `/06-hooks/` | Hooks guide | | `README.md` | `/06-hooks/` | Hooks guide |
| `README.md` | `/07-plugins/` | Plugins guide |
| `README.md` | `/08-checkpoints/` | Checkpoints guide | | `README.md` | `/08-checkpoints/` | Checkpoints guide |
| `README.md` | `/09-advanced-features/` | Advanced features guide | | `README.md` | `/09-advanced-features/` | Advanced features guide |
| `QUICK_REFERENCE.md` | `/` | Quick reference card | | `README.md` | `/10-cli/` | CLI guide |
--- ---
## 🗂️ Complete File Tree ## Complete File Tree
``` ```
claude-howto/ claude-howto/
@@ -386,30 +466,23 @@ claude-howto/
│ ├── optimize.md │ ├── optimize.md
│ ├── pr.md │ ├── pr.md
│ ├── generate-api-docs.md │ ├── generate-api-docs.md
│ ├── commit.md
│ ├── setup-ci-cd.md
│ ├── push-all.md
│ ├── unit-test-expand.md
│ ├── doc-refactor.md
│ ├── pr-slash-command.png
│ └── README.md │ └── README.md
├── 02-subagents/ # Subagents ├── 02-memory/ # Memory
│ ├── code-reviewer.md
│ ├── test-engineer.md
│ ├── documentation-writer.md
│ ├── secure-reviewer.md
│ ├── implementation-agent.md
│ └── README.md
├── 03-memory/ # Memory
│ ├── project-CLAUDE.md │ ├── project-CLAUDE.md
│ ├── directory-api-CLAUDE.md │ ├── directory-api-CLAUDE.md
│ ├── personal-CLAUDE.md │ ├── personal-CLAUDE.md
│ ├── memory-saved.png
│ ├── memory-ask-claude.png
│ └── README.md │ └── README.md
├── 04-mcp/ # MCP Protocol ├── 03-skills/ # Skills
│ ├── github-mcp.json
│ ├── database-mcp.json
│ ├── filesystem-mcp.json
│ ├── multi-mcp.json
│ └── README.md
├── 05-skills/ # Skills
│ ├── code-review/ │ ├── code-review/
│ │ ├── SKILL.md │ │ ├── SKILL.md
│ │ ├── scripts/ │ │ ├── scripts/
@@ -427,11 +500,58 @@ claude-howto/
│ ├── doc-generator/ │ ├── doc-generator/
│ │ ├── SKILL.md │ │ ├── SKILL.md
│ │ └── generate-docs.py │ │ └── generate-docs.py
│ ├── refactor/
│ │ ├── SKILL.md
│ │ ├── scripts/
│ │ │ ├── analyze-complexity.py
│ │ │ └── detect-smells.py
│ │ ├── references/
│ │ │ ├── code-smells.md
│ │ │ └── refactoring-catalog.md
│ │ └── templates/
│ │ └── refactoring-plan.md
│ ├── claude-md/
│ │ └── SKILL.md
│ ├── blog-draft/
│ │ ├── SKILL.md
│ │ └── templates/
│ │ ├── draft-template.md
│ │ └── outline-template.md
│ └── README.md │ └── README.md
├── 06-plugins/ # Plugins ├── 04-subagents/ # Subagents
│ ├── code-reviewer.md
│ ├── test-engineer.md
│ ├── documentation-writer.md
│ ├── secure-reviewer.md
│ ├── implementation-agent.md
│ ├── debugger.md
│ ├── data-scientist.md
│ ├── clean-code-reviewer.md
│ └── README.md
├── 05-mcp/ # MCP Protocol
│ ├── github-mcp.json
│ ├── database-mcp.json
│ ├── filesystem-mcp.json
│ ├── multi-mcp.json
│ └── README.md
├── 06-hooks/ # Hooks
│ ├── format-code.sh
│ ├── pre-commit.sh
│ ├── security-scan.sh
│ ├── log-bash.sh
│ ├── validate-prompt.sh
│ ├── notify-team.sh
│ ├── context-tracker.py
│ ├── context-tracker-tiktoken.py
│ └── README.md
├── 07-plugins/ # Plugins
│ ├── pr-review/ │ ├── pr-review/
│ │ ├── plugin.yaml │ │ ├── .claude-plugin/
│ │ │ └── plugin.json
│ │ ├── commands/ │ │ ├── commands/
│ │ │ ├── review-pr.md │ │ │ ├── review-pr.md
│ │ │ ├── check-security.md │ │ │ ├── check-security.md
@@ -446,7 +566,8 @@ claude-howto/
│ │ │ └── pre-review.js │ │ │ └── pre-review.js
│ │ └── README.md │ │ └── README.md
│ ├── devops-automation/ │ ├── devops-automation/
│ │ ├── plugin.yaml │ │ ├── .claude-plugin/
│ │ │ └── plugin.json
│ │ ├── commands/ │ │ ├── commands/
│ │ │ ├── deploy.md │ │ │ ├── deploy.md
│ │ │ ├── rollback.md │ │ │ ├── rollback.md
@@ -467,7 +588,8 @@ claude-howto/
│ │ │ └── health-check.sh │ │ │ └── health-check.sh
│ │ └── README.md │ │ └── README.md
│ ├── documentation/ │ ├── documentation/
│ │ ├── plugin.yaml │ │ ├── .claude-plugin/
│ │ │ └── plugin.json
│ │ ├── commands/ │ │ ├── commands/
│ │ │ ├── generate-api-docs.md │ │ │ ├── generate-api-docs.md
│ │ │ ├── generate-readme.md │ │ │ ├── generate-readme.md
@@ -486,28 +608,22 @@ claude-howto/
│ │ └── README.md │ │ └── README.md
│ └── README.md │ └── README.md
├── 06-hooks/ # Hooks
│ ├── format-code.sh
│ ├── pre-commit.sh
│ ├── security-scan.sh
│ ├── log-bash.sh
│ ├── validate-prompt.sh
│ ├── notify-team.sh
│ └── README.md
├── 08-checkpoints/ # Checkpoints ├── 08-checkpoints/ # Checkpoints
│ ├── checkpoint-examples.md │ ├── checkpoint-examples.md
│ └── README.md │ └── README.md
── 09-advanced-features/ # Advanced Features ── 09-advanced-features/ # Advanced Features
├── config-examples.json ├── config-examples.json
├── planning-mode-examples.md ├── planning-mode-examples.md
│ └── README.md
└── 10-cli/ # CLI Usage
└── README.md └── README.md
``` ```
--- ---
## 🚀 Quick Start by Use Case ## Quick Start by Use Case
### Code Quality & Reviews ### Code Quality & Reviews
```bash ```bash
@@ -515,10 +631,10 @@ claude-howto/
cp 01-slash-commands/optimize.md .claude/commands/ cp 01-slash-commands/optimize.md .claude/commands/
# Install subagent # Install subagent
cp 02-subagents/code-reviewer.md .claude/agents/ cp 04-subagents/code-reviewer.md .claude/agents/
# Install skill # Install skill
cp -r 05-skills/code-review ~/.claude/skills/ cp -r 03-skills/code-review ~/.claude/skills/
# Or install complete plugin # Or install complete plugin
/plugin install pr-review /plugin install pr-review
@@ -536,10 +652,10 @@ cp -r 05-skills/code-review ~/.claude/skills/
cp 01-slash-commands/generate-api-docs.md .claude/commands/ cp 01-slash-commands/generate-api-docs.md .claude/commands/
# Install subagent # Install subagent
cp 02-subagents/documentation-writer.md .claude/agents/ cp 04-subagents/documentation-writer.md .claude/agents/
# Install skill # Install skill
cp -r 05-skills/doc-generator ~/.claude/skills/ cp -r 03-skills/doc-generator ~/.claude/skills/
# Or install complete plugin # Or install complete plugin
/plugin install documentation /plugin install documentation
@@ -548,7 +664,7 @@ cp -r 05-skills/doc-generator ~/.claude/skills/
### Team Standards ### Team Standards
```bash ```bash
# Set up project memory # Set up project memory
cp 03-memory/project-CLAUDE.md ./CLAUDE.md cp 02-memory/project-CLAUDE.md ./CLAUDE.md
# Edit to match your team's standards # Edit to match your team's standards
``` ```
@@ -559,8 +675,8 @@ cp 03-memory/project-CLAUDE.md ./CLAUDE.md
export GITHUB_TOKEN="your_token" export GITHUB_TOKEN="your_token"
export DATABASE_URL="postgresql://..." export DATABASE_URL="postgresql://..."
# Install MCP config # Install MCP config (project scope)
cp 04-mcp/multi-mcp.json .claude/mcp.json cp 05-mcp/multi-mcp.json .mcp.json
``` ```
### Automation & Validation ### Automation & Validation
@@ -570,17 +686,15 @@ mkdir -p ~/.claude/hooks
cp 06-hooks/*.sh ~/.claude/hooks/ cp 06-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh chmod +x ~/.claude/hooks/*.sh
# Configure hooks in settings # Configure hooks in settings (~/.claude/settings.json)
# See 06-hooks/README.md # See 06-hooks/README.md
``` ```
### Safe Experimentation ### Safe Experimentation
```bash ```bash
# Checkpoints are auto-enabled # Checkpoints are created automatically with every user prompt
# Use in your workflow: # To rewind: press Esc+Esc or use /rewind
/checkpoint save "Before refactoring" # Then choose what to restore from the rewind menu
/checkpoint list
/checkpoint rewind "Before refactoring"
# See 08-checkpoints/README.md for examples # See 08-checkpoints/README.md for examples
``` ```
@@ -594,8 +708,11 @@ chmod +x ~/.claude/hooks/*.sh
/plan Implement feature X /plan Implement feature X
# Use permission modes # Use permission modes
/permission readonly # For code review claude --permission-mode plan # For code review (read-only)
/permission confirm # For learning claude --permission-mode acceptEdits # Auto-accept edits
# Run in headless mode for CI/CD
claude -p "Run tests and report results"
# Run background tasks # Run background tasks
Run tests in background Run tests in background
@@ -605,24 +722,24 @@ Run tests in background
--- ---
## 📊 Feature Coverage Matrix ## Feature Coverage Matrix
| Category | Commands | Agents | MCP | Hooks | Scripts | Templates | Docs | Examples | Total | | Category | Commands | Agents | MCP | Hooks | Scripts | Templates | Docs | Images | Total |
|----------|----------|--------|-----|-------|---------|-----------|------|----------|-------| |----------|----------|--------|-----|-------|---------|-----------|------|--------|-------|
| **Slash Commands** | 3 | - | - | - | - | - | 1 | - | **4** | | **01 Slash Commands** | 8 | - | - | - | - | - | 1 | 1 | **10** |
| **Subagents** | - | 5 | - | - | - | - | 1 | - | **6** | | **02 Memory** | - | - | - | - | - | 3 | 1 | 2 | **6** |
| **Memory** | - | - | - | - | - | 3 | 1 | - | **4** | | **03 Skills** | - | - | - | - | 5 | 9 | 1 | - | **28** |
| **MCP** | - | - | 4 | - | - | - | 1 | - | **5** | | **04 Subagents** | - | 8 | - | - | - | - | 1 | - | **9** |
| **Skills** | - | - | - | - | 3 | 7 | 1 | - | **11** | | **05 MCP** | - | - | 4 | - | - | - | 1 | - | **5** |
| **Plugins** | 11 | 9 | 3 | 3 | 3 | 3 | 4 | - | **36** | | **06 Hooks** | - | - | - | 8 | - | - | 1 | - | **9** |
| **Hooks** | - | - | - | 6 | - | - | 1 | - | **7** | | **07 Plugins** | 11 | 9 | 3 | 3 | 3 | 3 | 4 | - | **40** |
| **Checkpoints** | - | - | - | - | - | - | 1 | 1 | **2** | | **08 Checkpoints** | - | - | - | - | - | - | 1 | 1 | **2** |
| **Advanced** | - | - | - | - | - | - | 1 | 2 | **3** | | **09 Advanced** | - | - | - | - | - | - | 1 | 2 | **3** |
| **TOTAL** | **14** | **14** | **7** | **9** | **6** | **13** | **12** | **3** | **78** | | **10 CLI** | - | - | - | - | - | - | 1 | - | **1** |
--- ---
## 🎯 Learning Path ## Learning Path
### Beginner (Week 1) ### Beginner (Week 1)
1. ✅ Read `README.md` 1. ✅ Read `README.md`
@@ -653,31 +770,31 @@ Run tests in background
--- ---
## 🔍 Search by Keyword ## Search by Keyword
### Performance ### Performance
- `01-slash-commands/optimize.md` - Performance analysis - `01-slash-commands/optimize.md` - Performance analysis
- `02-subagents/code-reviewer.md` - Performance review - `04-subagents/code-reviewer.md` - Performance review
- `05-skills/code-review/` - Performance metrics - `03-skills/code-review/` - Performance metrics
- `06-plugins/pr-review/agents/performance-analyzer.md` - Performance specialist - `07-plugins/pr-review/agents/performance-analyzer.md` - Performance specialist
### Security ### Security
- `02-subagents/secure-reviewer.md` - Security review - `04-subagents/secure-reviewer.md` - Security review
- `05-skills/code-review/` - Security analysis - `03-skills/code-review/` - Security analysis
- `06-plugins/pr-review/` - Security checks - `07-plugins/pr-review/` - Security checks
### Testing ### Testing
- `02-subagents/test-engineer.md` - Test engineer - `04-subagents/test-engineer.md` - Test engineer
- `06-plugins/pr-review/commands/check-tests.md` - Test coverage - `07-plugins/pr-review/commands/check-tests.md` - Test coverage
### Documentation ### Documentation
- `01-slash-commands/generate-api-docs.md` - API docs command - `01-slash-commands/generate-api-docs.md` - API docs command
- `02-subagents/documentation-writer.md` - Doc writer agent - `04-subagents/documentation-writer.md` - Doc writer agent
- `05-skills/doc-generator/` - Doc generator skill - `03-skills/doc-generator/` - Doc generator skill
- `06-plugins/documentation/` - Complete doc plugin - `07-plugins/documentation/` - Complete doc plugin
### Deployment ### Deployment
- `06-plugins/devops-automation/` - Complete DevOps solution - `07-plugins/devops-automation/` - Complete DevOps solution
### Automation ### Automation
- `06-hooks/` - Event-driven automation - `06-hooks/` - Event-driven automation
@@ -702,7 +819,7 @@ Run tests in background
--- ---
## 📝 Notes ## Notes
- All examples are ready to use - All examples are ready to use
- Modify to fit your specific needs - Modify to fit your specific needs
@@ -713,7 +830,7 @@ Run tests in background
--- ---
## 🤝 Contributing ## Contributing
Want to add more examples? Follow the structure: Want to add more examples? Follow the structure:
1. Create appropriate subdirectory 1. Create appropriate subdirectory
@@ -724,9 +841,9 @@ Want to add more examples? Follow the structure:
--- ---
**Last Updated**: November 2025 **Last Updated**: February 2026
**Total Examples**: 90+ files **Total Examples**: 100+ files
**Categories**: 9 features **Categories**: 10 features
**Hooks**: 6 automation scripts **Hooks**: 8 automation scripts
**Configuration Examples**: 10+ scenarios **Configuration Examples**: 10+ scenarios
**Ready to Use**: All examples **Ready to Use**: All examples
+51 -28
View File
@@ -145,22 +145,32 @@ cp -r 03-skills/code-review ~/.claude/skills/
# Exercise 2: Set up hooks # Exercise 2: Set up hooks
mkdir -p ~/.claude/hooks mkdir -p ~/.claude/hooks
cp 06-hooks/pre-commit.sh ~/.claude/hooks/ cp 06-hooks/pre-tool-check.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/pre-commit.sh chmod +x ~/.claude/hooks/pre-tool-check.sh
# Exercise 3: Configure hooks in settings # Exercise 3: Configure hooks in settings
# Add to ~/.claude/config.json: # Add to ~/.claude/settings.json:
{ {
"hooks": { "hooks": {
"PreCommit": "~/.claude/hooks/pre-commit.sh" "PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/pre-tool-check.sh"
}
]
}
]
} }
} }
``` ```
#### Success Criteria #### Success Criteria
- [ ] Code review skill automatically invoked when relevant - [ ] Code review skill automatically invoked when relevant
- [ ] Pre-commit hook runs before git commits - [ ] PreToolUse hook runs before tool execution
- [ ] You understand skill auto-invocation vs. hook triggers - [ ] You understand skill auto-invocation vs. hook event triggers
#### Next Steps #### Next Steps
- Create your own custom skill - Create your own custom skill
@@ -188,7 +198,7 @@ chmod +x ~/.claude/hooks/pre-commit.sh
```bash ```bash
# Exercise 1: Set up GitHub MCP # Exercise 1: Set up GitHub MCP
export GITHUB_TOKEN="your_github_token" export GITHUB_TOKEN="your_github_token"
cp 05-mcp/github-mcp.json ~/.claude/mcp.json claude mcp add github -- npx -y @modelcontextprotocol/server-github
# Exercise 2: Test MCP integration # Exercise 2: Test MCP integration
# In Claude Code: /mcp__github__list_prs # In Claude Code: /mcp__github__list_prs
@@ -233,35 +243,42 @@ Try this complete workflow:
#### What You'll Achieve #### What You'll Achieve
✅ Safe experimentation with checkpoints ✅ Safe experimentation with checkpoints
✅ Planning mode for complex features ✅ Planning mode for complex features
Headless mode for CI/CD Print mode (`claude -p`) for CI/CD automation
✅ Fine-grained permission control ✅ Fine-grained permission control (default, acceptEdits, plan, dontAsk, bypassPermissions)
✅ Background task management ✅ Background task management
✅ Auto Memory for learned preferences
✅ Extended thinking via Alt+T / Option+T toggle
#### Hands-on Exercises #### Hands-on Exercises
```bash ```bash
# Exercise 1: Try checkpoint workflow # Exercise 1: Try checkpoint workflow
# In Claude Code: # In Claude Code:
/checkpoint save "Before experiment" # Make some experimental changes, then press Esc+Esc or use /rewind
# ... make experimental changes ... # Select the checkpoint before your experiment
/checkpoint rewind "Before experiment" # Choose "Restore code and conversation" to go back
# Exercise 2: Use planning mode # Exercise 2: Use planning mode
/plan Implement user authentication system /plan Implement user authentication system
# Exercise 3: Try headless mode # Exercise 3: Try print mode (non-interactive)
claude-code --headless --task "Run all tests and generate report" claude -p "Run all tests and generate report"
# Exercise 4: Configure advanced features # Exercise 4: Try permission modes
# See 09-advanced-features/config-examples.json claude --permission-mode plan "analyze this codebase"
claude --permission-mode acceptEdits "refactor the auth module"
# Exercise 5: Enable extended thinking
# Press Alt+T (Option+T on macOS) during a session to toggle
``` ```
#### Success Criteria #### Success Criteria
- [ ] Created and reverted to a checkpoint - [ ] Created and reverted to a checkpoint
- [ ] Used planning mode for a complex feature - [ ] Used planning mode for a complex feature
- [ ] Ran Claude Code in headless mode - [ ] Ran Claude Code in print mode (`claude -p`)
- [ ] Configured permission modes - [ ] Configured permission modes (plan, acceptEdits, dontAsk)
- [ ] Used background tasks for long operations - [ ] Used background tasks for long operations
- [ ] Toggled extended thinking with Alt+T / Option+T
#### Advanced Exercise #### Advanced Exercise
Complete this end-to-end workflow: Complete this end-to-end workflow:
@@ -271,7 +288,7 @@ Complete this end-to-end workflow:
4. Run tests in background 4. Run tests in background
5. If tests fail, rewind to checkpoint 5. If tests fail, rewind to checkpoint
6. Try alternative approach 6. Try alternative approach
7. Use headless mode in CI/CD 7. Use print mode (`claude -p`) in CI/CD
#### Next Steps #### Next Steps
- Set up CI/CD integration - Set up CI/CD integration
@@ -474,7 +491,7 @@ Use this checklist to track your progress:
- [ ] Completed 03-skills - [ ] Completed 03-skills
- [ ] Completed 06-hooks - [ ] Completed 06-hooks
- [ ] Installed first skill - [ ] Installed first skill
- [ ] Set up pre-commit hook - [ ] Set up PreToolUse hook
- [ ] Milestone 2 achieved - [ ] Milestone 2 achieved
### Week 3-4: Integration ### Week 3-4: Integration
@@ -490,7 +507,9 @@ Use this checklist to track your progress:
- [ ] Completed 08-checkpoints - [ ] Completed 08-checkpoints
- [ ] Completed 09-advanced-features - [ ] Completed 09-advanced-features
- [ ] Used planning mode successfully - [ ] Used planning mode successfully
- [ ] Set up headless CI/CD - [ ] Set up print mode (`claude -p`) CI/CD
- [ ] Configured permission modes
- [ ] Used extended thinking toggle
- [ ] Created team plugin - [ ] Created team plugin
- [ ] Milestone 4 achieved - [ ] Milestone 4 achieved
@@ -530,19 +549,23 @@ Once you've completed all milestones:
1. **Create team documentation** - Document your team's Claude Code setup 1. **Create team documentation** - Document your team's Claude Code setup
2. **Build custom plugins** - Package your team's workflows 2. **Build custom plugins** - Package your team's workflows
3. **Contribute examples** - Share with the community 3. **Explore Remote Control** - Control Claude Code sessions programmatically from external tools
4. **Mentor others** - Help teammates learn 4. **Try Web Sessions** - Use Claude Code through browser-based interfaces for remote development
5. **Optimize workflows** - Continuously improve based on usage 5. **Use the Desktop App** - Access Claude Code features through the native desktop application
6. **Stay updated** - Follow Claude Code releases and new features 6. **Leverage Auto Memory** - Let Claude learn your preferences automatically over time
7. **Contribute examples** - Share with the community
8. **Mentor others** - Help teammates learn
9. **Optimize workflows** - Continuously improve based on usage
10. **Stay updated** - Follow Claude Code releases and new features
--- ---
## 📚 Additional Resources ## 📚 Additional Resources
### Official Documentation ### Official Documentation
- [Claude Code Documentation](https://docs.claude.com/en/docs/claude-code) - [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code)
- [Anthropic Documentation](https://docs.anthropic.com)
- [MCP Protocol Specification](https://modelcontextprotocol.io) - [MCP Protocol Specification](https://modelcontextprotocol.io)
- [Plugin Marketplace](https://plugins.claude.com)
### Blog Posts ### Blog Posts
- [Discovering Claude Code Slash Commands](https://medium.com/@luongnv89/discovering-claude-code-slash-commands-cdc17f0dfb29) - [Discovering Claude Code Slash Commands](https://medium.com/@luongnv89/discovering-claude-code-slash-commands-cdc17f0dfb29)
@@ -561,7 +584,7 @@ Once you've completed all milestones:
--- ---
**Last Updated**: December 2025 **Last Updated**: February 2026
**Maintained by**: Claude How-To Contributors **Maintained by**: Claude How-To Contributors
**License**: Educational purposes, free to use and adapt **License**: Educational purposes, free to use and adapt
+125 -101
View File
@@ -16,22 +16,31 @@ cp 01-slash-commands/*.md .claude/commands/
cp 01-slash-commands/optimize.md .claude/commands/ cp 01-slash-commands/optimize.md .claude/commands/
``` ```
### Subagents
```bash
# Install all
cp 02-subagents/*.md .claude/agents/
# Install specific
cp 02-subagents/code-reviewer.md .claude/agents/
```
### Memory ### Memory
```bash ```bash
# Project memory # Project memory
cp 03-memory/project-CLAUDE.md ./CLAUDE.md cp 02-memory/project-CLAUDE.md ./CLAUDE.md
# Personal memory # Personal memory
cp 03-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md cp 02-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md
```
### Skills
```bash
# Personal skills
cp -r 03-skills/code-review ~/.claude/skills/
# Project skills
cp -r 03-skills/code-review .claude/skills/
```
### Subagents
```bash
# Install all
cp 04-subagents/*.md .claude/agents/
# Install specific
cp 04-subagents/code-reviewer.md .claude/agents/
``` ```
### MCP ### MCP
@@ -40,17 +49,20 @@ cp 03-memory/personal-CLAUDE.md ~/.claude/CLAUDE.md
export GITHUB_TOKEN="your_token" export GITHUB_TOKEN="your_token"
export DATABASE_URL="postgresql://..." export DATABASE_URL="postgresql://..."
# Install config # Install config (project scope)
cp 04-mcp/github-mcp.json ~/.claude/mcp.json cp 05-mcp/github-mcp.json .mcp.json
# Or user scope: add to ~/.claude.json
``` ```
### Skills ### Hooks
```bash ```bash
# Personal skills # Install hooks
cp -r 05-skills/code-review ~/.claude/skills/ mkdir -p ~/.claude/hooks
cp 06-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh
# Project skills # Configure in settings (~/.claude/settings.json)
cp -r 05-skills/code-review .claude/skills/
``` ```
### Plugins ### Plugins
@@ -61,24 +73,14 @@ cp -r 05-skills/code-review .claude/skills/
/plugin install documentation /plugin install documentation
``` ```
### Hooks
```bash
# Install hooks
mkdir -p ~/.claude/hooks
cp 07-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh
# Configure in settings (.claude/settings.json)
```
### Checkpoints ### Checkpoints
```bash ```bash
# Checkpoints are auto-enabled # Checkpoints are created automatically with every user prompt
# Use commands: # To rewind, press Esc twice or use:
/checkpoint save "description" /rewind
/checkpoint list
/checkpoint rewind "checkpoint-name" # Then choose: Restore code and conversation, Restore conversation,
/checkpoint diff checkpoint-1 checkpoint-2 # Restore code, Summarize from here, or Never mind
``` ```
### Advanced Features ### Advanced Features
@@ -89,20 +91,19 @@ chmod +x ~/.claude/hooks/*.sh
# Planning mode # Planning mode
/plan Task description /plan Task description
# Permission modes # Permission modes (use --permission-mode flag)
/permission readonly # default - Ask for approval on risky actions
/permission confirm # acceptEdits - Auto-accept file edits, ask for others
/permission unrestricted # plan - Read-only analysis, no modifications
# dontAsk - Accept all actions except risky ones
# bypassPermissions - Accept all actions (requires --dangerously-skip-permissions)
# Session management # Session management
/session list /resume # Resume a previous conversation
/session new "name" /rename "name" # Name the current session
/session switch "name" /fork # Fork the current session
claude -c # Continue most recent conversation
# Background tasks claude -r "session" # Resume session by name/ID
Run command in background
/task list
/task status task-id
``` ```
--- ---
@@ -112,17 +113,22 @@ Run command in background
| Feature | Install Path | Usage | | Feature | Install Path | Usage |
|---------|-------------|-------| |---------|-------------|-------|
| **Slash Commands** | `.claude/commands/*.md` | `/command-name` | | **Slash Commands** | `.claude/commands/*.md` | `/command-name` |
| **Subagents** | `.claude/agents/*.md` | Auto-delegated |
| **Memory** | `./CLAUDE.md` | Auto-loaded | | **Memory** | `./CLAUDE.md` | Auto-loaded |
| **MCP** | `.claude/mcp.json` | `/mcp__server__action` |
| **Skills** | `.claude/skills/*/SKILL.md` | Auto-invoked | | **Skills** | `.claude/skills/*/SKILL.md` | Auto-invoked |
| **Plugins** | Via `/plugin install` | Bundles all | | **Subagents** | `.claude/agents/*.md` | Auto-delegated |
| **MCP** | `.mcp.json` (project) or `~/.claude.json` (user) | `/mcp__server__action` |
| **Hooks** | `~/.claude/hooks/*.sh` | Event-triggered | | **Hooks** | `~/.claude/hooks/*.sh` | Event-triggered |
| **Checkpoints** | Built-in | `/checkpoint <command>` | | **Plugins** | Via `/plugin install` | Bundles all |
| **Checkpoints** | Built-in | `Esc+Esc` or `/rewind` |
| **Planning Mode** | Built-in | `/plan <task>` | | **Planning Mode** | Built-in | `/plan <task>` |
| **Permission Modes** | Built-in | `/permission <mode>` | | **Permission Modes** | Built-in | `--allowedTools`, `--permission-mode` |
| **Sessions** | Built-in | `/session <command>` | | **Sessions** | Built-in | `/session <command>` |
| **Background Tasks** | Built-in | Run in background | | **Background Tasks** | Built-in | Run in background |
| **Remote Control** | Built-in | WebSocket API |
| **Web Sessions** | Built-in | `claude web` |
| **Git Worktrees** | Built-in | `/worktree` |
| **Auto Memory** | Built-in | Auto-saves to CLAUDE.md |
| **Task List** | Built-in | `/task list` |
--- ---
@@ -135,11 +141,11 @@ cp 01-slash-commands/optimize.md .claude/commands/
# Use: /optimize # Use: /optimize
# Method 2: Subagent # Method 2: Subagent
cp 02-subagents/code-reviewer.md .claude/agents/ cp 04-subagents/code-reviewer.md .claude/agents/
# Use: Auto-delegated # Use: Auto-delegated
# Method 3: Skill # Method 3: Skill
cp -r 05-skills/code-review ~/.claude/skills/ cp -r 03-skills/code-review ~/.claude/skills/
# Use: Auto-invoked # Use: Auto-invoked
# Method 4: Plugin (best) # Method 4: Plugin (best)
@@ -153,10 +159,10 @@ cp -r 05-skills/code-review ~/.claude/skills/
cp 01-slash-commands/generate-api-docs.md .claude/commands/ cp 01-slash-commands/generate-api-docs.md .claude/commands/
# Subagent # Subagent
cp 02-subagents/documentation-writer.md .claude/agents/ cp 04-subagents/documentation-writer.md .claude/agents/
# Skill # Skill
cp -r 05-skills/doc-generator ~/.claude/skills/ cp -r 03-skills/doc-generator ~/.claude/skills/
# Plugin (complete solution) # Plugin (complete solution)
/plugin install documentation /plugin install documentation
@@ -173,7 +179,7 @@ cp -r 05-skills/doc-generator ~/.claude/skills/
### Team Standards ### Team Standards
```bash ```bash
# Project memory # Project memory
cp 03-memory/project-CLAUDE.md ./CLAUDE.md cp 02-memory/project-CLAUDE.md ./CLAUDE.md
# Edit for your team # Edit for your team
vim CLAUDE.md vim CLAUDE.md
@@ -183,7 +189,7 @@ vim CLAUDE.md
```bash ```bash
# Install hooks # Install hooks
mkdir -p ~/.claude/hooks mkdir -p ~/.claude/hooks
cp 07-hooks/*.sh ~/.claude/hooks/ cp 06-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh chmod +x ~/.claude/hooks/*.sh
# Examples: # Examples:
@@ -194,13 +200,10 @@ chmod +x ~/.claude/hooks/*.sh
### Safe Refactoring ### Safe Refactoring
```bash ```bash
# Use checkpoints for safe experimentation # Checkpoints are created automatically before each prompt
/checkpoint save "Before refactoring"
# Try refactoring # Try refactoring
# If it works: continue # If it works: continue
# If it fails: # If it fails: press Esc+Esc or use /rewind to go back
/checkpoint rewind "Before refactoring"
``` ```
### Complex Implementation ### Complex Implementation
@@ -215,8 +218,11 @@ chmod +x ~/.claude/hooks/*.sh
### CI/CD Integration ### CI/CD Integration
```bash ```bash
# Run in headless mode # Run in headless mode (non-interactive)
claude-code --headless --task "Run all tests and generate report" claude -p "Run all tests and generate report"
# With permission mode for CI
claude -p "Run tests" --permission-mode dontAsk
# With hooks for automation # With hooks for automation
# See 09-advanced-features/README.md # See 09-advanced-features/README.md
@@ -224,14 +230,11 @@ claude-code --headless --task "Run all tests and generate report"
### Learning & Experimentation ### Learning & Experimentation
```bash ```bash
# Use permission mode # Use plan mode for safe analysis
/permission confirm claude --permission-mode plan
# Use checkpoints # Experiment safely - checkpoints are created automatically
/checkpoint save "Before experiment" # If you need to rewind: press Esc+Esc or use /rewind
# Experiment safely
# Rewind if needed
``` ```
--- ---
@@ -244,22 +247,22 @@ Your Project/
│ ├── commands/ # Slash commands go here │ ├── commands/ # Slash commands go here
│ ├── agents/ # Subagents go here │ ├── agents/ # Subagents go here
│ ├── skills/ # Project skills go here │ ├── skills/ # Project skills go here
── mcp.json # MCP configuration ── settings.json # Project settings (hooks, etc.)
│ └── settings.json # Project settings (hooks, checkpoints, etc.) ├── .mcp.json # MCP configuration (project scope)
├── CLAUDE.md # Project memory ├── CLAUDE.md # Project memory
└── src/ └── src/
└── api/ └── api/
└── CLAUDE.md # Directory-specific memory └── CLAUDE.md # Directory-specific memory
User Home/ User Home/
── .claude/ ── .claude/
├── commands/ # Personal commands ├── commands/ # Personal commands
├── agents/ # Personal agents ├── agents/ # Personal agents
├── skills/ # Personal skills ├── skills/ # Personal skills
├── hooks/ # Hook scripts ├── hooks/ # Hook scripts
├── mcp.json # Personal MCP config ├── settings.json # User settings
── settings.json # User settings ── CLAUDE.md # Personal memory
└── CLAUDE.md # Personal memory └── .claude.json # Personal MCP config (user scope)
``` ```
--- ---
@@ -268,23 +271,27 @@ User Home/
### By Category ### By Category
- **Slash Commands**: `01-slash-commands/` - **Slash Commands**: `01-slash-commands/`
- **Subagents**: `02-subagents/` - **Memory**: `02-memory/`
- **Memory**: `03-memory/` - **Skills**: `03-skills/`
- **MCP**: `04-mcp/` - **Subagents**: `04-subagents/`
- **Skills**: `05-skills/` - **MCP**: `05-mcp/`
- **Plugins**: `06-plugins/` - **Hooks**: `06-hooks/`
- **Plugins**: `07-plugins/`
- **Checkpoints**: `08-checkpoints/`
- **Advanced Features**: `09-advanced-features/`
- **CLI**: `10-cli/`
### By Use Case ### By Use Case
- **Performance**: `01-slash-commands/optimize.md` - **Performance**: `01-slash-commands/optimize.md`
- **Security**: `02-subagents/secure-reviewer.md` - **Security**: `04-subagents/secure-reviewer.md`
- **Testing**: `02-subagents/test-engineer.md` - **Testing**: `04-subagents/test-engineer.md`
- **Docs**: `05-skills/doc-generator/` - **Docs**: `03-skills/doc-generator/`
- **DevOps**: `06-plugins/devops-automation/` - **DevOps**: `07-plugins/devops-automation/`
### By Complexity ### By Complexity
- **Simple**: Slash commands - **Simple**: Slash commands
- **Medium**: Subagents, Memory - **Medium**: Subagents, Memory
- **Advanced**: Skills - **Advanced**: Skills, Hooks
- **Complete**: Plugins - **Complete**: Plugins
--- ---
@@ -306,18 +313,18 @@ cp 01-slash-commands/optimize.md .claude/commands/
### Day 2-3 ### Day 2-3
```bash ```bash
# Set up memory # Set up memory
cp 03-memory/project-CLAUDE.md ./CLAUDE.md cp 02-memory/project-CLAUDE.md ./CLAUDE.md
vim CLAUDE.md vim CLAUDE.md
# Install subagent # Install subagent
cp 02-subagents/code-reviewer.md .claude/agents/ cp 04-subagents/code-reviewer.md .claude/agents/
``` ```
### Day 4-5 ### Day 4-5
```bash ```bash
# Set up MCP # Set up MCP
export GITHUB_TOKEN="your_token" export GITHUB_TOKEN="your_token"
cp 04-mcp/github-mcp.json .claude/mcp.json cp 05-mcp/github-mcp.json .mcp.json
# Try MCP commands # Try MCP commands
/mcp__github__list_prs /mcp__github__list_prs
@@ -326,7 +333,7 @@ cp 04-mcp/github-mcp.json .claude/mcp.json
### Week 2 ### Week 2
```bash ```bash
# Install skill # Install skill
cp -r 05-skills/code-review ~/.claude/skills/ cp -r 03-skills/code-review ~/.claude/skills/
# Let it auto-invoke # Let it auto-invoke
# Just say: "Review this code for issues" # Just say: "Review this code for issues"
@@ -345,7 +352,21 @@ cp -r 05-skills/code-review ~/.claude/skills/
--- ---
## 💡 Tips & Tricks ## New Features (February 2026)
| Feature | Description | Usage |
|---------|-------------|-------|
| **Remote Control** | Control Claude Code via WebSocket API | `claude --remote` for external integrations |
| **Web Sessions** | Browser-based Claude Code interface | `claude web` to launch |
| **Desktop App** | Native desktop application | Download from claude.ai/download |
| **Task List** | Manage background tasks | `/task list`, `/task status <id>` |
| **Auto Memory** | Automatic memory saving from conversations | Claude auto-saves key context to CLAUDE.md |
| **Git Worktrees** | Isolated workspaces for parallel development | `/worktree` to create isolated workspace |
| **Model Selection** | Switch between Sonnet 4.6 and Opus 4.6 | `/model` or `--model` flag |
---
## Tips & Tricks
### Customization ### Customization
- Start with examples as-is - Start with examples as-is
@@ -379,11 +400,14 @@ echo $GITHUB_TOKEN
| Need | Use This | Example | | Need | Use This | Example |
|------|----------|---------| |------|----------|---------|
| Quick shortcut | Slash Command | `01-slash-commands/optimize.md` | | Quick shortcut | Slash Command | `01-slash-commands/optimize.md` |
| Specialized task | Subagent | `02-subagents/code-reviewer.md` | | Team standards | Memory | `02-memory/project-CLAUDE.md` |
| Team standards | Memory | `03-memory/project-CLAUDE.md` | | Auto workflow | Skill | `03-skills/code-review/` |
| External data | MCP | `04-mcp/github-mcp.json` | | Specialized task | Subagent | `04-subagents/code-reviewer.md` |
| Auto workflow | Skill | `05-skills/code-review/` | | External data | MCP | `05-mcp/github-mcp.json` |
| Complete solution | Plugin | `06-plugins/pr-review/` | | Event automation | Hook | `06-hooks/pre-commit.sh` |
| Complete solution | Plugin | `07-plugins/pr-review/` |
| Safe experiment | Checkpoint | `08-checkpoints/checkpoint-examples.md` |
| CI/CD pipeline | CLI | `10-cli/README.md` |
--- ---
+75 -57
View File
@@ -309,15 +309,13 @@ cp 04-subagents/*.md /path/to/project/.claude/agents/
export GITHUB_TOKEN="your_token" export GITHUB_TOKEN="your_token"
export DATABASE_URL="postgresql://..." export DATABASE_URL="postgresql://..."
# Copy configuration # Add MCP server via CLI
cp 05-mcp/github-mcp.json ~/.claude/mcp.json claude mcp add github -- npx -y @modelcontextprotocol/server-github
# Or add to project .mcp.json manually (see 05-mcp/ for examples)
``` ```
**Usage**: **Usage**: MCP tools are automatically available to Claude once configured
```
/mcp__github__list_prs
/mcp__github__get_pr 456
```
--- ---
@@ -340,23 +338,30 @@ cp 05-mcp/github-mcp.json ~/.claude/mcp.json
mkdir -p ~/.claude/hooks mkdir -p ~/.claude/hooks
cp 06-hooks/*.sh ~/.claude/hooks/ cp 06-hooks/*.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/*.sh chmod +x ~/.claude/hooks/*.sh
```
# Configure in settings Configure hooks in `~/.claude/settings.json`:
echo '{ ```json
{
"hooks": { "hooks": {
"PreToolUse:Write": "~/.claude/hooks/format-code.sh ${file_path}", "PreToolUse": [{
"PostToolUse:Write": "~/.claude/hooks/security-scan.sh ${file_path}", "matcher": "Write",
"PreCommit": "~/.claude/hooks/pre-commit.sh" "hooks": ["~/.claude/hooks/format-code.sh"]
}],
"PostToolUse": [{
"matcher": "Write",
"hooks": ["~/.claude/hooks/security-scan.sh"]
}]
} }
}' > ~/.claude/hooks-config.json }
``` ```
**Usage**: Hooks execute automatically on events **Usage**: Hooks execute automatically on events
**Hook Types**: **Hook Types**:
- **Tool Hooks**: `PreToolUse:*`, `PostToolUse:*` - **Tool Hooks**: `PreToolUse:*`, `PostToolUse:*`
- **Session Hooks**: `UserPromptSubmit`, `SessionStart`, `SessionEnd` - **Session Hooks**: `Stop`, `SubagentStop`, `SubagentStart`
- **Git Hooks**: `PreCommit`, `PostCommit`, `PrePush` - **Lifecycle Hooks**: `Notification`, `ConfigChange`, `WorktreeCreate`, `WorktreeRemove`
--- ---
@@ -395,17 +400,16 @@ echo '{
**Usage**: **Usage**:
``` ```
# Create checkpoint # Checkpoints are created automatically with every user prompt
/checkpoint save "Before refactoring" # To rewind, press Esc twice or use:
/rewind
# List checkpoints # Then choose from five options:
/checkpoint list # 1. Restore code and conversation
# 2. Restore conversation
# Rewind to checkpoint # 3. Restore code
/checkpoint rewind "Before refactoring" # 4. Summarize from here
# 5. Never mind
# Compare checkpoints
/checkpoint diff checkpoint-1 checkpoint-2
``` ```
**Use Cases**: **Use Cases**:
@@ -417,10 +421,10 @@ echo '{
**Example Workflow**: **Example Workflow**:
``` ```
1. /checkpoint save "Working state" 1. Work normally (checkpoints are created automatically)
2. Try experimental approach 2. Try experimental approach
3. If it works: Continue 3. If it works: Continue
4. If it fails: /checkpoint rewind "Working state" 4. If it fails: Press Esc+Esc or /rewind to go back
``` ```
--- ---
@@ -446,11 +450,16 @@ User: Approve and proceed
### Extended Thinking ### Extended Thinking
Deep reasoning for complex problems: Deep reasoning for complex problems. Toggle with `Alt+T` / `Option+T`, or set `MAX_THINKING_TOKENS` environment variable:
``` ```bash
User: /think Should we use microservices or monolith? # Toggle in-session: press Alt+T (Option+T on macOS)
Claude: [Analyzes trade-offs systematically] # Or set via environment variable
MAX_THINKING_TOKENS=10000 claude
# Then ask complex questions
User: Should we use microservices or monolith?
Claude: [Analyzes trade-offs systematically with extended reasoning]
``` ```
**Benefits**: Better architectural decisions, thorough analysis **Benefits**: Better architectural decisions, thorough analysis
@@ -471,22 +480,23 @@ Claude: Started bg-1234, you can continue working
### Permission Modes ### Permission Modes
Control what Claude can do: Control what Claude can do:
- **Unrestricted**: Full access (default) - **`default`**: Standard permissions with confirmation prompts
- **Confirm**: Ask before actions - **`acceptEdits`**: Auto-accept file edits, confirm other actions
- **Read-only**: Analysis only, no modifications - **`plan`**: Analysis and planning only, no modifications
- **Custom**: Granular permissions - **`dontAsk`**: Accept all actions without confirmation
- **`bypassPermissions`**: Skip all permission checks (dangerous)
``` ```bash
/permission readonly # Code review mode claude --permission-mode plan # Code review mode
/permission confirm # Learning mode claude --permission-mode acceptEdits # Learning mode
/permission unrestricted # Full automation claude --permission-mode default # Standard mode
``` ```
### Headless Mode ### Headless Mode
Run Claude Code in CI/CD and automation: Run Claude Code in CI/CD and automation:
```bash ```bash
claude-code --headless --task "Run tests and generate report" claude -p "Run tests and generate report"
``` ```
**Use Cases**: CI/CD, automated reviews, batch processing **Use Cases**: CI/CD, automated reviews, batch processing
@@ -494,11 +504,12 @@ claude-code --headless --task "Run tests and generate report"
### Session Management ### Session Management
Manage multiple work sessions: Manage multiple work sessions:
``` ```bash
/session list # Show all sessions /resume # Resume a previous session interactively
/session new "Feature" # Create new session /rename # Rename the current session
/session switch "Bug" # Switch sessions /fork # Fork the current session
/session save # Save current state claude -c # Continue the most recent session
claude -r "session" # Resume a session matching the query
``` ```
### Interactive Features ### Interactive Features
@@ -511,14 +522,22 @@ Manage multiple work sessions:
### Configuration ### Configuration
Customize Claude Code behavior: Customize Claude Code behavior in `~/.claude/settings.json`:
```json ```json
{ {
"planning": { "autoEnter": true }, "permissions": {
"extendedThinking": { "enabled": true }, "allow": ["Read", "Glob", "Grep", "Bash(git *)"],
"backgroundTasks": { "maxConcurrentTasks": 5 }, "deny": ["Bash(rm -rf *)"]
"permissions": { "mode": "unrestricted" }, },
"checkpoints": { "autoCheckpoint": true } "hooks": {
"PreToolUse": [{
"matcher": "Write",
"hooks": ["~/.claude/hooks/format-code.sh"]
}]
},
"env": {
"MAX_THINKING_TOKENS": "10000"
}
} }
``` ```
@@ -652,7 +671,7 @@ cp 04-subagents/*.md .claude/agents/
# MCP # MCP
export GITHUB_TOKEN="token" export GITHUB_TOKEN="token"
cp 05-mcp/github-mcp.json .claude/mcp.json claude mcp add github -- npx -y @modelcontextprotocol/server-github
# Hooks # Hooks
mkdir -p ~/.claude/hooks mkdir -p ~/.claude/hooks
@@ -827,9 +846,8 @@ For detailed testing guidelines, see [TESTING.md](.github/TESTING.md).
## Additional Resources ## Additional Resources
- [Claude Code Documentation](https://docs.claude.com/en/docs/claude-code) - [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code)
- [MCP Protocol Specification](https://modelcontextprotocol.io) - [MCP Protocol Specification](https://modelcontextprotocol.io)
- [Plugin Marketplace](https://plugins.claude.com)
- [Skills Repository](https://github.com/luongnv89/skills) - Collection of ready-to-use skills - [Skills Repository](https://github.com/luongnv89/skills) - Collection of ready-to-use skills
- [Anthropic Cookbook](https://github.com/anthropics/anthropic-cookbook) - [Anthropic Cookbook](https://github.com/anthropics/anthropic-cookbook)
- [Boris Cherny's Claude Code Workflow](https://x.com/bcherny/status/2007179832300581177) - The creator of Claude Code shares his systematized workflow: parallel agents, shared CLAUDE.md, Plan mode, slash commands, subagents, and verification hooks for autonomous long-running sessions. Key insights include turning recurring workflows into reusable commands and wiring Claude into team tools (GitHub, Slack, BigQuery, Sentry) for end-to-end work with feedback loops. - [Boris Cherny's Claude Code Workflow](https://x.com/bcherny/status/2007179832300581177) - The creator of Claude Code shares his systematized workflow: parallel agents, shared CLAUDE.md, Plan mode, slash commands, subagents, and verification hooks for autonomous long-running sessions. Key insights include turning recurring workflows into reusable commands and wiring Claude into team tools (GitHub, Slack, BigQuery, Sentry) for end-to-end work with feedback loops.
@@ -915,6 +933,6 @@ Thanks to everyone who has contributed to this project!
--- ---
**Last Updated**: January 2026 **Last Updated**: February 2026
**Claude Code Version**: 1.0+ **Claude Code Version**: 2.1+
**Compatible Models**: Claude Sonnet 4.5, Claude Opus 4.5, Claude Haiku 4.5 **Compatible Models**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5
+153 -121
View File
@@ -557,30 +557,50 @@ graph TB
A -->|Uses context| C A -->|Uses context| C
``` ```
### Memory Hierarchy in Claude Code ### Memory Hierarchy in Claude Code (7 Tiers)
Claude Code loads memory from 7 tiers, listed from highest to lowest priority:
```mermaid ```mermaid
graph TD graph TD
A["Project Root"] -->|searches up| B["CLAUDE.md"] A["1. Managed Policy<br/>Enterprise admin policies"] --> B["2. Project Memory<br/>./CLAUDE.md"]
B -->|highest priority| B1["Global instructions"] B --> C["3. Project Rules<br/>.claude/rules/*.md"]
A -->|searches down| C["Subdirectory CLAUDE.md"] C --> D["4. User Memory<br/>~/.claude/CLAUDE.md"]
C -->|specific overrides| C1["Directory-specific rules"] D --> E["5. User Rules<br/>~/.claude/rules/*.md"]
H["User Home"] -->|fallback| D["~/.claude/CLAUDE.md"] E --> F["6. Local Memory<br/>.claude/local/CLAUDE.md"]
D -->|personal preferences| D1["Personal settings"] F --> G["7. Auto Memory<br/>Automatically captured preferences"]
B1 -->|imports| E["@docs/architecture.md"] style A fill:#fce4ec,stroke:#333,color:#333
E -->|imports| F["@docs/api-standards.md"] style B fill:#e1f5fe,stroke:#333,color:#333
style C fill:#e1f5fe,stroke:#333,color:#333
style D fill:#f3e5f5,stroke:#333,color:#333
style E fill:#f3e5f5,stroke:#333,color:#333
style F fill:#e8f5e9,stroke:#333,color:#333
style G fill:#fff3e0,stroke:#333,color:#333
``` ```
### Memory Locations Table ### Memory Locations Table
| Location | Scope | Priority | Shared | Access | Best For | | Tier | Location | Scope | Priority | Shared | Best For |
|----------|-------|----------|--------|--------|----------| |------|----------|-------|----------|--------|----------|
| `./CLAUDE.md` | Project | High | Team | Git | Team standards, shared architecture | | 1. Managed Policy | Enterprise admin | Organization | Highest | All org users | Compliance, security policies |
| `./.claude/CLAUDE.md` | Project | High | Team | Git | Alternative project location | | 2. Project | `./CLAUDE.md` | Project | High | Team (Git) | Team standards, architecture |
| `./subdir/CLAUDE.md` | Directory | Medium | Team | Git | Directory-specific rules | | 3. Project Rules | `.claude/rules/*.md` | Project | High | Team (Git) | Modular project conventions |
| `~/.claude/CLAUDE.md` | Personal | Low | Individual | Filesystem | Personal preferences | | 4. User | `~/.claude/CLAUDE.md` | Personal | Medium | Individual | Personal preferences |
| `~/.claude/my-project.md` | Personal | Low | Individual | Import | Project-specific personal notes | | 5. User Rules | `~/.claude/rules/*.md` | Personal | Medium | Individual | Personal rule modules |
| 6. Local | `.claude/local/CLAUDE.md` | Local | Low | Not shared | Machine-specific settings |
| 7. Auto Memory | Automatic | Session | Lowest | Individual | Learned preferences, patterns |
### Auto Memory
Auto Memory automatically captures user preferences and patterns observed during sessions. Claude learns from your interactions and remembers:
- Coding style preferences
- Common corrections you make
- Framework and tool choices
- Communication style preferences
Auto Memory works in the background and does not require manual configuration.
### Memory Update Lifecycle ### Memory Update Lifecycle
@@ -996,7 +1016,7 @@ sequenceDiagram
#### Example 1: GitHub MCP Configuration #### Example 1: GitHub MCP Configuration
**File:** `.claude/mcp.json` **File:** `.mcp.json` (project scope) or `~/.claude.json` (user scope)
```json ```json
{ {
@@ -2221,7 +2241,8 @@ config:
``` ```
my-plugin/ my-plugin/
├── plugin.yaml ├── .claude-plugin/
│ └── plugin.json
├── commands/ ├── commands/
│ ├── task-1.md │ ├── task-1.md
│ ├── task-2.md │ ├── task-2.md
@@ -2230,12 +2251,14 @@ my-plugin/
│ ├── specialist-1.md │ ├── specialist-1.md
│ ├── specialist-2.md │ ├── specialist-2.md
│ └── configs/ │ └── configs/
├── mcp/ ├── skills/
│ ├── mcp-config.json │ ├── skill-1.md
│ └── servers/ │ └── skill-2.md
├── hooks/ ├── hooks/
── pre-deploy.js ── hooks.json
│ └── post-merge.js ├── .mcp.json
├── .lsp.json
├── settings.json
├── templates/ ├── templates/
│ └── issue-template.md │ └── issue-template.md
├── scripts/ ├── scripts/
@@ -2252,29 +2275,18 @@ my-plugin/
#### Example 1: PR Review Plugin #### Example 1: PR Review Plugin
**File:** `plugin.yaml` **File:** `.claude-plugin/plugin.json`
```yaml ```json
--- {
name: pr-review "name": "pr-review",
version: "1.0.0" "version": "1.0.0",
description: Complete PR review workflow with security, testing, and docs "description": "Complete PR review workflow with security, testing, and docs",
author: Anthropic "author": {
tags: "name": "Anthropic"
- code-review },
- quality "license": "MIT"
- security }
components:
- type: commands
path: commands/
- type: agents
path: agents/
- type: mcp
path: mcp/
- type: hooks
path: hooks/
---
``` ```
**File:** `commands/review-pr.md` **File:** `commands/review-pr.md`
@@ -2470,7 +2482,7 @@ graph TD
**Steps to publish:** **Steps to publish:**
1. Create plugin structure with all components 1. Create plugin structure with all components
2. Write `plugin.yaml` manifest 2. Write `.claude-plugin/plugin.json` manifest
3. Create `README.md` with documentation 3. Create `README.md` with documentation
4. Test locally with `/plugin install ./my-plugin` 4. Test locally with `/plugin install ./my-plugin`
5. Submit to plugin marketplace 5. Submit to plugin marketplace
@@ -2775,36 +2787,59 @@ graph TD
Hooks are event-driven shell commands that execute automatically in response to Claude Code events. They enable automation, validation, and custom workflows without manual intervention. Hooks are event-driven shell commands that execute automatically in response to Claude Code events. They enable automation, validation, and custom workflows without manual intervention.
### Hook Types ### Hook Events
| Hook Type | Event | Use Cases | | Hook Event | Trigger | Use Cases |
|-----------|-------|-----------| |------------|---------|-----------|
| **Tool Hooks** | PreToolUse:*, PostToolUse:* | Auto-formatting, validation, logging | | **PreToolUse** | Before any tool runs | Validation, approval gates, logging |
| **Session Hooks** | UserPromptSubmit, SessionStart, SessionEnd | Input validation, initialization, cleanup | | **PostToolUse** | After any tool runs | Auto-formatting, notifications, cleanup |
| **Git Hooks** | PreCommit, PostCommit, PrePush | Testing, linting, notifications | | **Stop** | When the main agent stops | Summary generation, cleanup tasks |
| **SubagentStop** | When a subagent stops | Result validation, logging |
| **SubagentStart** | When a subagent starts | Context injection, initialization |
| **Notification** | On notification events | Alerting, external integrations |
| **WorktreeCreate** | When a worktree is created | Environment setup, dependency install |
| **WorktreeRemove** | When a worktree is removed | Cleanup, resource deallocation |
| **ConfigChange** | When configuration changes | Validation, propagation |
### Common Hooks ### Common Hooks
```bash Hooks are configured in `~/.claude/settings.json` (user-level) or `.claude/settings.json` (project-level):
# Pre-commit hook - run tests
PreCommit: "npm test"
# Post-write hook - format code ```json
PostToolUse:Write: "prettier --write ${file_path}" {
"hooks": {
# Pre-tool-use hook - validate "PostToolUse": [
PreToolUse:Edit: "eslint ${file_path}" {
"matcher": "Write",
# User prompt validation "hooks": [
UserPromptSubmit: "~/.claude/hooks/validate-prompt.sh" {
"type": "command",
"command": "prettier --write $CLAUDE_FILE_PATH"
}
]
}
],
"PreToolUse": [
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "eslint $CLAUDE_FILE_PATH"
}
]
}
]
}
}
``` ```
### Hook Variables ### Hook Environment Variables
- `${file_path}` - Path to file being edited/written - `$CLAUDE_FILE_PATH` - Path to file being edited/written
- `${command}` - Command being executed (Bash hooks) - `$CLAUDE_TOOL_NAME` - Name of tool being used
- `${tool_name}` - Name of tool being used - `$CLAUDE_SESSION_ID` - Current session identifier
- `${session_id}` - Current session identifier - `$CLAUDE_PROJECT_DIR` - Project directory path
### Best Practices ### Best Practices
@@ -2837,28 +2872,25 @@ Checkpoints allow you to save conversation state and rewind to previous points,
| **Rewind** | Return to a previous checkpoint, discarding subsequent changes | | **Rewind** | Return to a previous checkpoint, discarding subsequent changes |
| **Branch Point** | Checkpoint from which multiple approaches are explored | | **Branch Point** | Checkpoint from which multiple approaches are explored |
### Commands ### Accessing Checkpoints
Checkpoints are created automatically with every user prompt. To rewind:
```bash ```bash
# Create checkpoint # Press Esc twice to open the checkpoint browser
/checkpoint save "Before refactoring" Esc + Esc
# List checkpoints # Or use the /rewind command
/checkpoint list /rewind
# Rewind to checkpoint
/checkpoint rewind "Before refactoring"
# Compare checkpoints
/checkpoint diff checkpoint-1 checkpoint-2
# Delete checkpoint
/checkpoint delete checkpoint-1
# Export checkpoint
/checkpoint export "name" ~/checkpoints/backup.json
``` ```
When you select a checkpoint, you choose from five options:
1. **Restore code and conversation** -- Revert both to that point
2. **Restore conversation** -- Rewind messages, keep current code
3. **Restore code** -- Revert files, keep conversation
4. **Summarize from here** -- Compress conversation into a summary
5. **Never mind** -- Cancel
### Use Cases ### Use Cases
| Scenario | Workflow | | Scenario | Workflow |
@@ -2872,12 +2904,7 @@ Checkpoints allow you to save conversation state and rewind to previous points,
```json ```json
{ {
"checkpoints": { "autoCheckpoint": true
"autoCheckpoint": true,
"autoCheckpointInterval": 30,
"maxCheckpoints": 20,
"compressionEnabled": true
}
} }
``` ```
@@ -2907,8 +2934,13 @@ Create detailed implementation plans before coding.
Deep reasoning for complex problems. Deep reasoning for complex problems.
**Activation:** **Activation:**
- Toggle with `Alt+T` (or `Option+T` on macOS) during a session
- Set `MAX_THINKING_TOKENS` environment variable for programmatic control
```bash ```bash
/think Should we use microservices or monolith? # Enable extended thinking via environment variable
export MAX_THINKING_TOKENS=50000
claude -p "Should we use microservices or monolith?"
``` ```
**Benefits:** **Benefits:**
@@ -2939,33 +2971,37 @@ Control what Claude can do.
| Mode | Description | Use Case | | Mode | Description | Use Case |
|------|-------------|----------| |------|-------------|----------|
| **Unrestricted** | Full access (default) | Active development | | **default** | Standard permissions with prompts for sensitive actions | General development |
| **Confirm** | Ask before actions | Learning, pair programming | | **acceptEdits** | Automatically accept file edits without confirmation | Trusted editing workflows |
| **Read-only** | Analysis only | Code review | | **plan** | Analysis and planning only, no file modifications | Code review, architecture planning |
| **Custom** | Granular permissions | Fine-tuned control | | **dontAsk** | Execute all actions without confirmation prompts | Experienced users, automation |
| **bypassPermissions** | Full unrestricted access, no safety checks | CI/CD pipelines, trusted scripts |
**Commands:** **Usage:**
```bash ```bash
/permission readonly # Code review mode claude --permission-mode plan # Read-only analysis
/permission confirm # Learning mode claude --permission-mode acceptEdits # Auto-accept edits
/permission unrestricted # Full automation claude --permission-mode dontAsk # No confirmation prompts
``` ```
### Headless Mode ### Headless Mode (Print Mode)
Run Claude Code without interactive input for automation and CI/CD. Run Claude Code without interactive input for automation and CI/CD using the `-p` (print) flag.
**Usage:** **Usage:**
```bash ```bash
# Run specific task # Run specific task
claude-code --headless --task "Run all tests" claude -p "Run all tests"
# From script file # Pipe input for analysis
claude-code --headless --script ./deploy.claude cat error.log | claude -p "explain this error"
# CI/CD integration (GitHub Actions) # CI/CD integration (GitHub Actions)
- name: AI Code Review - name: AI Code Review
run: claude-code --headless --task "Review PR" run: claude -p "Review PR changes and report issues"
# JSON output for scripting
claude -p --output-format json "list all functions in src/"
``` ```
### Session Management ### Session Management
@@ -2974,11 +3010,11 @@ Manage multiple work sessions.
**Commands:** **Commands:**
```bash ```bash
/session list # Show all sessions /resume # Resume a previous conversation
/session new "Feature" # Create new session /rename "Feature" # Name the current session
/session switch "Bug" # Switch sessions /fork # Fork into a new session
/session save # Save current state claude -c # Continue most recent conversation
/session load "name" # Load saved session claude -r "Feature" # Resume session by name/ID
``` ```
### Interactive Features ### Interactive Features
@@ -3016,11 +3052,7 @@ Complete configuration example:
"maxConcurrentTasks": 5 "maxConcurrentTasks": 5
}, },
"permissions": { "permissions": {
"mode": "unrestricted" "mode": "default"
},
"headless": {
"exitOnError": true,
"verbose": true
} }
} }
``` ```
@@ -3031,13 +3063,13 @@ Complete configuration example:
## Resources ## Resources
- [Claude Documentation](https://docs.claude.com) - [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code)
- [Anthropic Documentation](https://docs.anthropic.com)
- [MCP GitHub Servers](https://github.com/modelcontextprotocol/servers) - [MCP GitHub Servers](https://github.com/modelcontextprotocol/servers)
- [Anthropic Cookbook](https://github.com/anthropics/anthropic-cookbook) - [Anthropic Cookbook](https://github.com/anthropics/anthropic-cookbook)
- [Claude Code Guide](https://docs.claude.com/en/docs/claude-code/overview)
--- ---
*Last updated: November 8, 2025* *Last updated: February 2026*
*For Claude Haiku 4.5, Sonnet 4.5, and Opus 4.1* *For Claude Haiku 4.5, Sonnet 4.6, and Opus 4.6*
*Now includes: Hooks, Checkpoints, Planning Mode, Extended Thinking, Background Tasks, Permission Modes, Headless Mode, and Session Management* *Now includes: Hooks, Checkpoints, Planning Mode, Extended Thinking, Background Tasks, Permission Modes, Headless Mode, Session Management, and Auto Memory*
+30
View File
@@ -5,6 +5,19 @@
# List of good resources # List of good resources
## Official Documentation
| Resource | Description | Link |
|----------|-------------|------|
| Claude Code Docs | Official Claude Code documentation | [docs.anthropic.com/en/docs/claude-code](https://docs.anthropic.com/en/docs/claude-code) |
| Anthropic Docs | Full Anthropic documentation | [docs.anthropic.com](https://docs.anthropic.com) |
| MCP Protocol | Model Context Protocol specification | [modelcontextprotocol.io](https://modelcontextprotocol.io) |
| MCP Servers | Official MCP server implementations | [github.com/modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) |
| Anthropic Cookbook | Code examples and tutorials | [github.com/anthropics/anthropic-cookbook](https://github.com/anthropics/anthropic-cookbook) |
| Claude Code Skills | Community skills repository | [github.com/anthropics/claude-code-skills](https://github.com/anthropics/claude-code-skills) |
---
## Mastering Claude Code in 30 Minutes ## Mastering Claude Code in 30 Minutes
_Video_: https://www.youtube.com/watch?v=6eBSHbLKuN0 _Video_: https://www.youtube.com/watch?v=6eBSHbLKuN0
@@ -197,3 +210,20 @@ graph TD
- Regularly clean up sessions, prune context, and remove completed worktrees to avoid clutter. - Regularly clean up sessions, prune context, and remove completed worktrees to avoid clutter.
These steps capture the core recommendations for smooth workflows with Claude Code in both new and existing codebases. These steps capture the core recommendations for smooth workflows with Claude Code in both new and existing codebases.
---
## New Features & Capabilities (February 2026)
### Key Feature Resources
| Feature | Description | Learn More |
|---------|-------------|------------|
| **Auto Memory** | Claude automatically learns and remembers your preferences across sessions | [Memory Guide](02-memory/) |
| **Remote Control** | Programmatically control Claude Code sessions from external tools and scripts | [Advanced Features](09-advanced-features/) |
| **Web Sessions** | Access Claude Code through browser-based interfaces for remote development | [CLI Reference](10-cli/) |
| **Desktop App** | Native desktop application for Claude Code with enhanced UI | [Claude Code Docs](https://docs.anthropic.com/en/docs/claude-code) |
| **Extended Thinking** | Deep reasoning toggle via `Alt+T`/`Option+T` or `MAX_THINKING_TOKENS` env var | [Advanced Features](09-advanced-features/) |
| **Permission Modes** | Fine-grained control: default, acceptEdits, plan, dontAsk, bypassPermissions | [Advanced Features](09-advanced-features/) |
| **7-Tier Memory** | Managed Policy, Project, Project Rules, User, User Rules, Local, Auto Memory | [Memory Guide](02-memory/) |
| **Hook Events** | PreToolUse, PostToolUse, Stop, SubagentStop, SubagentStart, Notification, and more | [Hooks Guide](06-hooks/) |