Essential commands 基本命令

Here are the most important commands for daily use:

以下是最重要的日常使用命令:

claude //Start interactive mode 启动交互模式

 

claude "task" //Run a one-time task 运行一次性任务,

如claude "fix the build error" //修复构建错误

 

claude -p "query" //Run one-off query, then exit 运行一次性查询,然后退出

如claude -p "explain this function" //解释这个函数

 

claude -c //Continue most recent conversation in current directory 在当前目录中继续最近的对话 

 

claude -r //Resume a previous conversation 恢复之前的对话

 

claude commit //Create a Git commit 创建一个 Git 提交

 

/clear //Clear conversation history 清除对话历史

 

/help //Show available commands 显示可用命令

 

exit or 按Ctrl+C //Exit Claude Code 退出 Claude Code

 

后面我们再学更多命令。

 

Pro tips for beginners 初学者的专业技巧

一,Be specific with your requests 你的需求要具体,比如

Instead of: “fix the bug”

不要直接说:“修复这个 bug”

Try: “fix the login bug where users see a blank screen after entering wrong credentials”

而是尝试:“修复登录时用户输入错误凭证后看到空白屏幕的 bug”

 

二,Use step-by-step instructions 使用分步说明,如

Break complex tasks into steps:

将复杂任务分解为多步:

> 1. create a new database table for user profiles

为用户信息创建一个新的数据库表

> 2. create an API endpoint to get and update user profiles

创建API端点来获取和更新用户信息

> 3. build a webpage that allows users to see and edit their information

建立一个网页,允许用户查看和编辑他们的信息

 

三,Let Claude explore first 让 Claude 先探索,先学习现有代码

Before making changes, let Claude understand your code:

在做出更改之前,让 Claude 理解您的代码:

> analyze the database schema

先分析数据库结构

> build a dashboard showing products that are most frequently returned by our UK customers

然后再指示Claude干活:建立一个仪表板,显示我们的英国客户最常退货的产品

四,Save time with shortcuts 使用快捷方式节省时间

Press ? to see all available keyboard shortcuts

按 ? 查看所有可用的键盘快捷键

Use Tab for command completion

使用 Tab 键进行命令补全

Press ↑ for command history

按 ↑ 键查看命令历史

Type / to see all slash commands

输入 / 查看所有斜杠命令

用好上面的这些快捷命令也会提高很大效率。

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐