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

HookWhen it firesUse case
PreToolUseBefore a tool executesValidate inputs, block dangerous operations
PostToolUseAfter a tool completesLog results, trigger side effects
StopWhen Claude finishes respondingRun linters, format code, validate output
PostCompactAfter context compactionLog, 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

SubagentsAgent Teams
CommunicationOne-way (main to sub)Bidirectional
ContextIsolatedShared awareness
CoordinationManual (main agent manages)Automatic (team lead orchestrates)
Best forIndependent parallel tasksInterdependent 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/**)"
    ]
  }
}
PatternMatches
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