Last ChanceLifetime retiring April 23. Lock it in before it's gone.LASTCALL · 35% OFF

Claude Code Complete Reference: Every Feature Plus 10 Hidden Gems

Claude Code is Anthropic's official CLI agent. You can call Claude directly from your terminal and drive code generation, editing, debugging, Git operations, and project management end to end.

This article organizes every feature as of April 2026 by category, and also highlights the ten most underused tricks worth adding to your daily workflow.

This reference is based on the Claude Code v2.1.x series (April 2026). Some features may not be available on older versions.

Top 10 Features You Might Not Know About

Ten features that most users overlook. Dropping any one of them into your routine tends to pay for itself quickly.

1. /btw: side questions that don't pollute the main context

During a long implementation session, small questions come up. Asking them normally grows the conversation history. /btw keeps that history clean.

/btw How should I choose between Record and Map in TypeScript?
/btw What are likely causes of an "ECONNREFUSED" error?

It answers with awareness of the current context (open files, prior discussion) so the reply is on-topic. Because it reuses the prompt cache, the extra token cost is minimal.

The difference from a subagent is worth knowing:

Trait /btw Subagent
Context Shares current context Empty (independent)
Tool use None Yes (can read/write files, etc.)
Best for Concept checks, terminology Heavier investigation, editing other files

2. Ctrl+S: stash the prompt you're drafting

You're halfway through a long prompt when you realize you need to check something first. Ctrl+S stashes the unfinished prompt.

1. You're typing a long instruction.
2. Press Ctrl+S to save the draft.
3. Ask the interrupting question.
4. Get the answer.
5. Draft auto-restores so you can continue where you left off.

Same idea as git stash. No more "where was I?" after an interruption.

3. # text: persist a note to auto-memory instantly

Capture a rule you want followed from now on without breaking flow:

# Always write tests with jest
# Keep API responses in snake_case
# Put env vars in .env.local

Anything prefixed with # is stored in auto-memory at .claude/projects/<project>/memory/. It is managed automatically by Claude, separate from CLAUDE.md.

Note: the # prefix method is being deprecated in favor of telling Claude directly to remember something, or using /memory.

On a team, writing down a freshly decided convention or architectural call this way keeps Claude's suggestions consistent across sessions.

4. /loop: local scheduled runs (up to 3 days)

Re-run a prompt or slash command on a schedule.

/loop 5m npm test              # run tests every 5 minutes
/loop 30m /security-review     # security review every 30 minutes
/loop 1h git log --oneline -5  # peek at recent commits hourly

Each iteration runs in its own context, so prior results don't bleed in. Default interval is 10 minutes; max duration is 3 days.

/loop runs on your machine, so sleeping the laptop stops it. For machine-independent runs, use /schedule.

5. ! commands: run shell directly, skipping Claude's reasoning

Prefix a line with ! to run a shell command directly, bypassing the reasoning step.

!git status
!git log --oneline -10
!ls -la src/
!cat package.json | jq .version

Asking "show me git status" has Claude interpret things before using a tool. ! cuts straight to the output.

Output still lands in the conversation context, so it is not free. Avoid commands that dump large output.

Rule of thumb: use ! for "just check" commands, and let Claude handle anything that requires judgment or edits.

6. Ctrl+B: move a long task to the background

When Claude is in a long task (full test run, large refactor), Ctrl+B moves it to the background.

1. "Run all tests."
2. Claude starts.
3. Ctrl+B sends it to the background.
4. You ask about something else.
5. You get a notification when tests finish.

The prompt frees up immediately. Ctrl+T shows the list of background tasks.

7. --bare: lightweight mode for fast startup

Skips hooks, LSP, plugin sync, skill scanning, auto-memory, CLAUDE.md auto-detection, and keychain lookups for the fastest cold start.

# In a CI/CD pipeline
claude --bare -p "Any security issues in this diff?" < diff.patch

# From a shell script
result=$(claude --bare -p "Convert this to snake_case: getUserName" --output-format json)

# Pipe-based code review
git diff HEAD~1 | claude --bare -p "Review this diff" --max-turns 5

Because the usual init work is skipped, one-shot runs feel noticeably faster. Pair with -p (non-interactive mode) and --output-format json for automation pipelines.

8. /rewind (ESC x 2): roll back file changes

Undo Claude's most recent file edits and return to the previous state.

1. "Refactor the auth logic."
2. Claude edits several files.
3. You review: "not quite what I wanted."
4. /rewind (or press ESC twice).
5. Files revert.
6. Adjust instructions and try again.

Makes the "try first, revert if needed" approach low risk. Before a Git commit, you can iterate freely.

9. Ctrl+G: edit the prompt in $EDITOR

Opens the in-progress prompt in whatever editor $EDITOR points at (Vim, Neovim, VS Code, etc.).

export EDITOR=nvim          # Neovim
export EDITOR="code --wait" # VS Code

Great for long specs or multi-step instructions that are painful to type in a single terminal line. Save and close the editor to send.

10. Sparse worktree: faster startup in large monorepos

Large monorepos can make Claude Code's startup slow because of file indexing. Use worktree.sparsePaths to load only the directories you need.

{
  "worktree": {
    "sparsePaths": [
      "packages/my-service",
      "shared/utils"
    ]
  }
}

Internally this uses git sparse-checkout (cone mode). Specify directory paths, not glob patterns. Even in monorepos with hundreds of packages, scoping to the services you own gets startup lean.

The rest of the article is a category-by-category reference.

Keyboard Shortcuts

Input and editing

Ctrl+S: save prompt draft. Stash the in-progress prompt; it auto-restores after an interruption.

Ctrl+G: edit prompt in $EDITOR. Open the current prompt in your external editor.

\ + Enter: multi-line input. Put \ at end of line, then press Enter. Option+Enter, Shift+Enter, and Ctrl+J also work in many terminals, but only \ + Enter is universally reliable.

Ctrl+R: reverse history search. Incremental search through prior prompts, just like the shell. Repeat to go further back.

Execution control

Ctrl+B: background current task. Frees the prompt so you can start the next task.

Ctrl+C: interrupt output (session stays). Stops the current response without ending the session, unlike Ctrl+D or /exit.

Ctrl+F x 2: stop all background agents. Two presses within 3 seconds force-kills every running background agent. Emergency brake for a runaway agent.

Display and switching

Ctrl+T: toggle task list. Shows progress of parallel subagents. Survives /compact.

Ctrl+O: transcript viewer. Full session log in transcript form, including Claude's file reads and decisions.

Shift+Tab: cycle permission modes. Steps through default, acceptEdits, auto, plan.

Mode Behavior
default Auto-approve reads; confirm writes each time
acceptEdits Auto-approve file edits; confirm command execution
auto AI classifier auto-approves safe ops, blocks dangerous ones
plan Present plan only; execution requires approval

Option+T / Alt+T: extended thinking toggle. Switch deeper reasoning on or off mid-session.

Option+P / Alt+P: model picker. Switch between Opus, Sonnet, and Haiku on the fly.

Shortcut reference

Shortcut Function Category
Ctrl+S Save prompt draft Input
Ctrl+G Edit prompt in $EDITOR Input
\ + Enter Multi-line input Input
Ctrl+R Reverse history search Input
Ctrl+B Background execution Execution
Ctrl+C Interrupt response Execution
Ctrl+F x 2 Stop all background agents Execution
Ctrl+T Toggle task list Display
Ctrl+O Transcript viewer Display
Shift+Tab Cycle permission modes Switch
Option+T / Alt+T Extended thinking Switch
Option+P / Alt+P Model picker Switch

Slash Commands

Session management

/compact [instruction]: summarize and continue. Try this before /clear when context fills up. Replaces the conversation with a compressed summary.

/compact                                 # summarize everything
/compact keep only the auth discussion   # focus on a topic
/compact keep only the final decisions   # decisions only

Check usage with /context; run /compact around 80 percent.

/clear: reset conversation history. File edits stay; conversation context is wiped. Good reset between unrelated tasks.

/resume: reopen a past session. No args shows a picker. From the CLI: claude -c for the latest, claude -r "auth refactor" by name.

/rename <name>: name the session. Useful when juggling multiple sessions via /resume.

/color <color>: change the prompt bar color. Distinguish terminal windows at a glance. Pairs well with /rename.

/context: show token usage as a graph. Use it to decide when to /compact.

/export [file]: write the conversation to disk. Handy for sharing debug sessions or archiving decisions.

Execution control

/plan: plan and approve before implementing. Claude proposes an approach and waits. Review, tweak, approve, and only then execute. Prevents runaway implementation on complex changes.

/effort [low|medium|high|max]: set reasoning depth. Low for simple edits; max for architecture. Set a default via the CLAUDE_CODE_EFFORT_LEVEL env var.

/btw <question>: side question. See the Top 10.

/loop [interval] <command>: local scheduled runs. See the Top 10.

/schedule: cloud-scheduled runs. Runs on Anthropic infrastructure so it keeps going when your laptop is off.

/schedule Run tests on main every morning at 9 and notify Slack

Versus /loop: loop is local and caps at 3 days; schedule is continuous in the cloud.

/rewind: roll back file changes. ESC pressed twice does the same.

Code review and quality

/simplify: three parallel review agents. Independent reviews for reuse, quality, and efficiency. Auto-fixes issues it finds. Nice quality gate before opening a PR.

/batch <instruction>: large-scale parallel change. Automates repetitive edits across many files via parallel worktrees and opens PRs.

/batch Add rate limiting to every API endpoint
/batch Add aria-label to every component

Each change happens in its own worktree, so one failure does not affect the others.

/security-review: security scan. Data-flow analysis over your changes. Flags common vulnerabilities like XSS, SQL injection, and auth bypass.

/diff: session-wide diff. Shows what Claude changed this session as a Git diff. Final sanity check before committing.

/pr-comments [PR]: pull in GitHub PR review comments. Feeds review comments into the session so Claude can respond to them.

Git and conversation branching

/commit and /commit-push-pr are bundled skills rather than built-in commands. They're invoked with / but are implemented as Markdown-based skills.

/branch: branch the conversation. Creates an independent session from the current one. Alias for /fork. This is a conversation branch, not a Git operation. Handy when you want to try an approach but keep the option to revert the discussion.

/commit: auto-generate a commit message and commit. Analyzes the diff and composes the message.

/commit-push-pr: commit, push, and open a PR in one step. Message, title, and body all auto-generated.

Setup and diagnostics

/config: interactive settings. Menu-driven access to model, voice, memory, and prompt suggestions. No JSON editing needed.

/status: show current settings. Active model, permission mode, connected MCP servers, tool state. Unlike /doctor, it does not run tests.

/cost: session token usage (API users). Tokens and cost for the current session.

/stats: usage statistics (Pro/Max). Subscription plan usage.

/insights: analyze your session patterns. Surfaces habits like waiting-versus-working time ratios.

/doctor: installation diagnostics. Environment issues, keybinding warnings, MCP server status in one shot. First command to run when something feels off.

/memory: edit CLAUDE.md interactively. Good paired with #-prefix auto-memory.

/init: generate CLAUDE.md for a new project. Scans the codebase and extracts build commands, test procedures, and conventions.

/vim: Vim keybindings in the prompt. Normal/insert modes, h/j/k/l movement, d/c/y ops, text objects.

/voice: voice input. Push-to-talk in 20 languages including Japanese. Recognition of technical terms like repo names, OAuth, and JSON has improved.

External integrations

/teleport: move the session across devices. Transfer a desktop session to phone or tablet to keep going.

/remote-control (/rc): operate locally from claude.ai. Monitor and drive the local session from the browser. Useful when you can't open a terminal directly.

/chrome: set up Claude in Chrome integration. After setup you can drive web app testing, console debugging, form handling, and data extraction from Claude Code.

/install-github-app: automatic PR review. Claude reviews every new PR. Customize the review prompt in claude-code-review.yml.

/install-slack-app: Slack integration. Mention @Claude in Slack to route bug fixes or review requests to Claude Code directly.

Agent and tool management

/agents: subagent management. List running subagents and tweak their settings.

/mcp: MCP server management. List, add, remove MCP servers. Server prompts are usable as /mcp__servername__command.

/skills: list installed skills. Built-in and custom, including /simplify, /batch, /loop, /debug, /claude-api.

/add-dir <path>: add a working directory. Useful in monorepos and multi-project workflows. Also available as --add-dir at startup.

/hooks: interactive hook configuration. Menu-based setup without hand-editing JSON. Good starting point for first-time hook authors.

CLI Flags

Session control

-c / --continue: resume the last session.

claude -c
claude -r "auth refactor"   # resume by name

-p "...": non-interactive mode (one-shot).

# Single-shot
claude -p "List the dependencies in package.json"

# JSON output for scripting
claude -p "Explain the bug in this function" --output-format json < buggy.ts

# Pipe input
cat error.log | claude -p "What caused this error?"

Prompt in, answer out, exit. The foundation for CI/CD and shell script integration.

-c --fork-session: fork the current session. Keeps context but creates a new session ID. Try experimental directions without polluting the main thread.

--from-pr <number>: restore a PR session.

claude --from-pr 142

Reopens the Claude Code session tied to a GitHub PR. Carry PR review context across days.

Execution mode

--permission-mode auto. AI classifier auto-approves safe operations (reads, git status, test runs) and blocks dangerous ones (file deletion, force push).

claude --permission-mode auto

Also toggleable mid-session with Shift+Tab.

--bare: lightweight mode. See the Top 10.

--max-turns <N>: cap agent turns.

claude -p "Refactor this" --max-turns 20

Always set this as a safety valve in CI and script automation.

Model and reasoning

--model opus|sonnet|haiku.

claude --model haiku   # quick questions
claude --model opus    # complex design

Switch mid-session with /model or Option+P.

--effort [low|medium|high|max]. Set reasoning depth at startup. Pin the default with CLAUDE_CODE_EFFORT_LEVEL.

Worktree

-w <branch> / --worktree: start in an isolated worktree.

claude -w feature-auth
claude -w bugfix-login

Changes stay inside the worktree, so main is untouched. /batch uses this internally.

Tool and prompt control

--allowedTools / --disallowedTools.

claude --allowedTools "Read,Bash(git *)"
claude --disallowedTools "Bash(rm -rf *)"

Combine for whitelist plus blacklist.

--system-prompt / --append-system-prompt.

claude --system-prompt "Act as a security-focused reviewer"
claude --append-system-prompt "Answer in English"

Pin personas or constraints at launch.

Agents and Tools

Subagents

Put agent definitions in .claude/agents/:

---
name: security-auditor
description: Specializes in security vulnerability review
model: opus
allowed-tools: Read,Grep,Glob,Bash(grep *),Bash(git *)
---

You are a security reviewer. Audit code for:
- SQL injection
- XSS
- Authentication bypass
- Hard-coded secrets

Role-based agents (frontend, backend, security) each run in their own context, which helps token efficiency.

Inline operations

!command. Direct shell execution. See the Top 10.

@filepath: file reference with tab completion.

@src/auth/login.ts review the validation logic
@package.json check the dependencies

Tab completion avoids path typos and beats vague "look at files around here" instructions.

#text. Persist to auto-memory. See the Top 10.

AskUserQuestion tool: interview-driven specs

Claude plays interviewer and drives out a spec before implementation.

Use the AskUserQuestion tool and interview me in this order:
1. Feature goal and user stories
2. Technical constraints and integration points
3. Edge cases and error handling
4. Performance requirements
5. Security requirements
When complete, write it up in SPEC.md.

Prevents rework from coding against an unclear target.

Channels: send events into a running session

Stream events from Slack, Discord, Telegram, and webhooks into live Claude Code sessions.

/install-slack-app

# Afterwards, in Slack:
@Claude investigate this bug: #issue-1234

Wires CI/CD completion notices, monitoring alerts, and teammate requests into your session.

Git and Version Control

Parallel worktree development

# Terminal 1: frontend
claude -w feature-frontend
/color blue
/rename frontend-auth

# Terminal 2: backend
claude -w feature-backend
/color green
/rename backend-api

# Terminal 3: hotfix
claude -w hotfix-login
/color red
/rename hotfix-login

Each branch gets its own directory. Multiple Claude sessions run in parallel without interfering. Merge branches when done.

Sparse worktree

See the Top 10. worktree.sparsePaths checks out only the paths you need, for fast startup in large monorepos.

File checkpoints

/rewind reverts the whole session; file checkpoints let you roll back specific files selectively. Useful when you want to keep test edits but drop changes to a particular function.

PR session carryover

claude --from-pr 142

Restores the Claude Code session associated with a PR so you can continue the next day with full context.

Hooks

Hooks bind shell commands to Claude Code events. Configure via settings.json or interactively with /hooks.

PreToolUse: before a tool runs

Fires before tool execution. Good for blocking dangerous commands.

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash(rm -rf *)",
        "command": "echo 'BLOCKED: rm -rf is forbidden' && exit 1"
      }
    ]
  }
}

PostToolUse: after a tool runs

Common use: auto-format on save.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write(*.ts)",
        "command": "npx prettier --write $CLAUDE_FILE_PATH"
      },
      {
        "matcher": "Write(*.py)",
        "command": "black $CLAUDE_FILE_PATH"
      }
    ]
  }
}

Patterns like Write(*.ts) scope hooks to specific file types.

PostCompact: after /compact

Fires after compression. Use it to re-inject information that compression tends to lose.

Notification: on status changes

Fires on task completion, awaiting input, and similar events.

{
  "hooks": {
    "Notification": [
      {
        "command": "osascript -e 'display notification \"$CLAUDE_NOTIFICATION\" with title \"Claude Code\"'"
      }
    ]
  }
}

Wire this to desktop notifications, Slack webhooks, or LINE to get pinged when you're away.

CwdChanged / FileChanged

React to working directory or file changes. Pair with direnv for reactive environment management.

Hook reference

Hook When Typical use
PreToolUse Before a tool runs Block dangerous commands
PostToolUse After a tool runs Run formatter or linter
PostCompact After /compact Re-inject key info
Notification Status changes Desktop or webhook notifications
CwdChanged Working dir changes Swap environment variables
FileChanged Files change Live reload, auto tests

Skills and Customization

Custom skills

Drop files under .claude/skills/NAME/SKILL.md. These are reusable instruction sets callable as slash commands. They evolved from the older .claude/commands/ and add support files, frontmatter control, and autonomous invocation.

.claude/skills/
|-- qiita-writing/
|   |-- SKILL.md
|   \-- references/
|-- code-review/
|   \-- SKILL.md
\-- deploy/
    \-- SKILL.md

Skill frontmatter

---
name: my-skill
description: Skill description (shown in the skill list)
allowed-tools: Read,Write,Bash
model: sonnet
context: fork
user-invocable: true
argument-hint: "<filename>"
---

Instructions to Claude go here.
Key Meaning Example
allowed-tools Tools usable inside the skill Read,Write,Bash
model Model specific to the skill sonnet, haiku
context Context isolation fork (branch), isolate (full isolation)
user-invocable Can the user call it manually true / false
argument-hint Hint displayed on the slash command "<PR number>"

Plugin marketplace

/plugin marketplace add <URL>

Install community-made skills, agents, and hooks. Also a clean way to distribute common workflows inside a team.

Keybinding customization

Override any shortcut in ~/.claude/keybindings.json.

{
  "ctrl+k ctrl+s": "save-draft",
  "ctrl+k ctrl+r": "rewind",
  "ctrl+k ctrl+b": "background"
}

Chords (two-step sequences like ctrl+k ctrl+s) are supported, so you can match a VS Code or Emacs scheme. Validate with /doctor afterwards.

HTML comments in CLAUDE.md

# Project rules

<!-- Notes for teammates. Claude does not see these during auto-injection. -->
<!-- Owner: Taka / Reviewer: Yuki -->

Always write tests with jest.
Keep API responses in snake_case.

HTML comments (<!-- -->) inside CLAUDE.md are stripped when Claude Code auto-injects the file. Useful when you want teammate notes and Claude instructions to coexist.

If Claude reads the file directly with Read, the comments will be visible. The filtering only applies to auto-injection.

Configuration and Diagnostics

Auto mode management

claude auto-mode config     # review current rules
claude auto-mode critique   # AI evaluates and proposes improvements

Inspect and optimize the rules that --permission-mode auto uses. critique surfaces gaps and contradictions in custom rules.

Full-text search of past sessions

transcript search "auth OAuth migration"

Grep across session history so you can recover past decisions and their context.

managed-settings.d/: distributed team policy

Alongside managed-settings.json, drop fragments into managed-settings.d/.

managed-settings.d/
|-- 01-security.json
|-- 02-frontend.json
\-- 03-testing.json

Files merge alphabetically, so each team can own its own policy slice.

Configuration commands

Operation Command
Interactive settings /config
Check settings state /status
Usage stats (Pro/Max) /stats
Token usage (API) /cost
Auto mode rules claude auto-mode config
Auto mode optimization claude auto-mode critique
Session search transcript search
Installation diagnostics /doctor

Practical Combinations

Pattern 1: CI/CD pipeline

#!/bin/bash
# Auto-review on PR creation
claude --bare \
  -p "Review this PR diff for security, performance, and readability" \
  --output-format json \
  --max-turns 10 \
  --permission-mode auto \
  --model sonnet

Combines --bare for fast startup, -p for non-interactive, --max-turns to cap runaway, and --model sonnet for cost.

Pattern 2: Parallel branch development

# Terminal 1: frontend (blue)
claude -w feature-frontend --model sonnet
/color blue
/rename frontend-auth

# Terminal 2: backend (green)
claude -w feature-backend --model opus
/color green
/rename backend-api

# Each session runs in an independent worktree.
# When done, merge branches into main.

Pattern 3: Quality gate before opening a PR

/simplify            # 3-angle parallel review
/security-review     # security scan
/diff                # final review of changes
/commit-push-pr      # commit, push, open PR

Pattern 4: Long-running monitoring

/loop 10m Run npm test and analyze any failures

/schedule Run tests and lint on main every morning at 9 and post to Slack #ci-alerts

Pattern 5: PR review carried across days

# Day 1
claude
/pr-comments 142
# Claude responds to reviewer comments...
# Leave for the day

# Day 2
claude --from-pr 142
# Full context from the previous day restored

Reference

Claude Code is under active development, so features are added and changed often. Check the official documentation and release notes for the latest.


Translated and adapted from the original Japanese article by @nogataka on Qiita: https://qiita.com/nogataka/items/5e64037cc452c5d497fa

Master Claude Code

Ready to ship faster with AI?

Join 3,151+ students working at companies like Stripe, Microsoft, and Amazon. The complete Claude Code curriculum, daily workflows to advanced agentic patterns.

Master Claude Code — An Agentic Coding School Class

© 2026 Agentic Coding School. All rights reserved.

Not affiliated with Anthropic, OpenAI, or any other AI company.