When using Claude Sonnet 3.7 for coding, I often find that constraints I add to the prompt, end up producing unintended side effects.
Some examples:
- "Don't include pointless comments." - The model doesn't keep track of what it's doing as well, I generally just do another pass after it writes the code to simplify things.
- "Keep things simple" - The model cuts corners(often unnecessarily) on things like type safety.
- "Allow exceptions to bubble up" - Claude deletes existing error handling logic. I found that Claude seems to prefer just swallowing errors and adding some logging, instead of fixing the underlying cause of the error, but adding this to the prompt just caused it to remove the error handling that I had added myself.
Some examples:
- "Don't include pointless comments." - The model doesn't keep track of what it's doing as well, I generally just do another pass after it writes the code to simplify things.
- "Keep things simple" - The model cuts corners(often unnecessarily) on things like type safety.
- "Allow exceptions to bubble up" - Claude deletes existing error handling logic. I found that Claude seems to prefer just swallowing errors and adding some logging, instead of fixing the underlying cause of the error, but adding this to the prompt just caused it to remove the error handling that I had added myself.