Claude Code Cli
Unlike the web version of Claude, Claude Code is not merely a chat tool, but a **development collaboration system with engineering context, permission control, and execution capabilities**.
Therefore, when handling tasks, it introduces three core **thinking modes**:
* **Ask**
* **Plan**
* **Edit**
**Understanding the boundaries and responsibilities of these three modes is key to using Claude Code efficiently and safely.**
You don't need to manually switch modes in the terminal; Claude will automatically switch. In the VS Code extension, you can manually switch modes:
!(#)
* * *
## Detailed Explanation of the Three Interaction Modes
When using Claude Code in the terminal, you **don't need to manually toggle mode switches**. Claude will automatically determine which mode to enter based on your instruction content.
However, **as a user, you must clearly express your intent in the Prompt**, otherwise Claude is likely to behave inconsistently with your expectations.
### 1. Ask Mode: Look but Don't Touch (Read-Only Analysis)
**Ask mode is Claude Code's default safe mode.**
#### Usage Scenarios
When you are in the following states, you should prioritize using Ask mode:
* Don't understand existing code
* Just took over a new project
* Want to locate the cause of a bug, but haven't figured out how to fix it yet
* Want to confirm whether certain logic is reasonable
#### Mode Characteristics
* Claude **can read code**
* Can perform analysis, explanation, and reasoning
* **Will absolutely not modify any files**
* Will not execute any Shell commands
You can think of Ask mode as:
> **A highly experienced senior engineer with hands behind their back.**
#### Example Instructions
Explain the JWT verification process in src/auth.ts
Where is the database connection initialized in this project?
Why might this code have issues under high concurrency?
> Professional advice:
>
> **When unsure whether to modify code, always Ask first.**
* * *
### 2. Plan Mode: Plan Before Acting (Planning Only, No Execution)
**Plan mode is the most architect-like thinking mode in Claude Code.**
#### [](#) Usage Scenarios
When facing **complex or wide-ranging changes**, you should use Plan mode, such as:
* Adding a core module
* Refactoring existing interfaces or business processes
* Introducing new technologies (caching, middleware, authentication solutions, etc.)
* Modifications involving multiple files and layers
#### [](#) Mode Characteristics
* Claude will not directly modify code
* Will first provide a **complete implementation plan**
* Usually presented in the form of a step list (TODO List)
* Only after you confirm the plan will it enter the Edit phase for execution
The core value of Plan mode is:
> **Turning code-first into consensus-first.**
#### Example Instructions
I want to add a Redis caching layer to the existing API, please give me an implementation plan first
Plan how to convert this project's styles from CSS to Tailwind CSS
If I want to split this module, what would be the reasonable steps?
> Practical advice:
>
> **The more you use Plan mode, the lower your rework probability.**
### 3. Edit Mode: Direct Execution (Can Write Code)
**Edit mode is when Claude Code truly gets to work.**
#### Usage Scenarios
When you clearly know:
* What to change
* What to change it to
* That the change risk is controllable
Then you can directly enter Edit mode.
#### Mode Characteristics
* Claude will locate relevant files
* Generate precise Diffs (differential modifications)
* May request to execute commands like testing, building, etc.
* All write operations require your confirmation
In Edit mode, your role is:
> **The final code reviewer, not a bystander.**
#### Example Instructions
Change the login interface response code from 200 to 201
Fix the type error on line 45 of main.py
Refactor this function's readability without changing existing behavior
> Professional habit:
>
> **The more specific your description, the safer Claude's modifications.**
* * *
## Core Slash Commands (`/`)
Slash commands are used to **control Claude Code's session state and behavior**, not to write business code.
Type `/` in the terminal to trigger them.
!(#)
| Command | Purpose | Expert Tip |
| --- | --- | --- |
| `/help` | View all commands | Essential for first-time users |
| `/cost` | Check current session consumption | Prevent unconscious token burning |
| `/compact` | Compress context | Use when conversation becomes long and slow |
| `/reset` | Reset session | Very important when switching tasks |
| `/docs` | Index documents | Let Claude reference specified documents |
| `/review` | Code review | Check Git staging area changes |
> Recommendation:
>
> **/cost and /compact are high-frequency commands for long-term users.**
* * *
## A Typical Interaction Flow Example
In real development, the three modes are often **used consecutively**.
### Example Flow
**1. Ask**
Why does my registration interface keep returning 400 errors?
_Claude analyzes code and logs, pointing out missing email validation._
**2. Plan**
I want to add email format validation and standardize error messages, what do you plan to do?
_Claude provides steps: modify validation logic β update tests β adjust response structure._
**3. Edit**
Execute according to the plan
_Claude modifies files and shows Diff for your confirmation._
> **Ask is about understanding the problem, Plan is about avoiding detours, Edit is about cautious execution.**
* * *
## Permission Confirmation Mechanism in Interactions
Claude Code is very restrained regarding system operations; any risky behavior will request your confirmation.
### Common Permission Confirmations
* **Writing files**
Will display code Diff, which requires your confirmation before writing.
* **Executing commands**
For example, `npm test`, `pnpm build`, will explicitly ask for permission.
> **Important reminder:**
>
> Never confirm without looking at the Diff.
>
> Claude is powerful, but can still produce errors or hallucinations.
YouTip