TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Claude Code: Best practices for agentic coding

614 点作者 sqs25 天前

24 条评论

simonw25 天前
The &quot;ultrathink&quot; thing is pretty funny:<p>&gt; We recommend using the word &quot;think&quot; to trigger extended thinking mode, which gives Claude additional computation time to evaluate alternatives more thoroughly. These specific phrases are mapped directly to increasing levels of thinking budget in the system: &quot;think&quot; &lt; &quot;think hard&quot; &lt; &quot;think harder&quot; &lt; &quot;ultrathink.&quot; Each level allocates progressively more thinking budget for Claude to use.<p>I had a poke around and it&#x27;s not a feature of the Claude model, it&#x27;s specific to Claude Code. There&#x27;s a &quot;megathink&quot; option too - it uses code that looks like this:<p><pre><code> let B = W.message.content.toLowerCase(); if ( B.includes(&quot;think harder&quot;) || B.includes(&quot;think intensely&quot;) || B.includes(&quot;think longer&quot;) || B.includes(&quot;think really hard&quot;) || B.includes(&quot;think super hard&quot;) || B.includes(&quot;think very hard&quot;) || B.includes(&quot;ultrathink&quot;) ) return ( l1(&quot;tengu_thinking&quot;, { tokenCount: 31999, messageId: Z, provider: G }), 31999 ); if ( B.includes(&quot;think about it&quot;) || B.includes(&quot;think a lot&quot;) || B.includes(&quot;think deeply&quot;) || B.includes(&quot;think hard&quot;) || B.includes(&quot;think more&quot;) || B.includes(&quot;megathink&quot;) ) return ( l1(&quot;tengu_thinking&quot;, { tokenCount: 1e4, messageId: Z, provider: G }), 1e4 ); </code></pre> Notes on how I found that here: <a href="https:&#x2F;&#x2F;simonwillison.net&#x2F;2025&#x2F;Apr&#x2F;19&#x2F;claude-code-best-practices&#x2F;" rel="nofollow">https:&#x2F;&#x2F;simonwillison.net&#x2F;2025&#x2F;Apr&#x2F;19&#x2F;claude-code-best-pract...</a>
评论 #43740108 未加载
评论 #43741086 未加载
评论 #43740972 未加载
评论 #43741482 未加载
评论 #43743221 未加载
评论 #43744304 未加载
评论 #43740843 未加载
评论 #43740650 未加载
评论 #43745145 未加载
jasonjmcghee25 天前
Surprised that &quot;controlling cost&quot; isn&#x27;t a section in this post. Here&#x27;s my attempt.<p>---<p>If you get a hang of controlling costs, it&#x27;s much cheaper. If you&#x27;re exhausting the context window, I would not be surprised if you&#x27;re seeing high cost.<p>Be aware of the &quot;cache&quot;.<p>Tell it to read specific files (and only those!), if you don&#x27;t, it&#x27;ll read unnecessary files, or repeatedly read sections of files or even search through files.<p>Avoid letting it search - even halt it. Find &#x2F; rg can have a thousands of tokens of output depending on the search.<p>Never edit files manually during a session (that&#x27;ll bust cache). THIS INCLUDES LINT.<p>The cache also goes away after 5-15 minutes or so (not sure) - so avoid leaving sessions open and coming back later.<p>Never use &#x2F;compact (that&#x27;ll bust cache, if you need to, you&#x27;re going back and forth too much or using too many files at once).<p>Don&#x27;t let files get too big (it&#x27;s good hygiene too) to keep the context window sizes smaller.<p>Have a clear goal in mind and keep sessions to as few messages as possible.<p>Write &#x2F; generate markdown files with needed documentation using claude.ai, and save those as files in the repo and tell it to read that file as part of a question. I&#x27;m at about ~$0.5-0.75 for most &quot;tasks&quot; I give it. I&#x27;m not a super heavy user, but it definitely helps me (it&#x27;s like having a super focused smart intern that makes dumb mistakes).<p>If i need to feed it a ton of docs etc. for some task, it&#x27;ll be more in the few $, rather than &lt; $1. But I really only do this to try some prototype with a library claude doesn&#x27;t know about (or is outdated). For hobby stuff, it adds up - totally.<p>For a company, massively worth it. Insanely cheap productivity boost (if developers are responsible &#x2F; don&#x27;t get lazy &#x2F; don&#x27;t misuse it).
评论 #43741629 未加载
评论 #43737540 未加载
评论 #43738713 未加载
评论 #43738726 未加载
评论 #43738657 未加载
评论 #43740501 未加载
评论 #43737163 未加载
评论 #43738792 未加载
评论 #43739576 未加载
评论 #43738446 未加载
zoogeny25 天前
So I have been using Cursor a lot more in a vibe code way lately and I have been coming across what a lot of people report: sometimes the model will rewrite perfectly working code that I didn&#x27;t ask it to touch and break it.<p>In most cases, it is because I am asking the model to do too much at once. Which is fine, I am learning the right level of abstraction&#x2F;instruction where the model is effective consistently.<p>But when I read these best practices, I can&#x27;t help but think of the cost. The multiple CLAUDE.md files, the files of context, the urls to documentation, the planning steps, the tests. And then the iteration on the code until it passes the test, then fixing up linter errors, then running an adversarial model as a code review, then generating the PR.<p>It makes me want to find a way to work at Anthropic so I can learn to do all of that without spending $100 per PR. Each of the steps in that last paragraph is an expensive API call for us ISV and each requires experimentation to get the right level of abstraction&#x2F;instruction.<p>I want to advocate to Anthropic for a scholarship program for devs (I&#x27;d volunteer, lol) where they give credits to Claude in exchange for public usage. This would be structured similar to creator programs for image&#x2F;audio&#x2F;video gen-ai companies (e.g. runway, kling, midjourney) where they bring on heavy users that also post to social media (e.g. X, TikTok, Twitch) and they get heavily discounted (or even free) usage in exchange for promoting the product.
评论 #43738017 未加载
评论 #43739088 未加载
评论 #43738345 未加载
bob102924 天前
I&#x27;ve developed a new mental model of the LLM codebase automation solutions. These are effectively identical to outsourcing your product to someone like Infosys. From an information theory perspective, you need to communicate approximately the same amount of things in either case.<p>Tweaking claude.md files until the desired result is achieved is similar to a back and forth email chain with the contractor. The difference being that the contractor can be held accountable in our human legal system and can be made to follow their &quot;prompt&quot; very strictly. The LLM has its own advantages, but they seem to be a subset since the human contractor can also utilize an LLM.<p>Those who get a lot of uplift out of the models are almost certainly using them in a cybernetic manner wherein the model is an integral part of an expert&#x27;s thinking loop regarding the program&#x2F;problem. Defining a pile of policies and having the LLM apply them to a codebase automatically is a significantly less impactful use of the technology than having a skilled human developer leverage it for immediate questions and code snippets as part of their normal iterative development flow.<p>If you&#x27;ve got so much code that you need to automate eyeballs over it, you are probably in a death spiral already. The LLM doesn&#x27;t care about the terrain warnings. It can&#x27;t &quot;pull up&quot;.
评论 #43744787 未加载
评论 #43743216 未加载
评论 #43743731 未加载
评论 #43743439 未加载
flashgordon25 天前
So I feel like a grandpa reading this. I gave Claude code a solid shot. Had some wins but costs started blowing up. I switched to Gemini AI where I only upload files I want it to work on and make sure to refactor often so modularity remains fairly high. It&#x27;s an amazing experience. If this is any measure - I&#x27;ve been averaging about 5-6 &quot;small features&quot; per 10k tokens. And I totally suck at fe coding!! The other interesting aspect of doing it this way is being able to break up problems and concerns. For example in this case I <i>only</i> worked on fe without any backend and flushed it out before starting on an backend.
评论 #43742014 未加载
评论 #43740230 未加载
bugglebeetle25 天前
Claude Code works fairly well, but Anthropic has lost the plot on the state of market competition. OpenAI tried to buy Cursor and now Windsurf because they know they need to win market share, Gemini 2.5 pro is better at coding than their Sonnet models, has huge context and runs on their TPU stack, but somehow Anthropic is expecting people to pay $200 in API costs per functional PR costs to vibe code. Ok.
评论 #43739030 未加载
sbszllr25 天前
The issue with many of these tips is that they require you use to claude code (or codex cli, doesn&#x27;t matter) to spend way more time in it, feed it more info, generate more outputs --&gt; pay more money to the LLM provider.<p>I find LLM-based tools helpful, and use them quite regularly but not 20 bucks+, let alone 100+ per month that claude code would require to be used effectively.
评论 #43739551 未加载
评论 #43737023 未加载
joshstrange25 天前
The most interesting part of this article for me was:<p>&gt; Have multiple checkouts of your repo<p>I don’t know why this never occurred to me probably because it feels wrong to have multiple checkouts, but it makes sense so that you can keep each AI instance running at full speed. While LLM‘s are fast, this is one of the annoying parts of just waiting for an instance of Aider or Claude Code to finish something.<p>Also, I had never heard of git worktrees, that’s pretty interesting as well and seems like a good way to accomplish effectively having multiple checkouts.
评论 #43748980 未加载
评论 #43736112 未加载
remoquete25 天前
What&#x27;s the Gemini equivalent of Claude Code and OpenAI&#x27;s Codex? I&#x27;ve found projects like reugn&#x2F;gemini-cli, but Gemini Code Assist seems limited to VS Code?
评论 #43736983 未加载
评论 #43736866 未加载
评论 #43737137 未加载
0x696C696125 天前
I mostly work in neovim, but I&#x27;ll open cursor to write boilerplate code. I&#x27;d love to use something cli based like Claude Code or Codex, but neither of them implement semantic indexing (vector embeddings) the way Cursor does. It should be possible to implement an MCP server which does this, but I haven&#x27;t found a good one.
评论 #43737570 未加载
评论 #43737577 未加载
评论 #43740260 未加载
beefnugs25 天前
Isn&#x27;t this bad that every model company is making their own version of the IDE level tool?<p>Wasn&#x27;t it clearly bad when facebook would get real close to buying another company... then decide naw, we got developers out the ass lets just steal the idea and put them out of business
jwr25 天前
I use Claude Code. I read the discussion here, and given the criticism, proceeded to try some of the other solutions that people recommended.<p>After spending a couple of hours trying to get aider and plandex to run (and then with Google Gemini 2.5 pro), my conclusion is that these tools have a <i>long</i> way to go until they are usable. The breakage is all over the place. Sure, there is promise, but today I simply can&#x27;t get them to work reasonably. And my time is expensive.<p>Claude Code just works. I run it (even in a slightly unsupported way, in a Docker container on my mac) and it works. It does stuff.<p>PS: what is it with all &quot;modern&quot; tools asking you to &quot;curl somewhere.com&#x2F;somescript.sh | bash&quot;. Seriously? Ship it in a docker container if you can&#x27;t manage your dependencies.
fallinditch25 天前
I&#x27;m wondering how much of the techniques described in this blog post can be used in an IDE like Windsurf or Cursor with Claude Sonnet?<p>My 2 cents on value for money and effectiveness of Claude vs Gemini for coding:<p>I&#x27;ve been using Windsurf, VS Code and the new Firebase Studio. The Windsurf subscription allowance for $15 per month seems adequate for reasonable every day use. I find Claude Sonnet 3.7 performs better for me than Gemini 2.5 pro experimental.<p>I still like VS Code and its way of doing things, you can do a lot with the standard free plan.<p>With Firebase Studio, my take is that it should good for building and deploying simple things that don&#x27;t require much developer handholding.
kkukshtel24 天前
I recently wrote a big blog post on my experience spending about $200 with Claude Code to &quot;vibecode&quot; some major feature enhancements for my image gallery site mood.site<p><a href="https:&#x2F;&#x2F;kylekukshtel.com&#x2F;vibecoding-claude-code-cline-sonnet-ai-programming-gpt-mood" rel="nofollow">https:&#x2F;&#x2F;kylekukshtel.com&#x2F;vibecoding-claude-code-cline-sonnet...</a><p>Would definitely recommend people reading it for some insight into hands on experience with the tool.
m00dy25 天前
well, the best practice is to use gemini 2.5 pro instead :)
评论 #43737032 未加载
andrewstuart25 天前
I’m too scared of the cost to use this.
评论 #43740262 未加载
submeta24 天前
I love Claude Code. It just gets the job done where Cursor (even with Claude Sonnet 3.7) will get lost in changing files without results.<p>Did anyone have equal results with the „unofficial“ fork „Anon Kode“? Or with Roo Code with Gemini Pro 2.5?
panny25 天前
&gt;Use Claude to interact with git<p>Are they saying Claude needs to do the git interaction in order to work and&#x2F;or will generate better code if it does?
评论 #43741646 未加载
ccarse22 天前
What are these &quot;subagents&quot; this doc refers to?
Wowfunhappy25 天前
&gt; Use &#x2F;clear to keep context focused<p>The only problem is that this loss is permanent! As far as I can tell, there&#x27;s no way to go back to the old conversation after a `&#x2F;clear`.<p>I had one session last week where Claude Code seemed to have become amazingly capable and was implementing entire new features and fixing bugs in one-shot, and then I ran `&#x2F;clear` (by accident no less) and it suddenly became very dumb.
评论 #43737592 未加载
评论 #43737408 未加载
imafish24 天前
Why do people use Claude Code over e.g. Cursor or Windsurf?
评论 #43754095 未加载
LADev25 天前
This is so helpful!
babuloseo24 天前
This is a pretty desperate post imho.
zomglings25 天前
If anyone from Anthropic is reading this, your billing for Claude Code is hostile to your users.<p>Why doesn’t Claude Code usage count against the same plan that usage of Claude.ai and Claude Desktop are billed against?<p>I upgraded to the $200&#x2F;month plan because I really like Claude Code but then was so annoyed to find that this upgrade didn’t even apply to my usage of Claude Code.<p>So now I’m not using Claude Code so much.
评论 #43737332 未加载
评论 #43737172 未加载
评论 #43737040 未加载
评论 #43737022 未加载
评论 #43736860 未加载
评论 #43736952 未加载
评论 #43738479 未加载
评论 #43736962 未加载