(no title)
jotux | 5 months ago
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.
antonvs|5 months ago
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...