9 ms·
Hey, Boris from the Claude Code team here. A few tips: 1. If there is anything Claude tends to repeatedly get wrong, not understand, or spend lots of tokens on
by bcherny 10mo ago
Hey, Boris from the Claude Code team here. A few tips:
1. If there is anything Claude tends to repeatedly get wrong, not understand, or spend lots of tokens on, put it in your CLAUDE.md. Claude automatically reads this file and it’s a great way to avoid repeating yourself. I add to my team’s CLAUDE.md multiple times a week.
2. Use Plan mode (press shift-tab 2x). Go back and forth with Claude until you like the plan before you let Claude execute. This easily 2-3x’s results for harder tasks.
3. Give the model a way to check its work. For svelte, consider using the Puppeteer MCP server and tell Claude to check its work in the browser. This is another 2-3x.
4. Use Opus 4.5. It’s a step change from Sonnet 4.5 and earlier models.
Hope that helps!
- dotancohen 10mo ago> I add to my team’s CLAUDE.md multiple times a week. How big is that file now? How big is too big?
- bcherny 10mo agoTry to keep it under 1k tokens or so. We will show you a warning if it might be too big. Ours is maybe half that size. We remove from it with every model release since smarter models need less hand-holding. You can also break up your CLAUDE.md into smaller files, link CLAUDE.mds, or lazy load them only when Claude works in nested dirs. https://code.claude.com/docs/en/memory https://code.claude.com/docs/en/memory
- tomviner 10mo agoHow do you know what to remove?
- blobbers 10mo ago1k tokens, google says thats about 750 words. That's actually pretty short, any chance you could post a few samples of instructions or even link to a publicly available file CLAUDE.md you recommend?
- dotancohen 10mo agoThat is seriously short. I've asked Claude Code to add instructions to CLAUDE.md and my one line request has resulted in tens of lines added to the file.
- songodongo 10mo ago[flagged]
- SatvikBeri 10mo agoMine is 24 lines long. It has a handful of stuff, but does refer to other MD files for more specifics when needed (like an early version of skills.) This is the meat of it: ## Code Style (See JULIA_STYLE.md for details) - Always use explicit `return` statements - Use Float32 for all numeric computations - Annotate function return types with `::` - All `using` statements go in Main.jl only - Use `error()` not empty returns on failure - Functions >20 lines need docstrings ## Do's and Don'ts - Check for existing implementations first - Prefer editing existing files - Don't add comments unless requested - Don't add imports outside Main.jl - Don't create documentation unless requested Since Opus 4.0 this has been enough to get it to write code that generally follows our style, even in Julia, which is a fairly niche language.
- bgilly 10mo agoI’ve been fine tuning mine pretty often. Do you have any Claude.md files you can share as good examples? Especially with opus 4.5. And thank you for your work!! I focus all of my energy on helping families stay safe online, I make educational content and educational products (including software). Claude Code has helped me amplify my efforts and I’m able to help many more families and children as a result. The downstream effects of your work on Claude Code are awesome! I’ve been in IT since 1995 and your tools are the most powerful tools I’ve ever used, by far.
- songodongo 10mo agoAre you going to post an example of the CLAUDE.md your team uses?
- kxrm 10mo agoSomething to keep in mind is if your CLAUDE.md file is getting large, consider alternative approaches especially for repeatable tasks. Using slash commands and skills for workflows that are repeatable is a really nice way to keep your rules file from exploding. I have slash commands for code review, and git commit management. I have skills for complex tool interactions. Our company has it's own deployment CLI tool so using skills to make Claude Code an expert at using this tool has done wonders to improve Claude Codes performance when working on CI/CD problems. I am currently working on a new slash command /investigate <service> that runs triage for an active or past incident. I've had Claude write tools to interact with all of our partner services (AWS, JIRA, CI/CD pipelines, GitLab, Datadog) and now when an incident occurs it can quickly put together an early analysis of a incident finding the right people to involve (not just owners but people who last touched the service), potential root causes including service dependency investigations. I am putting this through it's paces now but early results are VERY good!
- goalieca 10mo ago> I add to my team’s CLAUDE.md multiple times a week. This concerns me because fighting tooling is not a positive thing. It’s very negative and indicates how immature everything is.
- bcherny 10mo agoYou might be misunderstanding what a CLAUDE.md is. It’s not about fighting the model, rather it’s giving the model a shortcut to get the context it needs to do its work. You don’t have to have one. Ours is 100% written by Claude itself.
- seunosewa 10mo agoThat's not the same thing as adding rules by yourself based on your experiences with Claude.
- jedberg 10mo agoThe Claude MD is like the documentation you hand to a new engineer on your team that explains details about your code that they wouldn't otherwise know. It's not bad to need one.
- thfuran 10mo agoBut that documentation shouldn’t need to be updated nearly every other day.
- kidbomb 10mo agoDoes the same happens if I create an AGENTS.md instead?
- red2awn 10mo agoClaude Code does not support AGENTS.md, you can symlink it to CLAUDE.md to workaround it. Anthropic: pls support!
- esafak 10mo agohttps://github.com/anthropics/claude-code/issues/6235 https://github.com/anthropics/claude-code/issues/6235
- kevinherron 10mo agoUse AGENTS.md for everything, then put a single line in CLAUDE.md: @AGENTS.md
- handfuloflight 10mo agoGet a grep!
- cafebeen 10mo agoThanks for your work great work on Claude Code! One other feature with CLAUDE.md I’ve found useful is imports: prepending @ to a file name will force it to be imported into context. Otherwise, whether a file is read and loaded to context is dependent on tool use and planning by the agent (even with explicit instructions like “read file.txt”). Of course this means you have to be judicial with imports.
- moribvndvs 10mo agoDo you recommend having Claude dump your final plan into a document and having it execute from that piece by piece? I feel like when I do plan mode (for CC and competing products), it seems good, but when I tell it to execute the output is not what we planned. I feel like I get slightly better results executing from a document in chunks (which of course necessitates building the iterative chunks into the plan).
- justatdotin 10mo agoa very common pattern is planner / executor. yes the executor only needs the next piece of the plan. I tend to plan in an entirely different environment, which fits my workflow and has the added benefit of providing a clear boundary between the roles. I aim to spend far more time planning than executing. if I notice getting more caught up in execution than I expected, that's a signal to revise the plan.
- danenania 10mo agoI often use multiple documents to plan things that are too large to fit into a single planning mode session. It works great. You can also use it in conjunction with planning mode—use the documents to pin everything down at a high-to-medium level, then break off chunks and pass those into planning mode for fine-grained code-level planning and a final checking over before implementation.
- hamiecod 10mo agoI ask claude to dump the plan into a file and ensure that the tasks have been split into subtasks such that the description of each subtask meets the threshold such that the probability of the LLM misinterpreting is very low.
- hebrox 10mo agoI ask it to write a plan and when it starts the work, keep progress in another document and to never change the plan. If I didn't do this, somehow with each code change the plan document would grow and change. Keeping plan and progress separate prevented this from happening.
- 10mo ago
- nrds 10mo ago> Use Opus 4.5. This drives up price faster than quality though. Also increases latency.
- bakugo 10mo agoObviously the Anthropic employee advertising their product wants you to pay as much as possible for it.
- handfuloflight 10mo agoThe generosity of the Max plans indicates otherwise.
- bakugo 10mo agoGod bless these generously benevolent corporations, giving us such amazing services for the low low price of only $200 per month. I'm going to subscribe right now! I almost feel bad, it's like I'm stealing from them.
- handfuloflight 10mo agoThat $200 a month is getting me $2000 a month in API equivalent tokens. I used to spend $200+ an hour on a single developer. I'm quite sure that benevolence was a factor when they submitted me an invoice, since there is no real transparency if I was being overbilled or not or that the developer acted in my best interest rather than theirs. I'll never forget that one contractor who told me he took a whole 40 hours to do something he could have done in less than that, specifically because I allocated that as an upperbound weekly budget to him.
- bakugo 10mo ago> That $200 a month is getting me $2000 a month in API equivalent tokens. Do you ever feel bad for basically robbing these poor people blind? They're clearly losing so much money by giving you $1800 in FREE tokens every month. Their business can't be profitable like this, but thankfully they're doing it out of the goodness of their hearts.
- matt3210 10mo agoI’ve yet to see any real work get done with agents. Can you share examples or videos of real production level work getting done? Maybe in a tutorial format? My current understanding is that it’s for demos and toy projects
- danenania 10mo agoI know of many experienced and capable engineers working on complex stuff who are driving basically all their development through agents. This includes production level work. This is the norm now in the SV startup world at least. You don't just YOLO it. You do extensive planning when features are complex, and you review output carefully. The thing is, if the agent isn't getting it to the point where you feel like you might need to drop down and edit manually, agents are now good enough to do those same "manual edits" with nearly 100% reliability if you are specific enough about what you want to do. Instead of "build me x, y, z", you can tell it to rename variables, restructure functions, write specific tests, move files around, and so on. So the question isn't so much whether to use an agent or edit code manually—it's what level of detail you work at with the agent. There are still times where it's easier to do things manually, but you never really need to.
- matt3210 10mo agoCan you show some example? I feel like there would be streams or YouTube lets plays on this if it was working well
- danenania 10mo agoA lot of that would be people working on proprietary code I guess. And most of the people I know who are doing this are building stuff, not streaming or making videos. But I'm sure there must be content out there—none of this is a secret. There are probably engineers working on open source stuff with these techniques who are sharing it somewhere.
- matt3210 10mo ago
- dmd 10mo agoI would LOVE to use Opus 4.5, but it means I (a merely Pro peon) can work for maybe 30 minutes a day, instead of 60-90.
- koolba 10mo agoI’m old enough to remember being able to work at programming related tasks without any such tools. Is that not still a thing?
- dmd 10mo agoI obviously meant "work with it" not work in general. And as for old, I'm 47. I've been programming since I got my first C64 in 1985.
- jrussellaz 10mo agoHey dmd! Same here, 47 and got my start programming on a Commodore 64. What’s up, brother?
- dmd 10mo agoCHR$($91)
- ImPostingOnHN 10mo agoIf a tool craps out after 30 minutes every day, and someone knows they can't rely upon it to work when you needed it, they tend to change workflow to avoid the tool entirely. Context switching between AI-assisted coding and "oops, my tool is refusing to function, guess I'll stop using it" is often worse for productivity than never using the AI to begin with.
- theshrike79 10mo agoI didn't enjoy spending two nights fighting with a shitty API and trying to figure out why it doesn't work. Now I can do it with Claude within minutes, while watching my TV shows on the second monitor and get directly to the good bits, the actual "business logic" of whatever I'm building.
- epolanski 10mo ago> If there is anything Claude tends to repeatedly get wrong, not understand, or spend lots of tokens on, put it in your CLAUDE.md. Claude automatically reads this file and it’s a great way to avoid repeating yourself. Sure, for 4/5 interactions then will ignore those completely :) Try for yourself: add to CLAUDE.md an instruction to always refer to you as Mr. bcherny and it will stop very soon. Coincidentally at that point also loses tracks of all the other instructions.
- dayjah 10mo agoThe Attention algo does that, it has a recency bias. Your observation is not necessarily indicative of Claude not loading CLAUDE.md. I think you may be observing context rot? How many back and forths are you into when you notice this?
- Fargren 10mo agoThat explains why it happens, but doesn't really help with the problem. The expectation I have as a pretty naive user, is that what is in the .md file should be permanently in the context. It's good to understand why this is not the case, but it's unintuitive and can lead to frustration. It's bad UX, if you ask me. I'm sure there are workarounds such as resetting the context, but the point is that god UX would mean such tricks are not needed.
- girvo 10mo agoYeah the current best approach to aggressively compact and recreate context by starting fresh. It’s awkward and I wish I didn’t have to.
- toxic72 10mo agoI'm surprised this hasn't been been automated yet but I'm pretty naive to the space - the problem of "when?"/"how often?" seems like a fun one to chew on
- matt3210 10mo agoDoes all my code get uploaded to the service?
- Etheryte 10mo agoHah, that's funny. Claude can't help but mess all the comments in the code up even if I explicitly tell it to not change any comments five times. That's literally the experience I had before opening this thread, never mind how often it completely ignores CLAUDE.md.
- tlarkworthy 10mo agoalso after you have a to-and-fro to course correct it on a task, run this self-reflection prompt https://gist.github.com/a-c-m/f4cead5ca125d2eaad073dfd71efbcfc https://gist.github.com/a-c-m/f4cead5ca125d2eaad073dfd71efbc... That will moves stuff that required manually clarifying back into the claude.md (or a useful subset you pick). It does a much better job of authoring claude.md than I do.
- hansmayer 10mo agoHey Boris from the Claude Code team - could you guys please be so kind so as to stop pushing that narrative about CLAUDE.md, either yourselves or through influencers and GenAI-grifters? The reason being, it is simply not true. A lot of the time the instructions will be ignored. Actually, the term "ignored" is putting the bar too high, because your tool does not intentionally "ignore", not having sentience and knowledge. We experience the effects of the instructions being ignored, because your software is not deterministic, its merely guessing the next token, and sometimes those instructions tacked onto the rest of the context statistically do not match what we as humans expect to see (while its perfectly logical for your machine learning text generator, based on the datasets it was trained on).
- blitz_skull 10mo agoThis seems pretty aggressive considering this is all just personal anecdote. I update my CLAUDE.md all the time and notice the effects. Why all the snark?
- hansmayer 10mo agoIs it really just a personal anecdote ? Please do read some other comments on this post. The snark comes from everyone and their mother recommending "just write CLAUDE.md", when it is clear that this technology does not have intrinsic capability to perform reliable outputs based on human language input.
- blitz_skull 10mo agoYeah… that’s the point of LLMs: variable output. If you’re using them for 100% consistent output, you’re using the wrong tool.
- hansmayer 10mo agoIs it? So you are saying software should not be consistent? Or that LLMs should not be used for software development, aside from toy-projects?
- jMyles 10mo ago3. Puppeteer? Or Playwright? I haven't been able to make Puppeteer work for the past 8 weeks or so ("failed to reconnect"). Do you have a doc on this?
- cebert 10mo agoI know the Playwright MCP server works great. I use it daily.
- jMyles 10mo agoSame, I use Playwright all the time, but haven't been able to make puppeteer work in quite some time. Playwright, while reliable in terms of features, just absolutely eats the heck out of context.
- cebert 10mo agoI’ve heard folks claim the Chrome DevTools MCP eats less context, but I don’t know how accurate that is.
- glamp 10mo agoHey Boris, I couldn't agree more. And using Plan mode was a major breakthrough for me. Speaking of Plan Mode... I was previously using it repeatedly in sessions (and was getting great results). The most recent major release introduced this bug where it keeps referring back to the first plan you made in a session even when you're planning something else (https://github.com/anthropics/claude-code/issues/12505 https://github.com/anthropics/claude-code/issues/12505). I find this bug incredibly confusing. Am I using Plan Mode in a really strange way? Because for me this is a showstopper bug–my core workflow is broken. I assume I'm using Claude Code abnormally otherwise this bug would be a bigger issue.
- lostdog 10mo agoYes, I've also been confused by things like this. Claude code is sometimes saving plans to ~/.claude/plans under animal names. But it's not really surface where the plan goes, not what the expected way to refer back to them is?
- theshrike79 10mo agoIt's a cache pretty much. Before it wrote them to the project directory by default, which is really annoying. Now it has a file it can refer to (call it "memory" to be fancy) without having to keep everything in context. The plan in the file survives over autocompact a lot better and it can just copy it to the project directory without rewriting it from memory.
- manmal 10mo agoWhy don’t you reset context when working on something else?
- mrieck 10mo agoIt’s additional features that are related. For example making a computer use agent… Made the plan, implementation was good, now I want to add a new tool for the agent, but I want to discuss best way to implement this tool first. Clearing context means Claude forgets everything about what was just built. Asking to discuss this new tool in plan mode makes Claude rewrite entire spec for some reason. As workaround, I tell Claude “looks good, delete the plan” before doing anything. I liked the old way where once you exit plan mode the plan is done, and next plan mode is new plan with existing context.
- cerved 10mo agoHey Boris, can you teach CC how to use cd?
- jcheng 10mo agoPersonally, CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1 made all my cd problems go away (which were only really in cmake-based projects to begin with).
- malloc2048 10mo agoThank you for Claude Code (Web). Google has a similar offering with Google Jules. I got really, really bad results from Jules and was amazed by Claude Code when I finally discovered it. I compared both with the same set of prompts and Claude Code seemed to be a senior expert developer and Jules, well don't know who be that bad ;-) Anyway, I also wanted to have persistent information, so I don't have to feed Claude Code the same stuff over and over again. I was looking for similar functionality as Claude projects. But that's not available for Claude Code Web. So, I asked Claude what would be a way of achieving pretty the same as projects, and it told me to put all information I wanted to share in a file with the filename:.clinerules. Claude told me I should put that file in the root of my repository. So please help me, is your recommendation the correct way of doing this, or did Claude give the correct answer? Maybe you can clear that up by explaining the difference between the two files?
- nl 10mo agoCLAUDE.md is the correct file for Claude.
- kelvinjps10 10mo agoHow do you make Claude code to choose opus and not sonnet? For me it seems to do it automatically
- fastball 10mo ago/model
- keepamovin 10mo agoThis is cool, thank you! Some things I found from my own interactions across multiple models (in addition to above): - It's basically all about the importance of (3). You need a feedback loop (we all do). and the best way is for it to change things and see the effects (ideally also against a good baseline like a test suite where it can roughly guage how close or far it is from the goal.) For assembly, a debugger/tracer works great (using batch-mode or scripts as models/tooling often choke on such interactivie TUI io). - If it keeps missing the mark tell it to decorate the code with a file log recording all the info it needs to understand what's happening. Its analysis of such logs normally zeroes the solution pretty quickly, especially for complex tasks. - If it's really struggling, tell it to sketch out a full plan in pseudocode, and explain why that will work, and analyze for any gotchas. Then to analayze the differences between the current implementation and the ideal it just worked out. This often helps get it unblocked.
- mraza007 10mo ago+1 on that Opus 4.5 is a game changer I have used to refactor and modernize one of my old react project using bootstrap, You have to be really precise when prompting and having solid CLAUDE.md works really well
- ed4bb9fb7c 10mo ago> 1. If there is anything Claude tends to repeatedly get wrong, not understand, or spend lots of tokens on, put it in your CLAUDE.md. What a joke. Claude regularly ignores the file. It is a toss up: we were playing a game at work to guess which items will it forget first: to run tests, formatter, linter etc. This is despite items saying ABSOLUTELY MUST, you HAVE To and so long. I have cancelled my Claude Max subscription. At least Codex doesn’t tell me that broken tests are unrelated to its changes or complain that fixing 50 tests is too much work.
- sahilagarwal 10mo agoHi Boris, If you wouldn't mind answering a question for me, it's one of the main things that has made me not add claude in vscode. I have a custom 'code style' system prompt that I want claude to use, and I have been able to add it when using claude in browser - ``` Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Trust the context you're given. Don't defend against problems the human didn't ask you to solve. ``` How can I add it as a system prompt (or if its called something else) in vscode so LLMs adhere to it?
- bcherny 10mo agoAdd it to your CLAUDE.md. Claude will automatically read that file every time it starts up
- scellus 10mo agoIn other words, permanent instructions and context well presented in *.md, planning and review before execution, agentic loops with feedback, and a good model. You can do this with any agentic harness, just plain prompting and "LLM management skills". I don't have Claude Code at work, but all this applies to Codex and GH Copilot agents as well. And agreed, Opus 4.5 is next level.
- seinecle 10mo agoAnd if I may, these advice also apply if you choose Cursor as a coding environment.
- kotatsu_dog 10mo agoIn addition, Having Claude Code's code and plans evaluated is very valid. It makes calm decision for AI agents.
- idk1 10mo agoHey there Boris from the Claude Code team! Thanks for these tips! Love Claude Code, absolutely one of the best pieces of software that has ever existed. What I would absolutely love is if the Claude documentation had examples of these because I see time and time again people saying what to do in the case you tell us to update the Claude MD with things that it gets wrong repeatedly but it's very rare to have examples just three or four examples of something gets got wrong, and then how you fixed it would be immensely helpful.
- jbrooks84 10mo agoClaude code basically does not use CLAUDE.md but wish it did