Claude Code Features
The full feature set of Claude Code 2.x, from checkpoints to agent teams.
Checkpoints
Claude Code auto-saves a checkpoint before every file change. If something goes wrong:
- Esc Esc - undo the last change immediately
/rewind- browse checkpoint history and restore to any point
Checkpoints capture the full state of changed files, so you can experiment freely and roll back without git.
Hooks
Hooks are shell commands that execute at specific points in Claude’s lifecycle. Define them in .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit",
"command": "echo 'About to edit: $TOOL_INPUT'"
}
],
"PostToolUse": [
{
"matcher": "Bash",
"command": "echo 'Ran command, exit code: $EXIT_CODE'"
}
],
"Stop": [
{
"command": "npm run lint --quiet"
}
],
"PostCompact": [
{
"command": "echo 'Context was compacted'"
}
]
}
}
Hook Types
| Hook | When it fires | Use case |
|---|---|---|
| PreToolUse | Before a tool executes | Validate inputs, block dangerous operations |
| PostToolUse | After a tool completes | Log results, trigger side effects |
| Stop | When Claude finishes responding | Run linters, format code, validate output |
| PostCompact | After context compaction | Log, reload critical context |
Hooks in Skills
Skills can define hooks inline in their SKILL.md frontmatter:
---
name: safe-deploy
description: >
Manages production deployments with safety checks.
hooks:
PreToolUse:
- matcher: "Bash"
command: "scripts/validate-no-prod-access.sh"
Stop:
- command: "scripts/deployment-checklist.sh"
---
Subagents
Spawn separate Claude instances for parallel work. Each subagent gets its own context window:
Main Claude
├── Subagent 1: "Review auth module for security"
├── Subagent 2: "Check database queries for N+1 problems"
└── Subagent 3: "Verify API response schemas match docs"
Subagents are useful when:
- Tasks are independent and can run in parallel
- You want to protect the main context from large tool outputs
- Different tasks need different models (e.g., Opus for security review, Sonnet for formatting)
In Claude Code, the Agent tool spawns subagents. In the SDK, use AgentDefinition.
Background Tasks
Run long operations without blocking the conversation:
> Run the full test suite in the background and let me know when it's done
Claude executes the command asynchronously and notifies you on completion. You can continue working on other tasks in the meantime.
Session Teleportation
Move a terminal session to the browser:
/teleport
This generates a URL at claude.ai/code where you can continue the exact same session with full context. Useful for switching from terminal to a device without your dev environment.
Agent Teams
Multiple Claude instances coordinating on a shared task. Unlike subagents (isolated, one-way communication), team members communicate with each other:
Team Lead (Opus 4.6)
├── Teammate 1: "Implement the API endpoints"
├── Teammate 2: "Write the database migrations"
└── Teammate 3: "Create the test suite"
The team lead coordinates, delegates work, and synthesizes results. Teammates can reference each other’s outputs and build on each other’s work.
When to Use Teams vs Subagents
| Subagents | Agent Teams | |
|---|---|---|
| Communication | One-way (main to sub) | Bidirectional |
| Context | Isolated | Shared awareness |
| Coordination | Manual (main agent manages) | Automatic (team lead orchestrates) |
| Best for | Independent parallel tasks | Interdependent collaborative work |
Worktree Isolation
Run agents in isolated git worktrees for safe parallel work:
# In the Agent SDK
agent = AgentDefinition(
name="experimental-refactor",
instructions="Try refactoring the auth module to use JWT",
isolation="worktree", # Gets its own copy of the repo
)
The agent works on a separate branch in a temporary worktree. If it makes useful changes, the worktree path and branch are returned. If not, the worktree is cleaned up automatically.
Wildcard Permissions
Fine-grained permission patterns:
{
"permissions": {
"allow": [
"Bash(npm *)",
"Bash(git *)",
"Bash(*-h*)",
"Bash(cargo test *)",
"Edit(src/**)"
]
}
}
| Pattern | Matches |
|---|---|
Bash(npm *) | Any npm command |
Bash(*-h*) | Any command with help flag |
Edit(src/**) | Edits to any file under src/ |
Bash(git log *) | Git log with any arguments |
Context Compaction
When context fills up, Claude automatically compresses earlier turns:
/compact # Manually trigger compaction
/compact focus on the auth changes # Compact with guidance on what to preserve
Compaction preserves:
- Recent tool outputs and decisions
- Key code changes and their rationale
- User instructions and corrections
It compresses:
- Intermediate search results
- Verbose tool outputs that led to conclusions
- Redundant context from earlier exploration
Next
- Skill patterns - five proven skill patterns
- API deep dive - programmatic access to these features