How to Effectively Align Your Intent with Claude Code

How to Effectively Align Your Intent with Claude Code

如何有效地将你的意图与 Claude Code 对齐

LLM Applications How to Effectively Align Your Intent with Claude Code Improve your proficiency with Claude Code. Eivind Kjosbakken Aug 20, 2026 12 min read 大语言模型应用:如何有效地将你的意图与 Claude Code 对齐。提升你使用 Claude Code 的熟练度。作者:Eivind Kjosbakken,2026年8月20日,阅读时长 12 分钟。

In this article, I’ll discuss how to communicate better with your coding agents in order to get more done as an engineer. Image by ChatGPT. 在本文中,我将探讨如何与你的编程智能体(coding agents)进行更好的沟通,以便作为一名工程师能够完成更多工作。(图片由 ChatGPT 生成)

I spend a lot of time interacting with coding agents such as Claude Code and Codex. They have enormous benefits in increasing the speed at which I can get things done as an engineer. 我花费大量时间与 Claude Code 和 Codex 等编程智能体进行交互。它们在提高我作为工程师的工作效率方面有着巨大的优势。

There are numerous bottlenecks that I’ve experienced now that coding has become commoditized and we can write more code a lot faster with Claude Code and Codex. I’ve covered some of these bottlenecks before, in previous articles, with topics such as: Reviewing code, Deciding what to work on. 随着编程变得日益普及,且我们能够利用 Claude Code 和 Codex 更快地编写代码,我遇到过许多瓶颈。我曾在之前的文章中讨论过其中一些瓶颈,例如:代码审查、决定工作优先级。

However, there is a third one that I’ve definitely experienced more and more issues with, and I spent a lot of time thinking through how to optimize, and that is how to align my intent with Claude Code now that I spin up so many sessions. This infographic highlights the main contents, so in this article I’ll discuss how to align your intent with your coding agents to become more efficient at programming. Image by ChatGPT. 然而,我遇到了第三个问题,且情况愈发频繁。我花了很多时间思考如何优化它,那就是:当我开启如此多的会话时,如何将我的意图与 Claude Code 对齐。这张信息图突出了主要内容,因此在本文中,我将讨论如何将你的意图与编程智能体对齐,从而提高编程效率。(图片由 ChatGPT 生成)

When I say aligning my intent with Claude Code, what I mean is that Claude Code understands exactly what I want to implement and that Claude is thus able to make a lot of assumptions about how the implementation should be done. Essentially, Claude should understand what I want to implement and implement it as accurately as possible so that when I review the work afterward, I minimize the amount of stuff we have to tweak. 当我提到“将意图与 Claude Code 对齐”时,我的意思是 Claude Code 能准确理解我想要实现的目标,从而能够对实现方式做出许多合理的假设。本质上,Claude 应该理解我的意图并尽可能准确地完成实现,这样在我后续审查工作时,就能最大限度地减少需要修改的内容。

Why alignment is so important

为什么对齐如此重要

As usual, I like to cover why the topic I’m covering is so important. The reason alignment with Claude Code or coding agents in general is so important is that if your intents are not aligned with your coding agent, the coding agent will not implement what you expect it to implement or what you want it to implement. 像往常一样,我喜欢先说明我所讨论的主题为何如此重要。与 Claude Code 或一般编程智能体保持对齐之所以重要,是因为如果你的意图与智能体不一致,它就不会实现你期望或想要的功能。

A disconnect can, for example, take shape with the model not implementing the design as you want, not having the correct logic in the feature it’s implementing, and many other things. Essentially, it boils down to the fact that it now takes you, the human, more time to complete the task. 这种脱节可能表现为:模型没有按照你想要的方式实现设计,或者在实现功能时逻辑错误,等等。归根结底,这意味着作为人类的你,需要花费更多时间来完成任务。

Because when you spun up the task, you tried to share with the coding agent what you wanted to implement, and if you were not aligned, the agent implemented the wrong thing or implemented something incorrectly. In this situation, you had to go in, review the agent’s work, give feedback on what it did incorrectly and how to do it correctly next time, and then this process might have to continue for several more rounds until the agent has actually managed to implement what you wanted originally. 因为当你启动任务时,你试图告诉智能体你的实现目标;如果双方未对齐,智能体就会实现错误的内容或实现方式有误。在这种情况下,你必须介入,审查智能体的工作,指出错误并告知下次如何正确执行。这个过程可能需要重复多轮,直到智能体真正实现了你最初想要的结果。

Not being aligned with your coding agent costs a lot of time. And as you know, time has now become even more valuable, now that we can build even more stuff in a shorter amount of time, which is why you have to protect it as much as possible. And this is the reason that you should spend time optimizing how well you align with your coding agent. 与编程智能体未对齐会浪费大量时间。如你所知,时间现在变得更加宝贵,因为我们能在更短的时间内构建更多东西,这就是为什么你必须尽可能保护好时间。这也是你应该花时间优化与智能体对齐方式的原因。

I’ve tried a lot of different techniques and tests to see how to align best with my coding agent to make it complete work as effectively as possible, with a minimum amount of human interference. 我尝试了许多不同的技术和测试,以寻找与编程智能体对齐的最佳方式,从而使其在最少的人工干预下尽可能高效地完成工作。

How to align with your coding agent

如何与你的编程智能体对齐

Now let’s dive into how to align with your coding agents. In this section, I’ll cover a few different techniques, though I will spend most of the time optimizing the single most effective technique that I found to align with my coding agent and to understand its understanding of my tasks. First, however, I’ll cover some smaller techniques you can use to improve alignment with your coding agent. 现在让我们深入探讨如何与编程智能体对齐。在本节中,我将介绍几种不同的技术,但我会花大部分时间来优化我发现的最有效的一种技术,即如何与智能体对齐并了解它对任务的理解。不过,首先我将介绍一些可以用来改善对齐的小技巧。

Plan mode

计划模式 (Plan mode)

Plan mode is the first thing you can do. Plan mode is essentially where you have the agent do a read-only sweep of the repository and make a plan on how to implement the feature that you’re requesting. The good thing about plan mode is that the agent will now spend time asking you questions to make sure that it understands you correctly. “计划模式”是你首先可以尝试的方法。本质上,它是让智能体对代码库进行只读扫描,并为你请求的功能制定实现计划。计划模式的好处在于,智能体会花时间向你提问,以确保它正确理解了你的意图。

Having the coding agent ask you questions is a great technique to improve alignment. Instead of you having to ask the agent questions about how to do things or how it understands things, you should have the agent ask you questions, which is much quicker for you to answer and is overall a more effective technique to improve model alignment. 让智能体向你提问是提高对齐度的绝佳技巧。与其让你去问智能体该怎么做或它如何理解,不如让智能体来问你——这对你来说回答起来更快,总体上也是提高模型对齐度更有效的方法。

However, sometimes I don’t use plan mode for smaller tasks. I don’t think it’s necessary in a lot of cases because I believe I can make my initial prompt clear enough that the model and the agent don’t need planning or question-and-answer, and yeah, I think it’s mostly important for larger issues or tasks that you’re working on. 然而,对于较小的任务,我有时不会使用计划模式。我认为在很多情况下这没必要,因为我相信我可以让初始提示词足够清晰,从而无需模型进行规划或问答。我认为这主要适用于你正在处理的较大问题或任务。

Detailed prompts

详细的提示词 (Detailed prompts)

The second technique I want to cover is to make the prompt you provide your coding agent detailed. You should try to include as much context as possible. And this can be done in 2 main ways. One is that, of, you try to remember context yourself and explain it in your prompt. I think it’s worth noting here that the length of your prompt doesn’t really matter, you shouldn’t worry about adding too much text, as more context is usually simply better. 我想介绍的第二个技巧是让提供给编程智能体的提示词尽可能详细。你应该尽量包含尽可能多的上下文。这可以通过两种主要方式实现。第一种是,你自己尝试回忆上下文并在提示词中进行解释。值得注意的是,提示词的长度并不重要,你不必担心添加过多的文本,因为更多的上下文通常意味着更好的效果。

The second is that you should add context from different sources. So, for example, a good source might be a Slack message, which also includes some screenshots that are relevant for an implementation, or a Notion knowledge base that you should take into account, and so on. You should feed as much info as possible, for example, you should make sure the coding agent has access to all of these sources and tell it to use them actively during implementation and research. 第二种是添加来自不同来源的上下文。例如,一个好的来源可能是 Slack 消息(其中包含与实现相关的截图),或者是你需要考虑的 Notion 知识库等等。你应该尽可能多地提供信息,例如,确保编程智能体能够访问所有这些来源,并告知它在实现和研究过程中主动使用这些信息。

Sometimes, for example, I even make the prompts using a separate coding agent. So I make a separate coding agent present me with a detailed prompt for exactly the task I want to implement, which is basically like a pre-work agent and helps me make much clearer and more detailed prompts that includ… 有时,我甚至会使用另一个编程智能体来编写提示词。我会让一个独立的智能体为我想要实现的特定任务生成详细的提示词,这基本上就像一个“预处理智能体”,能帮助我编写更清晰、更详细的提示词,其中包含……