Skip to content
ioob.dev
Go back

Claude Code: Frequently Used Commands

· 4 min read
Table of contents

Table of contents

Session Management — /clear and /compact

These are the two most fundamental commands for managing context.

/clear

Wipes the entire conversation history and starts a fresh session. Everything accumulated in the context window is gone.

I mainly use this in two situations. The first is when switching tasks. After finishing one feature and moving on to the next, leftover context can sometimes steer things in the wrong direction. The second is when Claude keeps repeating the same attempt or can’t break free from a wrong assumption. Clearing the history and asking again from scratch often resolves things cleanly.

/compact

Compresses the conversation into a summary. Unlike /clear, it preserves “what we were working on” while discarding the detailed back-and-forth.

Use this when approaching the context limit during a long task. It’s the compromise when full reset would waste valuable context, but continuing as-is would overflow the window.

The rule of thumb is simple. If the previous context isn’t needed for the current task, use /clear. If it is, use /compact.

Model Switching — /model

/model

Switches the Claude model mid-conversation.

ModelCharacteristicsWhen to use
haikuFast and cheapSimple questions, repetitive tasks, quick checks
sonnetBalanced performanceGeneral coding tasks (default)
opusMost powerful, slowerComplex design, tough debugging, long reasoning

sonnet is sufficient for everyday work. It’s efficient to only upgrade to opus when you’re stuck, and switching down to haiku for repetitive simple tasks speeds up responses. There’s no need to use opus for every question. Choosing the right model for the situation is part of context management.

Project Setup — /init and /doctor

Commands you use once when starting a project.

/init

Analyzes the current project and generates a CLAUDE.md file. It automatically identifies the project structure, build methods, key conventions, and records them for reference in future conversations. Run it once when first using Claude Code on a new project. The generated CLAUDE.md can be edited manually — adding project-specific rules or caveats improves consistency in subsequent sessions.

/doctor

Diagnoses the Claude Code installation. When something isn’t working — MCP connections, authentication, config files — start here. It’s the first step in troubleshooting.

Work Inspection — /review, /status, /memory, /permissions

Commands for checking state or adjusting settings mid-task.

/review

Requests a code review of staged changes or specified files. Running it before a commit can catch missed edge cases or security issues. Especially useful for personal projects where finding a human reviewer isn’t easy.

/status

Shows a summary of the current session state. You can check context usage, active tools, model info, and more. Use it when you’re curious about how much context has been consumed.

/memory

Opens Claude’s memory file in an editor for direct editing. Claude automatically saves user preferences and project context during conversations — use this to remove incorrectly saved entries or manually add important rules. Since this information persists across sessions, it’s a good place to store instructions you’d otherwise repeat every time.

/permissions

Shows the current permission settings. You can see which tools are allowed and what mode is active.

Permission Modes

These settings determine how autonomously Claude Code handles file edits, terminal execution, and external requests. Choose the appropriate mode based on the risk level of your work.

ModeBehavior
defaultAsks for confirmation only on risky actions
acceptEditsAuto-approves file edits; confirms terminal/external actions
bypassPermissionsAuto-approves everything
planWrites a plan before execution; proceeds only after user approval

acceptEdits is the most balanced setting for everyday coding. File edits proceed immediately, while terminal commands and external service requests still require confirmation. It eliminates the tedium of approving every “May I edit this file?” while keeping the brakes on for dangerous operations.

bypassPermissions makes Claude execute everything without asking. Useful for automated pipelines or fully controlled environments, but turning it on carelessly in interactive sessions can lead to irreversible changes. Best avoided on production repos or critical environments.

plan has Claude write a plan before executing, proceeding only after approval. Great for large-scale refactoring or multi-file changes — when you want to see “what’s going to happen” before it does. The safest mode, but comes with more intermediate confirmations.


Knowing many commands matters less than confidently using the few that fit your workflow. Managing sessions with /clear and /compact, picking the right model with /model, and setting permission modes for the situation is enough to handle most tasks smoothly.


Related Posts

Share this post on:

Comments

Loading comments...


Previous Post
VS Code: Frequently Used Shortcuts
Next Post
Software Architecture Part 1 — Why Architecture Matters