Why know the native commands

Most devs who start using Claude Code do the same thing: open the terminal, typeclaudeand starts talking in natural language. Works. But what about how to useVS Codewithout knowing any keyboard shortcuts -- you can work, but you're using 30% of the potential.

The Claude Code has a set ofnative commands(accessible with/) that controls behavior, optimizes performance, reduces costs and automates workflows. Knowing them and the difference between using Claude Code as a chatbot and using it as aprofessional development tool.

In this guide, we'll cover the 10 most useful commands -- with explanations of what they do, when to use them, and practical examples with real output. In the end, you will learn how to create your own costm commands.

1
/help

Displays the complete list of available commands, including the project's costm slash commands.

When to use:Whenever you forget a command or want to see which costm slash commands are available in the current project.

claude >/helpAvailable commands:
  /help Show this help message
  /clear Clear conversation history
  /compact Compact conversation context
  /cost Show token usage and cost
  /doctor Check Claude Code health
  /init Initialize project with CLAUDE.md
  /config Open configuration
  /review Review code changes
  /pr-comments Show PR comments
  /login Authenticate with Anthropic
  /logout Sign out
  /quit Exit Claude Code

Project commands:
  /deploy Custom: deploy to production
  /test-all Custom: run full test suite

Note that in the output above, the last two commands (/deploy and /test-all) they arecostm slash commands-- created specifically for that project. We'll talk more about this in command 10.

2
/init

Create (or update) the fileCLAUDE.mdat the root of the project. This file works as an "instruction manual" that Claude Code automatically reads when starting a session in the directory.

When to use:The first time you use Claude Code in a project. Also when you want to update project instructions (e.g. change code standards, add rules).

claude >/initI'll analyze your project structure and create a CLAUDE.md file.

Analyzing...
- Detected: TypeScript + React project
- Package manager: pnpm
- Test framework: Vitest
- Linting: ESLint + Prettier

Created CLAUDE.md with:
- Project overview and architecture
- Code style guidelines
- Test conventions
- Build and deploy commands

The CLAUDE.mdand one of Claude Code's most powerful features. It allows you to define persistent rules: "always use single quotes", "tests must be in __tests__/", "never use any in TypeScript". Claude follows these instructions in all interactions within that project.

You can edit CLAUDE.md manually at any time. Think of it as the.editorconfigfrom Claude Code -- but much more powerful, because it accepts instructions in natural language.

3
/doctor

Diagnoses configuration and environmental problems. Checks authentication, version, API connection and permissions.

When to use:When something is not working as expected. Authentication error, slow responses, unexpected behavior.

claude >/doctorClaude Code Diagnostics
=======================

Version: 1.0.12 (latest)
Authentication: OK (API key valid)
Model access: claude-sonnet-4 (default)
                claude-opus-4 (available)
Connection: OK (latency: 142ms)
Node.js: v22.4.0
OS: macOS 15.3
Shell: /bin/zsh
Project: /Users/dev/my-app
CLAUDE.md: Found (1.2KB)
Permissions: Read/Write/Execute OK

All checks passed.

The /doctorand the first command to run when something goes wrong. It quickly identifies whether the problem is with authentication, network, version or configuration -- saving manual debugging time.

4
/cost

Shows token consumption and estimated cost of the current session. Essential for those who use the API and want to control expenses.

When to use:Periodically during long sessions. Especially before asking for tasks that involve a lot of files (refactoring an entire project, for example).

claude >/costSession Cost Summary
====================

Messages: 14
Input tokens: 48,230
Output tokens: 12,845
Cache read: 125,400
Cache write: 48,230

Estimated cost: $0.42

Model: claude-sonnet-4

Two important tips about cost:

  • Cache tokensThey are significantly cheaper than normal tokens. Claude Code uses caching aggressively -- that's why the second question about the same code is cheaper than the first.
  • Use Sonnet for routine tasksand switch to Opus only when you need deeper reasoning. The cost difference is substantial.
5
/compact

Compresses the conversation history, summarizing previous messages to free up space in the context window. Keep the essentials and discard redundant details.

When to use:When the conversation is long and you notice that Claude is "forgetting" previous instructions, or when you want to reduce costs in long sessions.

claude >/compactCompressing conversation...

Before: 156,240 tokens
After: 34,520 tokens (78% reduction)

Summary preserved:
- Project context and CLAUDE.md rules
- Key decisions made in this session
- Current task state and progress
- File modifications tracking

The /compactand one of the most underrated commands. In long development sessions (2+ hours), the context window fills up and the cost per message increases. Compressing periodically maintains the quality of responses and reduces costs.

You can also pass an instruction along:/compact focus on architectural decisions and ignore CSS details-- this way the summary prioritizes what is important for the next stage of the work.

Want to master this faster?

Everything you are learning here becomes 10x more powerful with ready-made skills. Instead of typing commands manually, skills do the heavy lifting for you. 748+ professional skills, installs in 2 minutes.

Quero as Skills — $9

6
/clear

Completely clears the chat history, starting from scratch. Different from/compact, does not preserve any summary.

When to use:When you finish a task and want to start another completely different one in the same project. Or when the context of the conversation became "polluted" with irrelevant information.

claude >/clearConversation cleared.

Note: CLAUDE.md and project context will be
reloaded on your next message.

The difference between/compact and /clearand important:

  • /compact= "summarize what we've done so far" (keeps context)
  • /clear= "forget everything, start from scratch" (restarts the conversation)

Use/clearbetween different tasks. Use/compactin the middle of a long task.

7
/review

Ask Claude to review pending code changes (staged and unstaged in git). Works as an automated code review.

When to use:Before committing. Before opening the PR. Whenever you want a second opinion on the changes you've made.

claude >/reviewReviewing changes in 4 files...

src/auth/jwt.ts
  Line 23: Potential security issue - token expiry
  is set to 30 days. Consider reducing to 24h for
  access tokens and using refresh tokens.

  Line 45: Good - proper error handling for invalid
  tokens.

src/auth/middleware.ts
  Line 12: The catch block swallows the error
  silently. Add logging or re-throw.

src/tests/auth.test.ts
  Line 8-34: Tests cover happy path but missing:
  - Expired token test
  - Malformed token test
  - Missing header test

Summary: 2 issues, 1 suggestion, 1 missing test
coverage area.

The /reviewand powerful because Claude has access tofull project context, not just diff. It knows what standards you follow (via CLAUDE.md), understands the architecture and can identify problems that a rushed human reviewer would miss.

8
/pr-comments

Search and display comments from GitHub pull requests. Useful for understanding feedback from reviewers and addressing them without leaving the terminal.

When to use:When you receive comments on a PR and want to resolve everything via Claude Code, without switching between browser and terminal.

claude >/pr-commentsPR #142: Add JWT authentication module

Comments (3):

@senior-dev (2h ago) on src/auth/jwt.ts:23
  "Should we use asymmetric keys (RS256) instead
   of symmetric (HS256) for better security?"

@tech-lead (1h ago) on src/auth/middleware.ts:12
  "Add structured logging here. We use pin."

@qa-engineer (30m ago) general
  "Can you add integration tests with the current
   auth flow?"

After viewing the comments, you can ask Claude to resolve them directly: "Address all comments from PR #142". It will modify the files, add tests and you just need to review and push.

9
/config

Open the Claude Code settings. Allows you to adjust default template, tool permissions, and behavior preferences.

When to use:To change the default model (Sonnet vs Opus), adjust command execution permissions, or configure global preferences.

claude >/configClaude Code Configuration
=========================

Model: claude-sonnet-4 (default)
Theme: dark
Auto-compact: after 100K tokens
Notification sound: enabled

Tool permissions:
  File read: always allow
  File write: ask first
  Shell commands: ask first
  Git operations: always allow

Open settings.json to edit? (y/n)

An important configuration:tool permissions. By default, Claude Code asks for confirmation before writing files or executing shell commands. You can configure it to always allow (complete trust) or always ask (maximum control). Adjust according to your comfort level.

10
Slash commands costmizados (skills)

The most powerful and least known feature: you can create your own commands by adding Markdown files to the folder.claude/commands/of the project.

When to use:For any task that you repeat frequently. Deploy, component generation, audits, code standards, team-specific workflows.

# File structure:.claude/
  commands/
    deploy.md-> /deploytest-all.md-> /test-allnew-component.md-> /new-componentaudit-security.md-> /audit-security

# Contents of .claude/commands/deploy.md:
Run the following deployment workflow:
1. Run the tests: npm test
2. If everyone passes, do build: npm run build
3. Deploy for production: npm run deploy
4. Check if the health check responds 200
5. Report final status

# Usage:
claude >/deployRunning deployment workflow...
[run tests - 47 passed]
[build - success]
[deploy - success]
[health check - 200 OK]

Deploy completed successfully.

Each file.mdin the folder.claude/commands/becomes a slash command. The file name (without extension) is the command name. The contents of the file are the instructions that Claude will follow.

And here the concept ofskillsbecomes transformative. Instead of creating generic commands, you can haveProfessional written instructions by expertswhich cover:

  • Complete context of the area (rules, good practices, common pitfalls)
  • Pre-defined templates and structures
  • Step-by-step workflows with validation
  • Quality criteria and checklist

For example, an “SEO Audit” skill is not just “analyze the page’s SEO”. It contains the 50+ checks that an SEO expert would perform, the scoring criteria, the report format and the recommendations prioritized by impact.

Creating skills from scratch requires hours of research and iteration. Or you can use ready-made professional skills -- written, tested and optimized for real results.

Bonus tip: command line flags

In addition to slash commands (used within the interactive session), Claude Code acceptsflags on the command linewhen started:

# Execute a single command without an interactive session
$claude -p "explains what this project does"# Use a specific model
$claude --model claude-opus-4# Input pipe (stdin)
$cat error.log | claude -p "analyzes this log and suggests fix"# Continue last conversation
$claude --continue# Resume a specific session
$claude --resume

The flag-p(print) is especially useful for integrating Claude Code into scripts and pipelines.CI/CD. You can create scripts that use Claude to automatically review code on each push, for example.

The flag--continueresumes the last conversation where it left off -- perfect when you accidentally close the terminal or need to continue a task the next day.

Next step: install skills and see the difference

You already know the basics. Now imagine Claude Code knowing how to do all this himself — SEO, copywriting, code review, deployment, data analysis. That's what skills do. Lifetime access, updates included.

Ver o Mega Bundle — $9

SPECIAL OFFER — LIMITED TIME

The Largest AI Skills Package on the Market

748+ Skills + 12 Bonus Packs + 120,000 Prompts

748+
Professional Skills
Marketing, SEO, Copy, Dev, Social
12
GitHub Bonus Packs
8,107 skills + 4,076 workflows
100K+
AI Prompts
ChatGPT, Claude, Gemini, Midjourney
135
Ready-Made Agents
Automation, data, business, dev

Was $39

$9

One-time payment • Lifetime access • Free updates

GET THE MEGA BUNDLE NOW

Install in 2 minutes • Works with Claude Code, Cursor, ChatGPT • 7-day guarantee

✓ SEO & GEO (20 skills) ✓ Copywriting (34 skills) ✓ Dev (284 skills) ✓ Social Media (170 skills) ✓ n8n Templates (4,076)

FAQ

The essentials for everyday life are:/init(configure project),/compact(manage context),/cost(monitor expenses),/review(automatic code review) and costmized slash commands for repetitive tasks. THE/doctorIt is essential when something goes wrong.

Create the folder.claude/commands/at the root of the project. Each Markdown (.md) file in this folder becomes a slash command. The file name and command name (ex:deploy.mdturn/deploy). The contents of the file are the instructions that Claude follows when executing the command.

Shows input tokens, output tokens, cache tokens (read and write) and the estimated cost in dollars of the current session. Values ​​are based on Anthropic API pricing. Useful for those who use the API and want to control expenses -- especially in long refactoring sessions.