ASK KNOX
beta
LESSON 45

Commands, Shortcuts, and Slash Commands

The complete reference for Claude Code slash commands, keyboard shortcuts, CLI flags, and configuration — from /help to --dangerously-skip-permissions, covering every control you need for efficient daily use.

8 min read·Getting Started with Claude Code

Knowing the commands separates fluid Claude Code usage from constant friction. This lesson is the reference you come back to — every slash command, keyboard shortcut, useful CLI flag, and configuration option, explained concisely.

Commands, Shortcuts, and Slash Commands

Slash Commands

Slash commands are typed directly in the Claude session prompt. They begin with / and execute immediately.

Session Management

/help Displays all available slash commands with brief descriptions. Run this when you forget a command.

/clear Resets the conversation context. CLAUDE.md files are re-read. Your actual code files are not affected. Use when switching between unrelated tasks.

/compact Summarizes the conversation history to reduce token usage while keeping key context. Claude creates a condensed summary and continues from there. Use mid-session when you are approaching context limits.

/exit (or Ctrl+D) Ends the Claude Code session and returns to your regular terminal prompt.

Git Commands

/commit Reviews the current git diff, generates an appropriate commit message, and creates a commit. Claude analyzes what changed and writes a descriptive message — useful for quick commits without thinking about message wording.

/review Asks Claude to review the current unstaged changes (git diff) and provide feedback on code quality, potential bugs, and improvements. Think of it as an instant code review.

Project Initialization

/init Scans your project directory and creates a CLAUDE.md file with inferred context — structure, tech stack, patterns it detects from the code. Run this once when starting work in an existing codebase. Then edit the generated file to add anything Claude missed.

Information

/status Shows the current session status: model in use, context window usage percentage, token counts for the current session, and estimated cost so far.

/model Displays the current Claude model and lets you switch models mid-session. Different models have different speeds and costs. Useful if you started on a fast model and need to switch to a more powerful one for a complex task.

Keyboard Shortcuts

These work during any Claude Code session in the terminal.

ShortcutAction
Ctrl+CCancel the current operation. If Claude is mid-tool-call, this interrupts it.
EscapeCancel Claude's current response mid-stream and return to the prompt.
/ Browse message history. Press Up to retrieve your previous prompts.
Shift+EnterInsert a newline in your message without submitting. Use for multi-line prompts.
Ctrl+DExit the session (same as /exit).
TabAutocomplete slash commands. Type /c and press Tab to see completions.

CLI Flags (Passed at Launch)

These flags modify how Claude Code starts. Pass them when running claude from your terminal.

claude --help Full help documentation for the Claude Code CLI. Covers all flags and configuration options.

claude --version Shows the installed Claude Code version.

claude --dangerously-skip-permissions Launches in bypass mode — Claude auto-approves all tool calls without prompting. Use only in sandboxed, controlled environments. Never in production codebases.

claude --model claude-3-5-sonnet-20241022 Specifies which Claude model to use. The default is typically the latest Sonnet. Use this to pin a specific model version.

claude --debug Enables verbose debug logging. Shows internal state, API calls, and timing information. Use when diagnosing installation or authentication issues.

claude -p "Your prompt here" Print mode — runs Claude non-interactively with a single prompt and exits. Useful for scripting Claude into shell scripts or automation pipelines.

claude -p "Review the last git commit and summarize what changed"

Configuration: ~/.claude/

Claude Code stores its global configuration in ~/.claude/. Understanding this directory helps you customize behavior.

~/.claude/settings.json — Global settings file. Editable directly in any text editor or via claude config. Key settings:

{
  "model": "claude-3-5-sonnet-20241022",
  "theme": "dark",
  "verbose": false,
  "permissions": {
    "defaultMode": "default"
  }
}

~/.claude/CLAUDE.md — Your global Claude instructions. Anything in this file applies to every Claude Code session on your machine, regardless of which project you are in. Use it for personal preferences that apply across all projects:

# Global Claude Instructions

## My Preferences
- I prefer TypeScript over JavaScript when given a choice
- Always add JSDoc comments to exported functions
- Never use `var` — always `const` or `let`
- Use 2-space indentation

## My Context
- I'm a beginner-to-intermediate developer
- Explain your reasoning briefly so I can learn from it
- If you see a simpler approach, suggest it even if I didn't ask

Common Configuration Patterns

Set a default model:

claude config set model claude-3-5-sonnet-20241022

View current config:

claude config list

Reset to defaults:

claude config reset

Project-Level vs. Global Settings

Claude Code uses a layered configuration system:

  1. CLI flags — highest priority, override everything
  2. Project CLAUDE.md — applies within the project directory
  3. Global ~/.claude/settings.json — applies everywhere
  4. Global ~/.claude/CLAUDE.md — applies everywhere, loaded before project CLAUDE.md
  5. Defaults — lowest priority, built into the tool

A project-level setting always beats a global setting. A CLI flag always beats both. This lets you have sensible global defaults while overriding them per-project or per-session when needed.

Practical Command Sequences

Starting a new task:

/clear
[describe your new task]

After a long session, before a big task:

/compact
[describe the next thing you want to do]

Reviewing and committing changes:

/review
[if review looks good]
/commit

Checking what you've used so far:

/status

Lesson 45 Drill

Open a Claude session in any project and run through these commands in order:

  1. /help — read every command listed
  2. /status — note the model and context usage
  3. Make a small code change (or ask Claude to make one)
  4. /review — have Claude review the change
  5. /commit — commit the change with Claude's generated message
  6. /clear — reset the context
  7. Verify CLAUDE.md is still loaded by asking a question about your project

This takes about 10 minutes and builds muscle memory for the daily workflow.

Bottom Line

Slash commands control session state (/clear, /compact), git operations (/commit, /review), and project setup (/init). Keyboard shortcuts give you escape hatches (Ctrl+C, Escape) and productivity shortcuts (↑ for history, Shift+Enter for multi-line). CLI flags configure launch behavior for special modes. Configuration lives in ~/.claude/ and applies globally or per-project. The layered system lets you have sensible defaults while overriding per-project or per-session.

Next: the skill that unlocks faster problem-solving — debugging with Claude Code.