我花了 4 个月的时间,每月 800 美元在 Cursor 和 Claude Code 上。后者更好吗?
1 分•作者: ianberdin•10 个月前
嗨,HN。
目前围绕着 Claude Code 和 AI 代理,整体上掀起了一股巨大的炒作浪潮。
在用 Cursor 四个月,用 Claude Code 一个月之后,我成了一个超级用户。之前我按使用量付费 Cursor,每月最多要花 700 美元,后来改用了他们的新订阅服务,过去一个月我一直在使用付费的 Claude Code 计划。我每天都用这些工具写代码,使用 Sonnet 4.0 和 Gemini 2.5 Pro。这是一份源于经验和挫折的指南。
首先,关于 Claude Code(CLI 代理)的评价。这个想法很棒——在终端上编程,甚至在服务器上。但在实践中,它很差劲。你无法轻松跟踪它的更改,几天之内,代码库就会变成一团乱七八糟的黑客行为和辅助手段。与 Cursor 相比,质量和生产力至少差了三倍。这是一种倒退。但它可以用来制作一次性的原型,而不用担心代码库。
现在,我们来谈谈 LLM。这是最重要的教训:模型不会思考。它们不是你的伙伴。它们是高度敏感的计算器。最好的比喻是时间旅行:改变过去的一个微小细节,整个未来都会不同。LLM 也是如此。你的输入上下文中一个微小的变化会完全改变输出。输入垃圾,输出垃圾。没有偷懒的余地。
理解这一点会改变一切。你不再希望 AI 会“搞清楚”,而是开始设计完美的输入。在我的编辑器和通过它们的 API 对 LLM 进行了广泛的工作之后,以下是获得高级代码而不是初级代码的不可协商的规则。
绝对的上下文是不可协商的。你必须在上下文中提供 99% 的相关代码。如果你遗漏了一点点,模型就不知道它的边界;它会产生幻觉来填补空白。这是错误的主要来源。
为 AI 重构你的代码。如果你的代码太大,无法放入上下文窗口(Cursor 的最大值为 20 万个 token),那么 LLM 对于复杂的任务就毫无用处。你必须编写干净、模块化的代码,将其分解成 AI 可以消化的小块。架构必须服务于 AI。
强制输入上下文。Cursor 试图通过限制它发送的上下文来节省资金。这是一个致命的缺陷。我构建了一个简单的 CLI 工具,它使用正则表达式来获取所有相关文件,将它们连接成一个文本块,并将其打印到我的终端。我复制整个 15 万到 20 万个 token 的块,并将其直接粘贴到聊天中。这是获得良好结果的最重要的技巧。
隔离任务。只给 LLM 一个你可以自己跟踪的小而孤立的工作。如果你无法定义任务的确切范围和边界,AI 就会失控,你最终会得到一团你无法解开的混乱。
“该死!重做。” 永远不要让 AI 修复它自己的错误代码。它只会越挖越深。如果输出是错误的,就完全放弃它。恢复更改,完善你的上下文和提示,然后从头开始。
与 LLM 合作就像处理一只具有攻击性的、强大的斗牛犬。你需要一个带刺的项圈——严格的规则和完美的上下文——来控制它。
查看原文
Hi HN.
There is a huge hype around Claude Code, and AI agents overall.<p>After four months with Cursor and one with Claude Code, I'm a super-user. I was paying up to $700/mo for Cursor on a usage basis before switching to their new subscription, and I've been on a paid Claude Code plan for the last month. I code every day with these tools, using Sonnet 4.0 and Gemini 2.5 Pro. This is a guide born from experience and frustration.<p>First, the verdict on Claude Code (the CLI agent). The idea is great—programming from the terminal, even on a server. But in practice, it's inferior. You can't easily track its changes, and within days, the codebase becomes a mess of hacks and crutches. Compared to Cursor, the quality and productivity are at least three times worse. It’s a step backward. But it is nice to make one-time prototypes without worrying about codebase.<p>Now, let's talk about LLMs. This is the most important lesson: models do not think. They are not your partner. They are hyper-sensitive calculators. The best analogy is time travel: change one tiny detail in the past, and the entire future is different. It’s the same with an LLM. One small change in your input context completely alters the output. Garbage in, garbage out. There is no room for laziness.<p>Understanding this changes everything. You stop hoping the AI will "figure it out" and start engineering the perfect input. After extensive work with LLMs both in my editor and via their APIs, here are the non-negotiable rules for getting senior-level code instead of junior-level spaghetti.<p>Absolute Context is Non-Negotiable. You must provide 99% of the relevant code in the context. If you miss even a little, the model will not know its boundaries; it will hallucinate to fill the gap. This is the primary source of errors.<p>Refactor Your Code for the AI. If your code is too large to fit in the context window (Cursor's max is 200k tokens), the LLM is useless for complex tasks. You must write clean, modular code broken into small pieces that an AI can digest. The architecture must serve the AI.<p>Force-Feed the Context. Cursor tries to save money by limiting the context it sends. This is a fatal flaw. I built a simple CLI tool that uses regex to grab all relevant files, concatenates them into a single text block, and prints it to my terminal. I copy this entire 150k-200k token block and paste it directly into the chat. This is the single most important hack for good results.<p>Isolate the Task. Only give the LLM a small, isolated piece of work that you can track yourself. If you can't define the exact scope and boundaries of the task, the AI will run wild and you will be left with a mess you can't untangle.<p>"Shit! Redo." Never ask the AI to fix its own bad code. It will only dig a deeper hole. If the output is wrong, scrap it completely. Revert the changes, refine your context and prompt, and start from scratch.<p>Working with an LLM is like handling an aggressive, powerful pitbull. You need a spiked collar—strict rules and perfect context—to control it.