Productivity

Keyboard Shortcuts & Productivity

Master the Claude Code CLI shortcuts and techniques to work faster in the terminal.

Mode Switching

Claude Code has permission modes you can cycle through instantly:

  • Shift + Tab — Cycle: defaultacceptEditsplan. Once enabled, auto and bypassPermissions slot in after plan; dontAsk stays out of the cycle.

Use default for careful work, acceptEdits when you trust the flow, and plan for read-only exploration. See the Plan Mode guide for details.

Essential Shortcuts

  • Ctrl + C — Cancel current generation or input
  • Ctrl + D — Exit Claude Code
  • Ctrl + L — Redraw the terminal (recovers from garbled display; conversation history is kept)
  • Ctrl + R — Reverse search through command history
  • — Recall previous prompts
  • Esc Esc — Rewind: undo code changes and/or conversation turns

Input & References

  • @ — Reference a file or directory (tab-completable)
  • / — Open slash commands menu
  • # — Quick-update CLAUDE.md from the conversation (legacy; prefer /memory for the official editor)
  • ! — Enter bash mode (run shell commands directly)
  • Ctrl + V — Paste an image for visual analysis

Useful Slash Commands

CommandDescription
/clearReset conversation history
/compactCompress history while preserving key context
/contextVisualize context window usage
/costShow session token usage and cost
/permissionsView and manage tool permissions
/hooksReview all hooks loaded in current session
/mcpInspect configured MCP servers and tools
/agentsManage subagents (Running + Library tabs)
/pluginsManage installed plugins
/workflowsInspect, pause, resume, stop, or save dynamic workflow runs
/goalKeep Claude working until a completion condition holds
/loopRe-run a prompt on an interval inside the current session
/advisorConfigure a stronger model for second opinions
/modelSwitch the AI model
/effortSet reasoning effort: low, medium, high, max
/rename <name>Name the current session for easy resumption
/memoryOpen CLAUDE.md files for editing
/configOpen settings editor (replaces old /vim, /output-style)
/doctorCheck installation health
/powerupInteractive animated lessons for Claude Code features
/team-onboardingGenerate a ramp-up guide from your usage history
/reviewReview current PR or staged diff

Session Management

Resume a Session

bash
claude --continue          # resume most recent conversation (short: -c)
claude --resume            # pick from a list of recent sessions (short: -r)
claude --resume "my-task"  # resume a named session directly

Name a Session

bash
claude --name "auth-refactor"    # set a display name at launch (short: -n)

Or rename mid-session with /rename auth-refactor. Named sessions are easy to resume with --resume.

Fork a Session

bash
claude --resume "auth-refactor" --fork-session   # branch into a new session ID

Useful when you want to explore an alternative approach without modifying the original session.

Start an Isolated Worktree

bash
claude --worktree

Use this when you want a parallel session with its own branch and working directory.

Workflow Tips

Pipe Input

Feed external data directly into Claude Code using Unix pipes:

bash
git diff main | claude -p "review this diff for issues"
tail -f app.log | claude -p "summarize errors as they appear"
cat schema.sql | claude -p "suggest indexes for this schema"

File References

Use @ to pull file content into your prompt efficiently:

text
@src/auth/login.ts what does this auth flow do?
look at @tests/ and write tests for @src/utils/parser.ts

Headless / Scripting Mode

For CI and automation, use -p (print mode):

bash
claude -p "run all tests and report failures" --output-format json

Add --bare for the fastest possible startup — it skips hooks, skills, plugins, MCP servers, auto memory, and CLAUDE.md:

bash
claude --bare -p "check if this file has any syntax errors"

Why do these shortcuts matter?

Each shortcut maps to a core agent capability: mode switching controls the permission model, @ manages the context window, and Esc Esc leverages checkpointing. Understanding the agent architecture behind these makes you faster.

Explore the Agent Tool Use path

Related Reading

Continue with practice

You have finished the core ideas of Keyboard Shortcuts & Productivity.

If you want to turn the idea into something reusable, continue practicing on AgentWay.