LevelUpWith

Explore / 10x Developer: Claude Code & LLM Selection Mastery / Lesson 2

Lesson 2: Navigating Core Slash Commands

Master essential slash commands to control Claude Code execution and session state.

Free to read, no account needed. Part of 10x Developer: Claude Code & LLM Selection Mastery.

By the end of this level you'll be able to

  • Use /init to generate project documentation scaffolds
  • Clear and compact prompt context using /clear and /compact
  • Report issues and inspect system configuration via CLI utilities

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:

  1. Build & Test Commands: Standardized scripts for building, linting, and running test suites (e.g., npm test, pytest).
  2. Code Style Guidelines: Architectural patterns, indentation rules, error-handling conventions, and typing expectations detected in the repo.
  3. 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: /compact is 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: /clear is 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:

  • /doctor or /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

  • /init generates project-specific documentation scaffolds (like CLAUDE.md), capturing build commands and style guidelines for consistent LLM behavior.
  • /compact summarizes past conversation history to free up context tokens without losing key decisions.
  • /clear completely resets the active session context, ideal for pivoting to a new task.
  • Diagnostic utilities like /bug allow you to report errors and inspect CLI environment state directly within the terminal session.

A 3-question knowledge check follows this lesson in the app, free and without an account.

Keep going: levels 3 and 4 are free

Create a free account to open the next two levels, save your progress and pick up where you left off. No card needed.

Next: Level 3, Model Topography: Haiku, Sonnet, & Opus.

Create a free account →See the whole course

More like this

  • AI Coder: Claude Code & Coding Agents

    Master vibe coding and autonomous workflows using Claude Code, Cursor, MCP servers, and modern AI coding agent frameworks.

    Beyond the Obvious · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Claude at Work: No-Code Skills for Knowledge Workers

    Learn to brief Claude clearly, check what it gives you, and set up Projects, Artifacts, Skills, memory, connectors and Research for real work in sales, marketi…

    Course · Claude · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Delegating Real Work to Claude: Tasks, Files and Apps

    Learn to hand Claude multi-step work on your real files, browser and Office apps, with clear briefs, firm limits and approval gates, then review the results so…

    Course · Claude · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Prompting Claude: Instructions, Context and Testing

    Write prompts that Claude follows reliably, manage what goes into its context window, and test and improve your prompts with evidence instead of guesswork. Eac…

    Course · Claude · AI & Agents · Capable · 20 levels · 4 free · Professionally curated by levelupwith.com

  • Finished Work with Claude Artifacts, No Code

    Brief, refine, brand, check, share and export finished designs, decks, documents, dashboards and motion pieces in Claude without writing code. Every level ends…

    Course · Claude · AI & Agents · Capable · 18 levels · 4 free · Professionally curated by levelupwith.com

  • Rolling Out Claude: An Admin's Plan from Pilot to Value

    Build a complete, defensible Claude rollout plan for your team or company, one decision at a time: structure and identity, access, governance, spend and visibi…

    Course · Claude · AI & Agents · Capable · 20 levels · 4 free · Professionally curated by levelupwith.com