TL;DR
Mastering Claude Code commands transforms your developer productivity. This reference guide gathers all the essential commands for interacting with the AI, requesting code modifications, and driving your work sessions following the Explore → Plan → Code workflow.
Mastering Claude Code commands transforms your developer productivity. This reference guide gathers all the essential commands for interacting with the AI, requesting code modifications, and driving your work sessions following the Explore → Plan → Code workflow.
The commands for your first conversations in Claude Code form the basis of every productive exchange with the AI assistant. Claude Code (version 1.0+) offers a structured command set covering prompting in project context, session management, and technical task execution. over 78% of developers use fewer than 15 commands daily to cover all their needs.
What are the most commonly used commands in Claude Code?
Here is the quick reference table of commands you will use most often. Each command covers a concrete need of the daily workflow.
| Command | Description | Example |
|---|---|---|
/init | Creates the project CLAUDE.md file | $ claude then /init |
/help | Displays contextual help | /help in the chat |
/clear | Resets the conversation | /clear between two tasks |
/compact | Compacts the current context | /compact when context saturates |
/cost | Displays consumed tokens | /cost to track consumption |
/model | Changes the active model | /model claude-sonnet-4-6 |
/review | Launches a code review | /review on a Git diff |
/pr | Generates a complete pull request | /pr after a commit |
/bug | Reports a problem to Anthropic | /bug description of the issue |
| Escape | Cancels the current generation | Escape key |
In practice, these 10 commands cover approximately 90% of common interactions. To go further, check the complete slash command reference which details every available option.
Key takeaway: memorize these 10 commands and you will cover the majority of your daily needs with Claude Code.
How to master the art of prompting in project context?
Prompting in project context consists of formulating precise instructions while taking your codebase's architecture and conventions into account. Claude Code automatically analyzes your project to contextualize its responses.
Structure your prompts according to three levels of precision:
| Level | Prompt format | Expected result | Success rate |
|---|---|---|---|
| Vague | "Fix the bug" | Generic, poorly targeted response | ~35% |
| Contextual | "Fix the pagination bug in UserList.tsx" | Targeted fix, file identified | ~72% |
| Precise | "In UserList.tsx, pagination returns page 1 when offset > total. Fix the calculation on line 45." | Exact, verifiable fix | ~94% |
prompts over 20 words with an explicit target file achieve a 2.7x higher resolution rate than short prompts. Always name the file, function, or component concerned.
In practice, here is how to write an effective prompt:
# Contextual prompt with target file
$ claude "In src/api/auth.ts, add JWT validation
with 3600 second expiration. Use the jose v5.2 lib."
To explore best practices for writing prompts further, check the concrete first conversations examples which illustrate each precision level.
The CLAUDE.md file plays a central role in contextual prompting. It stores your project conventions - tech stack, code style, architectural patterns - so Claude Code applies them automatically. Initialize this file with /init from the first launch. The CLAUDE.md memory system guide explains how to configure it optimally.
Key takeaway: a precise prompt names the target file, describes the expected behavior, and mentions the technical constraints.
How to manage sessions and conversations effectively?
A Claude Code session corresponds to a continuous conversation with the AI in your terminal. Each session retains the context of previous exchanges until it is reset.
| Command | Syntax | Description | Shortcut |
|---|---|---|---|
/clear | /clear | Clears the session context | - |
/compact | /compact [instructions] | Summarizes and compacts the context | - |
/cost | /cost | Displays session tokens and cost | - |
/model | /model | Changes the model during a session | - |
/quit | /quit | Quits Claude Code | Ctrl+C x 2 |
--resume | $ claude --resume | Resumes the last session | - |
--continue | $ claude -c | Continues the previous conversation | -c |
The context window of Claude Opus 4.6 reaches 200,000 tokens, roughly 150,000 words. In practice, this represents between 45 minutes and 2 hours of intensive work before saturation.
Monitor your consumption with /cost regularly. When the context approaches its limit, Claude Code automatically compresses older messages. You can also force this compression with /compact.
# Resume a previous session
$ claude --resume
# Launch a session with an initial prompt
$ claude "Analyze the package.json file and list outdated dependencies"
# Compact the context with focus instructions
/compact "Keep only the context related to the REST API"
To avoid frequent errors related to context management, check the page on common mistakes in your first conversations which covers context saturation pitfalls.
Key takeaway: use /compact before context saturation and --resume to resume interrupted work.
How to request code changes with Claude Code?
Requesting code changes is at the heart of using Claude Code. The principle is simple: you describe the problem or desired solution, and Claude Code modifies your project files directly.
Formulate your request following the problem → solution → constraint pattern:
# Problem-solution pattern
$ claude "The contact form doesn't validate emails.
Add regex validation in ContactForm.tsx.
Use the same pattern as in LoginForm.tsx."
Here are the commands specific to code modification:
| Action | Command / Prompt | Result |
|---|---|---|
| Modify a file | "Modify function X in Y.ts" | Targeted edit with diff |
| Create a file | "Create a Button component in components/" | New file with content |
| Refactor | "Extract the business logic from Z.tsx into a hook" | Multi-file refactoring |
| Fix a bug | "Test UserService.test.ts fails at line 23, fix it" | Fix + verification |
| Code review | /review | Analysis of the current Git diff |
| Generate a PR | /pr | Complete PR with description |
In practice, Claude Code presents each modification as a diff before applying. You retain full control: accept, reject, or modify each proposed change. The permissions and security system lets you configure the level of autonomy granted to the AI.
developers who provide a test file as reference get compliant modifications in 89% of cases, versus 61% without a test file. Always reference an existing test or similar file in your prompt.
# Request a fix with test reference
$ claude "The test integration/payment.test.ts fails at line 47.
The error is 'TypeError: amount is undefined'.
Fix PaymentService.ts to handle the case where amount is null."
For a complete list of shortcuts and tips when modifying code, the slash command cheatsheet gathers the most useful combinations.
Key takeaway: the problem → solution → constraint pattern with a test file reference maximizes modification accuracy.
How to run commands and tests from Claude Code?
Claude Code can execute shell commands directly in your terminal. This capability covers launching tests, builds, Git commands, and any script in your project.
Request execution in natural language:
# Run tests
$ claude "Run unit tests with Jest and display coverage"
# Execute a build
$ claude "Build the project and fix TypeScript errors if any"
# Git command
$ claude "Create a feature/auth branch, commit the changes
with a descriptive message and push to origin"
Execution permissions work on a progressive approval model. Claude Code asks for your agreement before each shell command. You can pre-approve certain commands via the configuration file. The permissions and security cheatsheet details the configuration of these authorizations.
| Permission level | Behavior | Use case |
|---|---|---|
| Ask (default) | Asks confirmation for each command | Destructive commands, rm, git push |
| Auto-approve | Executes without confirmation | npm test, npm run build, linters |
| Deny | Blocks execution | Sensitive commands in CI/CD |
In practice, 67% of time saved with Claude Code comes from the automated "modify → test → fix" loop. Configure auto-approval for npm test and npm run lint to streamline this cycle.
# Auto-approval configuration in settings
$ claude config set autoApprove "npm test, npm run lint, npm run build"
The headless and CI/CD mode takes this logic even further by allowing fully automated execution in your continuous integration pipelines.
Key takeaway: configure auto-approval for test and build commands to accelerate the development cycle.
How to apply the Explore → Plan → Code workflow?
The Explore → Plan → Code workflow is the methodology recommended by Anthropic for complex tasks. It structures your interaction into three distinct phases that reduce errors and improve the quality of produced code.
Phase 1 - Explore: Claude Code analyzes your codebase to understand the architecture.
# Explore a project
$ claude "Analyze the project structure. Identify the architectural
patterns, main dependencies, and code conventions."
# Explore a specific problem
$ claude "Explore how authentication works in this project.
What files are involved? What flow does an authenticated request follow?"
Phase 2 - Plan: you and Claude Code co-build an action plan before any modification.
# Request an explicit plan
$ claude "Plan adding a Redis caching system for the /users API.
List the files to modify, dependencies to add, and tests to write.
Don't modify anything yet."
Phase 3 - Code: Claude Code implements the validated plan, file by file.
# Execute the plan
$ claude "Implement the Redis cache plan we just defined.
Start with the tests, then the service, then the controller."
the Explore → Plan → Code workflow reduces the number of iterations needed to reach a satisfactory result by 40% on tasks over 100 lines of code.
| Phase | Objective | Average duration | Associated commands |
|---|---|---|---|
| Explore | Understand the context | 2-5 min | Analysis prompt, /cost |
| Plan | Define the steps | 3-8 min | Planning prompt |
| Code | Implement | 5-30 min | Modification prompts, /review |
To discover complete examples of this workflow applied to real cases, the first conversations examples illustrate each phase with concrete projects. You can also check the general guide on your first conversations for a progressive introduction to this methodology.
Key takeaway: always separate exploration, planning, and implementation for tasks over 50 lines of code.
What command combinations accelerate your workflow?
Experienced developers chain multiple commands to create automated workflows. Here are the most effective combinations.
Combination 1 - Quick bug fix:
$ claude "The test users.test.ts fails. Explore the problem,
identify the cause and fix it. Run the tests after correction."
This combination merges the Explore and Code phases for simple bugs. Claude Code identifies the faulty file, applies the correction, and verifies the result in a single interaction.
Combination 2 - Review and improvement:
$ claude "/review then fix the critical issues identified.
Ignore the style suggestions."
Combination 3 - Project onboarding:
$ claude --resume # Resume the previous session
/clear # Start with a clean context
$ claude "Analyze this project. Describe the architecture, stack,
patterns used and generate a CLAUDE.md with /init."
Combination 4 - Delivery pipeline:
$ claude "Run the tests, fix errors if any,
then create a commit with a descriptive message and generate a PR."
In practice, the "test → fix → commit" combination reduces feature delivery time by 25% on average. The slash command tips present additional shortcuts to optimize these chains.
Key takeaway: combine commands into a single instruction to reduce back-and-forth and accelerate your development cycle.
What keyboard shortcuts should you know?
Claude Code integrates keyboard shortcuts that speed up navigation and control of your sessions. In 2026, the current version supports the following shortcuts in the terminal.
| Shortcut | Action | Context |
|---|---|---|
Escape | Cancels the current generation | During a response |
Ctrl+C | Interrupts the command / quits | At any time |
Ctrl+C x 2 | Forces Claude Code exit | At any time |
Tab | File auto-completion | Prompt input |
Up / Down | Navigates history | Prompt input |
Enter | Sends the message | Prompt input |
Shift+Enter | Line break without sending | Prompt input |
Ctrl+L | Clears the terminal screen | At any time |
Auto-completion via Tab is a major time saver: it works on file paths, Git branch names, and slash commands. using Tab reduces prompt input time by 30% for prompts containing file paths.
Use Escape as soon as you notice Claude Code heading in the wrong direction. This saves tokens and time. You can then rephrase your prompt and relaunch the generation.
To customize your shortcuts or add new ones, check the permissions and security tips which cover advanced interface configuration.
Key takeaway: Escape to cancel, Tab to complete, Shift+Enter for multi-line prompts - these three shortcuts transform your usage comfort.
How to go further with Claude Code and SFEIR Institute?
You now master the fundamental commands of Claude Code. To progress, structure your learning around three axes: automation, customization, and CI/CD integration.
SFEIR Institute offers the Claude Code training over 1 day, designed to practice these commands on real cases with guided labs. You will learn to configure your workflows, optimize your prompts, and integrate Claude Code into your daily development environment.
For developers wanting a broader approach to AI-assisted development, the AI-Augmented Developer 2-day training covers all the tools and methodologies of AI applied to code - from generation to debugging to automated review.
Developers already comfortable with the fundamentals can take the AI-Augmented Developer - Advanced 1-day training, focused on complex multi-agent workflows, headless mode, and integration into production pipelines.
In practice, each training includes at least 60% hands-on labs on real projects. Participants leave with a CLAUDE.md configured for their stack and ready-to-use prompt templates.
Key takeaway: guided practice with expert feedback accelerates Claude Code adoption - move from basic commands to advanced workflows with SFEIR Institute trainings.
Claude Code Training
Master Claude Code with our expert instructors. Practical, hands-on training directly applicable to your projects.
View program