10 Essential Claude Code Commands to Start Using Today
The most useful Claude Code commands explained with practical examples. From /init to /compact — everything you need to be productive from day one.
10 Essential Claude Code Commands
You installed Claude Code, opened the terminal, and now you are staring at a blinking cursor. What next?
Claude Code has two types of interaction. Slash commands start with / and trigger specific tool actions — manage context, switch models, check costs. Natural language commands are everything else — you describe what you want in plain English and the AI does it.
This article covers the 10 you will use most often. Each one with an explanation, a practical scenario, and a real example. Bookmark this page. You will come back to it.
1. /init — Create Your Project's CLAUDE.md
The /init command scans your project structure and automatically generates a CLAUDE.md file at the root. This file is your persistent context — everything in it gets read by Claude Code at the start of every future session.
When to use it
At the beginning of any new project. Before asking Claude Code to do anything, run /init. A good CLAUDE.md dramatically changes the quality of the AI's output.
Example
User: /init
Claude Code reads the key files (package.json, folder structure, configs) and generates something like:
# My Project
## Stack
- Next.js 15 + TypeScript
- Tailwind CSS
- PostgreSQL + Prisma
## Commands
- `pnpm dev` — development server
- `pnpm test` — tests with Vitest
## Conventions
- Components in PascalCase
- Files in kebab-case
This is just a starting point. Edit the file afterward to include rules specific to your project — coding standards, architecture decisions, anything the AI needs to know.
The difference between using Claude Code with and without a CLAUDE.md is night and day. With the file, the AI already knows your stack, your patterns, and your commands. Without it, every session starts from scratch.
2. /help — See Everything Available
Lost? Not sure what Claude Code can do? /help shows the full list of available slash commands with a short description of each one.
When to use it
Whenever you forget a command name. Or when you want to find out if a command exists for what you need.
Example
User: /help
The output lists all available commands organized by category. It is your quick reference without leaving the terminal.
Pro tip: /help also shows keyboard shortcuts and CLI flags. It is not just about slash commands — it is a complete map of the tool.
3. /clear — Reset the Conversation Context
/clear wipes the entire conversation history. Claude Code forgets everything that was discussed and starts fresh — but it still reads your CLAUDE.md and project files.
When to use it
Between unrelated tasks. If you just finished implementing a feature and now want to fix a bug in a different part of the project, clear the context. This prevents the AI from mixing information and making mistakes due to context confusion.
Example
You just built a contact form. Now you want to fix the pricing page layout.
User: /clear
User: Make the pricing page layout responsive on mobile
Claude Code starts the task with no leftovers from the previous conversation. Full focus on what matters now.
A practical rule: if the new task is unrelated to the previous one, use /clear. If it is related and you want the AI to remember the context, stay in the same session or use /compact.
4. /compact — Compress History Without Losing What Matters
As the conversation grows, context eats tokens. /compact compresses the history: it keeps important decisions and information, removes the filler.
When to use it
When the conversation is getting long and you notice responses becoming slower or less accurate. Also useful before a big task — compressing frees up context space so the AI can work better.
You can include specific instructions about what to preserve:
Example
User: /compact keep the architecture decisions and config file changes
Claude Code rewrites the conversation summary, preserving the points you specified. The conversation continues normally but takes up less context space.
In practice, /compact is the command you will use most in long sessions. Think of it as "saving your progress" — the AI keeps what matters and discards the noise.
5. /cost — Track Your Spending
/cost shows how much you have spent in the current session. It displays token count and estimated cost in dollars.
When to use it
Regularly, especially if you are on the API plan with usage-based billing. Tasks involving many files or long conversations consume more tokens than you might expect.
Example
User: /cost
Session cost: $0.47
Tokens used: ~125,000 (input: 98,000, output: 27,000)
If the cost is climbing, consider using /compact to compress the conversation or /clear to start a new session.
A budget tip: for Max plan users with usage limits, /cost helps you spread consumption throughout the day. For API users billed per token, it is even more relevant — a careless session can cost more than it needs to.
6. /model — Pick the Right Model for Each Task
/model lets you switch AI models during a session. Each model has different strengths: Sonnet is faster and cheaper, Opus is more capable for complex tasks.
When to use it
Simple tasks like renaming variables, generating boilerplate, or writing basic tests? Sonnet handles it. Complex refactoring, architecture decisions, or tricky debugging? Opus is worth the extra cost.
Knowing when to switch models is one of the most effective ways to control costs without losing quality.
Example
User: /model sonnet
User: Create unit tests for the functions in utils/validation.ts
Then, for a more complex task:
User: /model opus
User: Refactor the authentication system to support social login with Google and GitHub
7. Natural Language — The Most Powerful of All
This is not a slash command. It is Claude Code's default mode. You describe what you want in plain English (or any language) and the AI executes: reads files, writes code, runs commands, creates tests.
When to use it
For virtually everything. Most of your interactions with Claude Code will be in natural language. Slash commands are support tools. The real work happens here.
Examples
Reading and analysis:
User: Read the README and explain the project structure to me
Building:
User: Create a pricing card component with three tiers: basic, pro, and enterprise. Use Tailwind CSS.
Bug fixing:
User: The payment module test is failing with "TypeError: Cannot read property 'id' of undefined". Investigate and fix it.
Refactoring:
User: Move all the validation logic scattered across components into a centralized file at lib/validators.ts
The key is being specific. "Improve the code" is vague. "Extract the date formatting logic into a utility function and add tests" is actionable.
Another tip: you can chain requests. "Create the component, add unit tests, and update the routes file to include it." Claude Code executes everything in sequence, file by file.
8. claude --resume — Pick Up Where You Left Off
The --resume flag when starting Claude Code opens a list of your previous conversations. You select one and continue where you left off, with the full context preserved.
When to use it
When you close the terminal (or the session expires) in the middle of a task. Or when you need to continue work from the previous day.
Example
claude --resume
Claude Code displays your recent sessions with a summary of each one. You navigate with arrow keys and select the one you want to resume.
It is also useful for revisiting earlier decisions. "What did we decide about the database schema?" — just resume the session where that discussion happened.
If you work on multiple projects throughout the day, --resume becomes essential. Each project has its own separate sessions, and you switch between them without losing your train of thought.
9. /review — Instant Code Review
/review asks Claude Code to analyze changes in your code. It reads the Git diffs and gives feedback on quality, potential bugs, broken patterns, and possible improvements.
When to use it
Before making a commit or opening a pull request. It is like having a teammate review your code instantly. It does not replace human code review on serious projects, but it catches 80% of the issues.
Example
User: /review
Claude Code analyzes the modified files and returns something like:
## Change Review
### src/lib/auth.ts
- Line 42: Password is not being hashed before saving.
Suggestion: use bcrypt.hash() before persisting to the database.
- Line 67: JWT token has no expiration set.
Suggestion: add expiresIn: '7d' to jwt.sign() options.
### src/components/login-form.tsx
- The form does not show an error message when login fails.
The error state is set but not rendered in JSX.
Fix the flagged issues and run /review again. Iterate until it is clean.
For solo builders, /review is particularly valuable. Entrepreneurs and freelancers do not have a team to review their code. The AI does not replace a senior dev, but it is infinitely better than no review at all.
10. /memory — Persistent Memory Across Sessions
/memory lets you manage Claude Code's persistent memory — information it remembers between sessions. This includes your preferences, work patterns, and notes you want it to always consider.
When to use it
When you want Claude Code to remember something permanently. For example: that you prefer Vitest over Jest, that your commit style follows Conventional Commits, or that you work with a monorepo.
Example
User: /memory
Claude Code displays saved memories and lets you add, edit, or remove entries. This information stays available in all future sessions, across any project.
The difference between /memory and CLAUDE.md: CLAUDE.md is project context (specific to one codebase). Memory is personal context (global, follows you across projects).
A practical example: if you always want Claude Code to respond in a certain language, save that to memory. If you want a specific project to use Tailwind v4, put that in the project's CLAUDE.md.
Bonus: Essential Shortcuts
Beyond the 10 commands above, three shortcuts are indispensable in daily use:
Escape — Cancels the current generation. The AI started responding with something wrong? Press Escape and rephrase your request. You do not lose the conversation history.
Ctrl+C — Exits Claude Code. Unlike Escape, which only cancels the response, Ctrl+C quits the tool entirely.
Permission system — Claude Code asks for confirmation before executing actions that modify files or run commands. Read what it is about to do before approving. You can configure permission rules in CLAUDE.md or in the settings. Early on, review every permission manually. As you build trust with the tool, adjust the rules to speed up your workflow.
Quick Reference
| Command | What it does | When to use it |
|---|---|---|
/init |
Generates CLAUDE.md from your project | Start of a new project |
/help |
Lists all commands | When you are lost |
/clear |
Clears conversation history | Between unrelated tasks |
/compact |
Compresses history | Long conversation or before a big task |
/cost |
Shows session spending | Budget tracking |
/model |
Switches AI model | Adjust cost vs. capability |
| Natural language | Describe task in plain text | For almost everything |
claude --resume |
Resumes previous session | Continue interrupted work |
/review |
Reviews code changes | Before commit or PR |
/memory |
Manages persistent memory | Save global preferences |
Next Steps
Now that you know the essential commands, two articles round out your learning:
- What is CLAUDE.md and Why It's Essential — Master the file that has the biggest impact on Claude Code's output quality.
- Your First App with Claude Code — Put these commands to work by building something real from scratch.
And if you want the complete walkthrough, section by section, the Claude Code Guide covers everything — from installation to deployment.
References
- Slash commands — Claude Code Docs — Official slash commands reference
- CLI reference — Claude Code Docs — Complete Claude Code CLI reference
- How Claude remembers your project — Claude Code Docs — Documentation on CLAUDE.md and /init