返回播客Claude
Claude Code 101
你的第一个 Claude Code 提示词
You talk to Claude Code like you would talk to any AI assistant.
你与 Claude Code 对话,就像和任何 AI 助手对话一样。
When entering your prompt, here are some things that you can consider that can both protect and make things easier for you.
在输入提示词时,以下几点值得考虑,既能保护你,也能让事情变得更简单。
You can choose whether Claude auto accepts every file change it suggests or require it to ask you for explicit permission each time.
你可以选择让 Claude 自动接受它建议的每一处文件更改,或者要求它每次都向你请求明确授权。
With shift plus tab, you can cycle between both modes.
使用 shift+tab,你可以在两种模式之间切换。
In auto accept mode, it will automatically approve an edit or creation of a file, but ask your permission to run commands.
在 auto-accept 模式下,它会自动批准文件的编辑或创建,但运行命令时会征求你的许可。
There isn't a right or wrong way.
没有什么对或错的方式。
It's just whatever you feel the most comfortable with.
只要是你感觉最舒适的方式就好。
Within this shift tab menu is the plan mode.
在 shift+tab 菜单中,有 plan mode。
Plan mode takes your prompt and uses read-only tools to analyze your code base and do research on your suggested implementation.
plan mode 接收你的提示词,并使用只读工具来分析你的代码库,并对你建议的实现方案进行调研。
It will also ask you questions on items that it wants clarification on.
它还会就需要澄清的事项向你提问。
It then returns to you a long detailed plan that it can execute on in more detail.
然后,它会返回给你一份详尽的长计划,以便更细致地执行。
Plan mode works great for planning complex changes or doing a safe code review.
plan mode 非常适合规划复杂变更或进行安全的代码审查。
A lot of the time you're asking Claude to do multi-step implementations towards a feature and this is exactly what plan mode excels at.
很多时候你在要求 Claude 为某个功能做多步骤实现,而这正是 plan mode 擅长的地方。
So, why don't we give it a try?
那么,我们来试试吧?
I have an application here that desperately needs a dark mode toggle.
我这里有一个应用,迫切需要一个深色模式切换功能。
So, I'm going to use Claude Code to implement this for me.
所以,我打算用 Claude Code 来帮我实现这个功能。
So, I'm in the root directory of my project and I'm going to hit the shift tab a couple times to go into plan mode.
我现在在项目的根目录,我要按几次 shift+tab 进入 plan mode。
Then, let's write out the prompt.
然后,我们来写出提示词。
My app needs a dark mode implemented across the entire app.
我的应用需要在整个应用中实现深色模式。
Can you create a toggle switch on the header that allows user to toggle between light mode and dark mode?
你能在页眉处创建一个切换开关,让用户在浅色模式和深色模式之间切换吗?
I need you to find a good contrast color that works based on my existing light
我需要你根据我现有的浅色
And let's let Claude plan this out.
让我们让 Claude 来规划一下。
And after reviewing, I think it looks pretty good.
审阅之后,我觉得看起来不错。
At the end of all this, we can see explicitly what Claude did and how it came to its conclusion.
在这一切结束时,我们可以清楚地看到 Claude 做了什么,以及它是如何得出结论的。
And the dark mode is looking pretty good.
深色模式看起来相当不错。
When using Claude Code, try to be as descriptive as possible with your prompt.
使用 Claude Code 时,尽量在提示词中描述得越详细越好。
If you want to stay in the loop at every step, you can do that.
如果你想在每一步都保持参与,你可以这样做。
Use plan mode to let Claude get a little bit more in the nitty-gritty with what you want to achieve before executing on that plan.
使用 plan mode 让 Claude 在执行计划之前,更深入地了解你想要实现的目标。