top | item 45428167

(no title)

jotux | 5 months ago

I work on a large C++ codebase for an aerospace application. The code is relatively conservative, and when we add things, we're generally conservative in our approach to add new things. Copilot (with Claude or GPT under the hood) constantly wants to use modern and complicated approaches to any new thing we add.

Need to check three bits in a byte from a peripheral and populate them to telemetry?

Claude/GPT: Let's make a base struct with a virtual map function, then template a struct to hold the register with functions to extract bits, then make unique pointers to each register, then create a vector of pointers to map all the values, etc.

You can write a very clear, and long, prompt that explains not to do any of that and just pull the bits out of the byte, but writing the prompt takes more time than just writing the code. These tools seem to always reach for, what I would call, the pristine solution as their first attempt and I think many would call that gold-plating.

discuss

order

antonvs|5 months ago

You can typically address that with a system prompt, so you don't have to mention your expectations every time.

If you're using one of the coding agents like Claude Code or Gemini CLI, you should have a .md file (e.g. CLAUDE.md) for your project which contains those kinds of instructions, and any other useful context for the project.

https://www.anthropic.com/engineering/claude-code-best-pract...