Live data from Hacker News

Claude Code: Best practices for agentic coding

anthropic.com

141–150 of 268 posts

Re: Claude Code: Best practices for agentic coding

#141

Surprised that "controlling cost" isn't a section in this post. Here's my attempt. --- If you get a hang of controlling costs, it's much cheaper. If you're exhausting the context window, I would not be surprised if you're seeing high cost. Be aware of the "cache". Tell it to read specific files (and only those!), if you don't, it'll read unnecessary files, or repeatedly read sections of files or even search through f…

Never edit files manually during a session (that'll bust cache). THIS INCLUDES LINT

Yesterday I gave up and disabled my format-on-save config within VSCode. It was burning way too many tokens with unnecessary file reads after failed diffs. The LLMs still have a decent number of failed diffs, but it helps a lot.

Re: Claude Code: Best practices for agentic coding

#142
post #130
post #108

Earlier quoted context omitted.

I pretty much one shot a scraper from an old Joomla site with 200+ articles to a new WP site, including all users and assets, and converting all the PDFs to articles. It cost me like $3 in tokens.

I guess the question the is: can't VScode Copilot do the same for a fixed $20/month? It even has access to all SOTA models like Claude 3.7, Gemini 2.5 Pro and GPT o3

Vscode’s agent mode in copilot (even in the insider’s nightly) is a bit rough in my experience: lots of 500 errors, stalls, and outright failures to follow tasks (as if there’s a mismatch between what the ui says it will include in context vs what gets fed to the LLM).

Re: Claude Code: Best practices for agentic coding

#143
post #130
post #108

Earlier quoted context omitted.

I pretty much one shot a scraper from an old Joomla site with 200+ articles to a new WP site, including all users and assets, and converting all the PDFs to articles. It cost me like $3 in tokens.

I guess the question the is: can't VScode Copilot do the same for a fixed $20/month? It even has access to all SOTA models like Claude 3.7, Gemini 2.5 Pro and GPT o3

I haven't tried copilot. Mostly because I don't use VSCode, I use jetbrains ides. How do they provide Claude 3.7 for $20/mo with unlimited usage?

Re: Claude Code: Best practices for agentic coding

#144
post #56

Earlier quoted context omitted.

Oh wow. Reading your comment guarantees I'll never use Claude Code. I use Aider. It's awesome. You explicitly specify the files. You don't have to do work to limit context.

Aider is a great tool. I do love it. But I find I have to do more with it to get the same output as Claude Code (no matter what LLM I used with Aider). Sure it may end up being cheaper per run, but not when my time is factored in. The flip side is I find Aider much easier to limit.

What are those extra things you have to do more of? I only have experience with Aider so I am curious what I am missing here.

Re: Claude Code: Best practices for agentic coding

#145
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's an amazing experience. If this is any measure - I've been averaging about 5-6 "small features" 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 only worked on fe without any backend and flushed it out before starting on an backend.

Re: Claude Code: Best practices for agentic coding

#146

Earlier quoted context omitted.

And how much did these two MVPs make in sales? If they just helped you to ship something valueless, you paid $75 for entertainment, like betting.

You can now do 30 MVPs in a month instead of just one.

Reminds me of https://www.reddit.com/r/comics/comments/d1sm26/behold_the_u...

Re: Claude Code: Best practices for agentic coding

#147
post #137
post #136

Earlier quoted context omitted.

> So, AIs are overeager junior developers at best, and not the magical programmer replacements they are advertised as. This may be a quick quip or a rant. But the things we say have a way of reinforcing how we think. So I suggest refining until what we say cuts to the core of the matter. The claim above is a false dichotomy. Let's put aside advertisements and hype. Trying to map between AI capabilities and human ones…

[flagged]

Don’t be a dismissive dick; that’s not appropriate for this forum. The above post is clearly trying to engage thoughtfully and offers genuinely good advice.

Re: Claude Code: Best practices for agentic coding

#148
post #98
post #89

Earlier quoted context omitted.

That's why I like Aider. You can protect your files in a non-AI way: by simply not giving write access to Aider. Also, apparently Aider is a bit more economic with tokens than other tools.

I haven't used Aider yet, but I see it show up on HN frequently recently (the last couple of days specifically). I am hesitant because I am paying for Cursor now and I get a lot of model usage included within that monthly cost. I'm cheap, perhaps to a fault even when I could afford it, and I hate the idea of spending twice when spending once is usually enough. So while Aider is potentially cheaper than Claude Code, i…

With Aider you pay API fees only. You can get simple tasks done for a few dollars. I suggest budgeting $20 or so dollars and giving it a go.

Re: Claude Code: Best practices for agentic coding

#149
The "ultrathink" thing is pretty funny:

> We recommend using the word "think" 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: "think" I had a poke around and it's not a feature of the Claude model, it's specific to Claude Code. There's a "megathink" option too - it uses code that looks like this:

  let B = W.message.content.toLowerCase();
  if (
    B.includes("think harder") ||
    B.includes("think intensely") ||
    B.includes("think longer") ||
    B.includes("think really hard") ||
    B.includes("think super hard") ||
    B.includes("think very hard") ||
    B.includes("ultrathink")
  )
    return (
      l1("tengu_thinking", { tokenCount: 31999, messageId: Z, provider: G }),
      31999
    );
  if (
    B.includes("think about it") ||
    B.includes("think a lot") ||
    B.includes("think deeply") ||
    B.includes("think hard") ||
    B.includes("think more") ||
    B.includes("megathink")
  )
    return (
      l1("tengu_thinking", { tokenCount: 1e4, messageId: Z, provider: G }), 1e4
    );
Notes on how I found that here: https://simonwillison.net/2025/Apr/19/claude-code-best-pract...

Re: Claude Code: Best practices for agentic coding

#150
post #56

Surprised that "controlling cost" isn't a section in this post. Here's my attempt. --- If you get a hang of controlling costs, it's much cheaper. If you're exhausting the context window, I would not be surprised if you're seeing high cost. Be aware of the "cache". Tell it to read specific files (and only those!), if you don't, it'll read unnecessary files, or repeatedly read sections of files or even search through f…

Oh wow. Reading your comment guarantees I'll never use Claude Code. I use Aider. It's awesome. You explicitly specify the files. You don't have to do work to limit context.

With Claude Code you can at least type "/code" at any point to see how much it's spent, and it will show you when you end a session (with Ctrl+C) too.

The output of /cost looks like this:

  > /cost 
    ⎿  Total cost: $0.1331
       Total duration (API): 1m 13.1s
       Total duration (wall): 1m 21.3s
Post reply on HN