Aller au contenu principal

Advanced Features

Output Styles

10 interaction modes in .claude/output-styles/: teaching, explanatory (recommended), concise, technical, review, emoji, minimal, structured, debug, metrics.

Specification Templates

Templates in .claude/templates/ for the Explore → Specify → Plan → TDD → Audit → Commit workflow:

TemplateUsed by
spec-template.md/work:work-specify
plan-template.md/work:work-plan
tasks-template.md/work:work-plan

Structure: specs/[feature]/ contains spec.md, plan.md, tasks.md, clarifications.md (opt).

Conventions: P1=MVP, P2=Important, P3=Nice-to-have, [P]=parallelizable, [US1]=User Story 1.

Proxmox templates (Terraform) available in .claude/templates/proxmox/.

Automatic Memory (CLI 2.1.76+)

Claude Code automatically saves and recalls memories as work progresses (preferences, decisions, project context). Memories are stored in ~/.claude/memory/.

To memorizeTo put in CLAUDE.mdTo put in rules/
Personal preferencesProject conventionsPer-language/framework rules
Architecture decisionsMandatory workflowCode patterns
Team contextDocumentation referencesVerification checklist

Best practices:

  • Let Claude memorize preferences and decisions (avoids repetition)
  • Keep in CLAUDE.md what is shared with the team (versioned in git)
  • Do not duplicate: if it is in CLAUDE.md, no need to memorize it
  • Use "remember that..." to force an explicit memorization

Effort Levels (CLI 2.1.76+)

/effort command to control the reasoning level (interactive slider since v2.1.111):

LevelCommandUse case
low/effort lowExploration, formatting, simple tasks
medium/effort mediumStandard development, fixes
high/effort highArchitecture, audit, complex refactoring, debug
xhigh/effort xhighMaximum reasoning — critical system architecture, advanced security audit (Opus 4.7 required)

Recommendations per foundation workflow:

PhaseRecommended effort
/work:work-explorelow
/work:work-specify, /work:work-planhigh
/dev:dev-tddmedium
/qa:qa-audit, /qa:qa-securityhigh or xhigh
/work:work-commitlow

Named Sessions (CLI 2.1.76+)

--name / -n flag to name a session at startup:

claude --name "feature-auth"
claude -n "fix-login-bug"

Combine with git worktrees for isolated and identifiable sessions:

git worktree add ../myapp-auth -b feature/auth
cd ../myapp-auth && claude -n "auth-feature"

VSCode URI Handler (CLI 2.1.76+)

Open a Claude Code tab programmatically from VSCode:

vscode://anthropic.claude-code/open

Useful for: CI/CD integration, setup scripts, notification hooks.

Opus 4.7

Adaptive Thinking: Claude automatically adjusts the depth of its reasoning based on the complexity of the task. Replaces budget_tokens (deprecated). 4 effort levels (low, medium, high, xhigh) to guide reasoning.

1M token window, 128k output tokens, automatic Context Compaction. Reasoning is interleaved between tool calls (interleaved thinking) for agentic workflows.

New in v2.1.111: xhigh unlocks Opus 4.7's maximum reasoning. Auto mode available for Max subscribers (intelligent automatic permissions).

Checkpoint / Rewind

Claude Code automatically saves the state of the code before each modification (checkpoint). To return to a previous state:

MethodAction
Esc × 2Cancel the last modification and return to the checkpoint
/rewindChoose a specific checkpoint in the history
/undoAlias of /rewind (CLI 2.1.108+)

Recommended in the TDD Refactor phase: if the refactoring breaks the tests, /rewind (or /undo) is faster than a manual git revert.

Session Recap (CLI 2.1.108+)

/recap generates a structured summary of the session: decisions made, files modified, work state. Configurable in /config.

SituationAction
Return after a break/recap to recover the context
After /compact/recap to verify what has been kept
Resumed sessionAutomatic recap on resume (if enabled in /config)

Fast Mode (Research Preview)

Same Opus 4.7 model, 2.5x faster output. Toggle with /fast. Premium cost (see Anthropic pricing).

Use caseRecommendation
Exploration, commits, simple tasksFast mode suitable
Architecture, audit, complex debugStandard mode recommended

Context Compaction

Compaction automatically summarizes the context when the window approaches its limit. Manual trigger with /compact.

CommandEffectWhen to use
/compactSummarizes the context, keeps the essentialsBetween long workflow phases
/clearErases the entire contextTotal topic change
(auto)Automatic compaction if necessaryLong sessions without action required

Associated hooks: PreCompact (before compaction, matcher manual or auto) and PostCompact (after). See docs/reference/hooks-reference.md.

Claude Code Action (GitHub)

Official Anthropic action to integrate Claude into GitHub workflows. Reviews PRs, responds to @claude mentions, implements changes.

ScenarioTriggerTemplate
Automatic PR reviewspull_request: opened, synchronize.claude/templates/github-actions/claude-review.yml
Security review (critical files)pull_request: paths: src/auth/**, src/api/**.claude/templates/github-actions/claude-security-review.yml
@claude mentionissue_comment: @claudeIncluded in claude-review.yml

Prerequisites: an Anthropic API key (pay-per-use) or a cloud provider (Bedrock, Vertex, Foundry). The Max plan (interactive OAuth) does not work in CI/CD.

Quick setup: /install-github-app in Claude Code, or add ANTHROPIC_API_KEY in the GitHub secrets then copy the template into .github/workflows/.

Source: anthropics/claude-code-action

Agent Teams (Experimental)

Parallel coordination of agent teams. Activation: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in .claude/settings.json.

Modes: auto (default), in-process, tmux. Command: /work:work-team "description".

See .claude/skills/agent-teams/SKILL.md for the full documentation.

Subagent reliability (CLI 2.1.113+)

A subagent stuck for more than 10 minutes without progress fails with an explicit error message instead of remaining in a silent hang. Isolated worktrees grant Read/Edit on the files of their own worktree. Permission dialog crashes during tool requests by a teammate are fixed (CLI 2.1.114+).

MCP Configuration

MCP servers in .mcp.json (all disabled by default):

ServerUsage
filesystemAdvanced file access
memoryPersistent memory
githubGitHub integration
postgresPostgreSQL connection
puppeteerBrowser automation
slackTeam communication
sentryError monitoring
linearProject management

To enable: "enabled": true in .mcp.json. Environment variables in .env.

MCP Channels

MCP servers can push messages into a session via --channels. Available through channel plugins (Telegram, Discord, iMessage) that install as MCP servers.

ChannelPluginUsage
Telegramtelegram-channelMessages and commands from Telegram
Discorddiscord-channelMessages from a Discord server
iMessageimessage-channelMessages from iMessage (macOS)
Slackslack (native MCP)Slack notifications and messages

Activation: claude --channels at startup. Channels have access to the filesystem, MCP and git of the local session.

Permission relay: channels declaring the permission capability can relay approval requests to your phone.

MCP Elicitation (CLI 2.1.76+)

MCP servers can request structured input from the user during a task via interactive dialogs. Associated hooks: Elicitation (request) and ElicitationResult (response).

MCP OAuth RFC 9728 (CLI 2.1.85+)

Automatic discovery of Protected Resource Metadata for OAuth MCP servers. Simplifies OAuth 2.1 authentication by exposing the authorization server URL via a standard endpoint. Servers can provide a headersHelper and use the CLAUDE_CODE_MCP_SERVER_NAME and CLAUDE_CODE_MCP_SERVER_URL environment variables.

MCP Step-up Authorization (CLI 2.1.84+)

RFC support for step-up authorization: MCP servers can return a 403 insufficient_scope to trigger a refresh token with an extended scope. Useful for sensitive operations that require reauthentication without breaking the session.

MCP Result Size Override (CLI 2.1.84+)

MCP tools can declare _meta["anthropic/maxResultSizeChars"] (up to 500K) to override the result persistence limit. Useful for tools that return large payloads (exports, reports, diffs).

Async Hooks (CLI 2.1.70+)

"async": true property to run a hook in the background without blocking the session. Recommended for logging and notification hooks. Security hooks (gitleaks, pre-commit tests) must remain synchronous.

HookModeReason
SessionStart, PreToolUse, PostToolUse, SetupsyncCritical actions (security, formatting)
SessionEnd, PreCompact, PostCompact, SubagentStop, NotificationasyncLogging, no impact on the workflow
TeammateIdle, TaskCompleted, InstructionsLoadedasyncObservability, non-blocking
Elicitation, ElicitationResultasyncMCP logging

HTTP Hooks (CLI 2.1.70+)

"http" type to send a JSON POST to an external URL (webhook). Generic webhook configuration example:

{
"type": "http",
"url": "https://your-webhook-url.example.com/hook",
"headers": { "Authorization": "Bearer ${WEBHOOK_TOKEN}" },
"timeout": 5000,
"async": true
}

Recommendations: always async: true and onFailure: "ignore" to avoid blocking the session if the remote service is unavailable.

Claude Code Security (Enterprise/Team)

Vulnerability scanning tool using Opus 4.7 to analyze code beyond traditional static analysis. Reasons about data flows, interactions between components, and architectural patterns.

Prerequisites: Enterprise or Team plan. Complement to /qa:qa-security for an in-depth audit. See Anthropic announcement.

RTK - Token Optimization (optional)

RTK (Rust Token Killer) is a CLI proxy that compresses command outputs before they reach the LLM context. 60-90% reduction in tokens consumed.

Installation: brew install rtk (or cargo install --git https://github.com/rtk-ai/rtk)

The foundation includes a PreToolUse hook that automatically rewrites commands if RTK is installed:

  • git statusrtk git status (~10 tokens instead of ~200)
  • cat file.rsrtk read file.rs (signatures only in aggressive mode)
  • cargo testrtk cargo test (-90% on test outputs)

The hook is transparent: if RTK is not installed, nothing changes. Disable with RTK_DISABLED=1.

Useful commands:

  • rtk gain: see token savings
  • rtk discover: identify unoptimized commands in history

CLAUDE.md @imports

@path/to/file syntax to import files. Relative and absolute paths supported, recursive imports (max 5 levels). View loaded imports with /memory.

Plugins

Ecosystem of community extensions for Claude Code. A plugin can contain skills, agents, hooks and MCP servers.

ActionCommand
Load a local plugin (directory or .zip)claude --plugin-dir ./my-plugin
Load a remote pluginclaude --plugin-url https://example.com/my-plugin.zip
Namespaced skills/my-plugin:skill-name
Plugin executablesFiles in bin/ invocable as Bash commands

Plugins can be distributed via an Anthropic-managed directory. Setting disableSkillShellExecution to disable shell execution in unverified plugins.

Evaluating a plugin before adoption (CLI 2.1.128+)

Both --plugin-dir <path> (local directory or .zip) and --plugin-url <url> (remote .zip) are session-scoped: the plugin is loaded for the current claude invocation only and disappears at session end. They are repeatable, so multiple plugins can be combined for a single trial. This is the foundation's recommended way to validate a plugin against your workflow before requesting it for permanent inclusion in a preset's marketplacePlugins list — consistent with the validation-first policy described in docs/recipes/recommended-vendor-skills.md.

Recipe — try a plugin without committing to it:

  1. Get the plugin. Either clone the repo (git clone <repo>) or download the release .zip to a temp dir.
  2. Validate the manifest. Run claude plugin validate <unzipped-path>. The validator reads <path>/.claude-plugin/plugin.json; pass an unzipped directory, not a .zip (the validator reads the path argument as a JSON file). Confirm at minimum name, version, description are present; author is recommended.
  3. Load it transiently. Either claude --plugin-dir ./plugin/ or claude --plugin-dir ./plugin.zip or claude --plugin-url <url>. The plugin is active for this session only.
  4. Use the plugin in your real workflow. Invoke its skills (/<plugin-name>:<skill>), trigger its hooks, exercise the surface you care about. Take notes.
  5. Cleanup is automatic. Exit the session — no installed state remains. Repeat with --plugin-dir/--plugin-url if you want to compare with another plugin or against the un-augmented baseline.

If after this trial the plugin is worth adopting, raise an issue or pull request against the relevant preset under .claude/presets/ with the validation evidence (the marketplace-audit methodology under specs/marketplace-audit/ describes the bar).

Scheduled Tasks (Cloud)

Recurring jobs executed on Anthropic's cloud infrastructure. Useful for ongoing operational tasks without an active local session.

Use caseDescription
PR reviewsAutomatic review of pull requests
CI monitoringContinuous monitoring of the CI pipeline
Dependency auditsPeriodic audit of dependencies
Doc syncingDocumentation synchronization

Configuration via /tasks, /schedule or the API. Requires a Pro/Max/Team/Enterprise plan.

See also Routines (section above) for more complex automated workflows combining prompts, repos and connectors.

Computer Use

Direct integration in Claude Code (Pro/Max). Allows opening files, launching dev tools, clicking and navigating in the interface without additional setup.

Useful for: visual tests, UI interactions, workflows requiring a browser or emulator.

Routines (CLI 2.1.108+)

Routines are automated workflows that run on Anthropic's cloud infrastructure. A routine combines a prompt, one or more repos, and connectors into a single configuration executable on schedule, via API, or on a GitHub event.

PropertyDescription
PromptThe instructions to execute
ReposOne or more target repositories
ConnectorsMCP servers, GitHub events, API triggers
ExecutionAnthropic cloud — runs even with laptop turned off

Use cases with the foundation:

RoutineDescriptionFoundation equivalent
Automatic PR reviewsReview every new PR/qa:qa-review in cloud version
Periodic auditWeekly security/quality audit/qa:qa-audit in scheduled version
Automatic standupDaily activity summary/ops:ops-standup in cloud version
Dependency checkAudit deps every Monday/ops:ops-deps in scheduled version

Configuration via the Anthropic console or /schedule. Requires a Pro/Max/Team/Enterprise plan.

Ultraplan and Ultrareview (CLI 2.1.101+)

Cloud commands that delegate work to parallel agents on Anthropic's infrastructure.

CommandDescriptionWhen to use
/ultraplanPlan in cloud: draft, review in a web editor, remote or local executionComplex architecture, multi-file plans
/ultrareviewParallel multi-agent review in cloudLarge PRs, in-depth reviews

/ultraplan automatically creates a cloud environment on first launch. The plan can be revised via a web editor before execution.

/ultrareview launches several agents in parallel for a more exhaustive review than local /qa:qa-review. Ideal for PRs of more than 500 lines.

TUI Fullscreen (Research Preview, CLI 2.1.89+)

Alternative rendering mode that takes control of the terminal surface like vim or htop. "Fullscreen" refers to taking over the drawing surface, not to maximizing the window.

Activation: /tui fullscreen (CLI 2.1.110+) or CLAUDE_CODE_NO_FLICKER=1 before launch. Deactivation: /tui default.

Three key benefits

BenefitImpact
Flicker-freeNo more flickering in VS Code terminal, tmux, iTerm2 on long sessions
Constant memoryOnly visible messages in the render tree → flat RAM even on conversations of several hours
Mouse supportClick-to-expand tool results, click URLs/file paths, click-and-drag selection with auto-copy

Visual signal: in fullscreen, the prompt input stays fixed at the bottom instead of scrolling up with the output.

Associated commands

ModeCommandDescription
Fullscreen/tui fullscreenActivates the mode (persists via the tui setting)
Default/tui defaultDeactivates the mode
Status/tuiDisplays the active renderer
Focus/focusCondensed view: prompt + 1 line per tool + final response (separable from /tui)
TranscriptCtrl+OToggle transcript mode with less-style navigation
ShortcutAction
PgUp / PgDnHalf-screen scroll (or Fn+↑/Fn+↓ on Mac)
Ctrl+Home / Ctrl+EndStart / end of conversation
Ctrl+O then /Search in the transcript
Ctrl+O then [Dump the conversation into the terminal's native scrollback
Ctrl+O then vOpen the transcript in $EDITOR

Environment variables

VariableUsage
CLAUDE_CODE_NO_FLICKER=1Activates fullscreen at startup (equivalent to the tui setting)
CLAUDE_CODE_DISABLE_MOUSE=1Keeps flicker-free + flat memory, but disables mouse capture (useful in SSH/tmux)
CLAUDE_CODE_SCROLL_SPEEDScroll wheel speed multiplier (1-20, terminal-dependent default)

tmux compatibility

  • Requires set -g mouse on in ~/.tmux.conf for the scroll wheel
  • Incompatible with tmux -CC (iTerm2 integration mode)

Push Notifications (CLI 2.1.110+)

Claude can send push notifications to mobile when Remote Control is enabled. Useful for long background tasks.

Activation: enable Remote Control + "Push when Claude decides" in /config. Claude notifies at task end or when a human decision is necessary.

/loop Command

Run a prompt or command at regular intervals:

/loop 5m "run tests and report failures" # every 5 minutes
/loop "check CI status" # auto-paced by Claude (CLI 2.1.101+)

Alias: /proactive (CLI 2.1.105+). Without an interval, Claude auto-determines the optimal frequency.

Wakeup control: Esc cancels pending wakeups (CLI 2.1.113+), a "Claude resuming /loop wakeup" message confirms restart at each tick.

Monitor Tool (CLI 2.1.98+)

Native tool that spawns a watcher in the background and streams its events into the conversation: each event arrives as a new transcript message that Claude reacts to immediately. Replaces Bash sleep loops that block an entire turn.

Use caseExample prompt
Application log tailTail server.log and notify me as soon as a 5xx appears
Babysit CI on a PRWatch the CI of this PR and auto-fix the lints
Watch a dev serverWatch npm run dev and restart on crash
Track a training runMonitor the training log and alert on loss spike

Recommended pairing with /loop (auto-pace): Claude chooses Monitor over polling when the source emits events directly.

Foundation integration: Monitor is useful in /qa:qa-loop, /ops:ops-ci-fix, and long-running /loop workflows where a bash sleep loop would be the alternative.

/autofix-pr (CLI 2.1.92+)

Enables PR auto-fix on Claude Code Web from the terminal for the PR of the current branch. After push, Claude monitors the CI and review comments and pushes fixes until green without requiring an active local session.

git push -u origin feature/auth
/autofix-pr
When to useDescription
Long CI cycleLints, tests, type-check looping on small fixes
PR with many review nitsRenames, formats, docstrings requested in review
Asynchronous workYou want to leave the terminal and let Claude finish

Complement to /work:work-pr: /work:work-pr creates the PR, /autofix-pr makes it converge autonomously. Requires Claude Code on the web (Pro/Max/Team/Enterprise).

/powerup Command

Interactive lessons and animated demos to discover Claude Code's features. Useful for onboarding new users.

/less-permission-prompts (CLI 2.1.111+)

Scans session transcripts and proposes optimized permission allowlists. Reduces the number of permission prompts without compromising security.

Useful for: onboarding (generating initial permissions), sessions with too many prompts, team configuration optimization.

Advanced Prompt Caching (CLI 2.1.108+)

VariableTTLDescription
ENABLE_PROMPT_CACHING_1H1 hourExtended prompt cache for long sessions (API key, Bedrock, Vertex, Foundry)
FORCE_PROMPT_CACHING_5M5 minutesForces 5 min TTL (useful if telemetry is disabled)

Enable in .claude/settings.local.json (not committed):

{
"env": {
"ENABLE_PROMPT_CACHING_1H": "1"
}
}

Advanced Environment Variables

VariableDescription
CLAUDE_CODE_NO_FLICKER=1Alt-screen rendering without flicker (virtualized scrollback)
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1Strips credentials from subprocess env variables
MCP_CONNECTION_NONBLOCKING=trueSkip waiting for MCP connection in -p mode (headless/CI)
ENABLE_PROMPT_CACHING_1H=11-hour prompt cache (significant savings)
FORCE_PROMPT_CACHING_5M=1Force 5-minute prompt cache
CLAUDE_CODE_USE_POWERSHELL_TOOLOpt-in/out of the PowerShell tool on Windows (CLI 2.1.111+)
CLAUDE_CODE_ENABLE_AWAY_SUMMARY=1Forces the session recap even if telemetry is disabled (CLI 2.1.108+)
CLAUDE_CODE_PERFORCE_MODE=1Edit/Write fail on read-only files with p4 edit hint (CLI 2.1.98+)
CLAUDE_STREAM_IDLE_TIMEOUT_MSConfigures the streaming inactivity watchdog (CLI 2.1.84+)
OTEL_LOG_RAW_API_BODIES=1Emits full API request/response bodies via OpenTelemetry (CLI 2.1.113+)

Advanced Settings

SettingDescription
disableSkillShellExecutionDisables inline shell execution in skills, commands and plugins
managed-settings.d/Drop-in directory for policy fragments (Team/Enterprise)
sandbox.network.deniedDomainsBlocks specific domains even under a wildcard allowedDomains (CLI 2.1.113+)
sandbox.failIfUnavailableExit with error if sandbox enabled but unavailable (CLI 2.1.83+)
modelOverridesMaps picker entries to custom model IDs (Bedrock Application Inference Profile ARNs, etc.) (CLI 2.1.84+)
worktree.sparsePathsSparse-checkout for large monorepos with claude --worktree (CLI 2.1.76+)
autoScrollEnabledDisables auto-scroll in fullscreen mode (CLI 2.1.110+)
showThinkingSummariesGenerates extended thinking summaries (default now false — CLI 2.1.108+)
disableDeepLinkRegistrationPrevents registration of the claude-cli:// protocol handler (CLI 2.1.83+)
feedbackSurveyRateAdmin sample rate of the session quality survey (CLI 2.1.76+)
forceRemoteSettingsRefreshBlocks startup until remote managed settings are refreshed (policy)
Theme "Auto (match terminal)"Automatically follows the terminal's dark/light mode (CLI 2.1.111+)

LSP (Language Server Protocol)

Semantic code navigation via .lsp.json. Activation: export ENABLE_LSP_TOOL=1.

12 supported languages (TypeScript, Python, Go, Rust, Java, C/C++, C#, PHP, Kotlin, Ruby, HTML, CSS).

LSP for: symbol definitions, references, diagnostics. Grep for: textual searches. See .claude/rules/lsp.md for detailed rules.