Welcome to Your Command Center
In Level 1, you successfully installed Claude Code and launched your first interactive CLI session. Now that your environment is running, it is time to master the control panel.
Think of the Claude Code interactive session as a flight cockpit. While you can converse in plain natural language to generate code, refactor modules, or run terminal tasks, slash commands are your dedicated physical switches. They operate directly on the session state, manage your token window, bootstrap codebase knowledge, and handle system diagnostics without triggering unnecessary LLM inference loops.
Mastering these commands early ensures your working context remains lean, precise, and highly cost-effective.
Section 1: /init — Bootstrapping Project Documentation Scaffolds
When you launch Claude Code inside a new or unfamiliar repository, the agent starts cold. While it can scan files on demand, providing instant baseline guidelines speeds up every subsequent interaction.
Executing /init triggers Claude Code to analyze your current project repository—examining package manifests (package.json, Cargo.toml, pyproject.toml), directory trees, build scripts, and existing documentation. It then automatically generates a tailored codebase guide, typically stored in a CLAUDE.md file at your project root.
> /init
What /init Produces:
- Build & Test Commands: Standardized scripts for building, linting, and running test suites (e.g.,
npm test,pytest). - Code Style Guidelines: Architectural patterns, indentation rules, error-handling conventions, and typing expectations detected in the repo.
- Repository Overview: A high-level architectural summary that Claude Code reads automatically at the start of future sessions.
By running /init upfront, you establish a persistent "single source of truth" context file that grounds Claude's responses in your team's specific conventions.
Section 2: /compact vs. /clear — Tactical Context Management
LLM context windows are finite resources. As you converse with Claude Code—executing bash commands, reviewing diffs, and reading logs—your active token count grows. A bloated context window leads to higher latency, increased API cost, and potential prompt degradation.
Claude Code provides two distinct slash commands to control session context:
1. /compact (The Intelligent Compression)
When your session history becomes long, running /compact instructs Claude Code to summarize the conversation history. It condenses prior steps, decisions, and file outputs into a concise context summary while discarding raw file dumps and verbose command outputs.
- Analogy:
/compactis like taking meeting notes during a long working session. You discard the raw transcript, but keep the key decisions and architectural directions. - When to use: Mid-way through a long feature implementation when you want to keep working toward the same goal without losing background context, but need to reduce token consumption.
> /compact
2. /clear (The Fresh Slate)
Running /clear completely wipes the current conversation context from memory without terminating your CLI binary process.
- Analogy:
/clearis erasing a whiteboard entirely before starting a completely different problem. - When to use: When switching to an unrelated bug or feature branch, or when the agent enters a repetitive debugging loop and you want a clean restart.
> /clear
| Command | Clears History? | Retains Context Summary? | Use Case |
|---|---|---|---|
/compact |
Summarizes | Yes | Long sessions working on a single goal |
/clear |
Completely | No | Switching tasks or breaking failure loops |
Section 3: Diagnostic Utilities & Issue Reporting
Even expert tools encounter edge cases, networking issues, or unexpected CLI behaviors. Claude Code includes built-in diagnostic utilities so you can inspect your state and report issues without leaving your terminal REPL.
Reporting Bugs with /bug
If Claude Code encounters an unhandled exception, misbehaves during command execution, or produces erratic behavior, do not switch to a browser to report it. Use the /bug command:
> /bug
Executing /bug captures relevant session logs, platform metadata, and error traces (redacting sensitive strings), opening a prompt to submit feedback directly to the development team.
Checking Configuration & Health
You can also run operational slash commands to inspect system state:
/doctoror/config: Inspects current CLI environment settings, verifying tool authentication, active paths, shell configurations, and execution permissions./help: Provides an up-to-date reference list of all supported slash commands available in your installed version.
Using these utilities ensures your workspace remains healthy and configured correctly before kicking off complex refactoring tasks.
Key Takeaways
/initgenerates project-specific documentation scaffolds (likeCLAUDE.md), capturing build commands and style guidelines for consistent LLM behavior./compactsummarizes past conversation history to free up context tokens without losing key decisions./clearcompletely resets the active session context, ideal for pivoting to a new task.- Diagnostic utilities like
/bugallow you to report errors and inspect CLI environment state directly within the terminal session.