| My experience is similar to this. I literally just had this interaction with Claude: Me: Why do we have these static methods when the whole cobebase uses factories? _claude refactors to use a factory_ Me: Claude why does this factory create two unrelated objects? _Claude: you're right, they're unrelated they should be separate_ _proceeds to create extraneous factory_ Me: Claude we don't need a factory for the second object. Those kinds of objects aren't created with factories anywhere else in the codebase. We can just use it's constructor directly. _Claude: you're right, the second factory is not needed_ Like, I'm probably just prompting badly but I definitely feel like I'm constantly having to course correct even on relatively minor details. And Claude's ideas for higher-level or more complex features are sometimes way off course. And not because it's dumb per se, usually it's because it is missing key bits of context. Business context, technical context, whatever. Or it's overfitting the solution to one requirement that isn't that important. |
When building out a new feature or functionality I'm typically getting a ratio of 2:1 or 3:1 of refactoring to build out. So for every prompt of "let's build this feature" I have to do 2-3 prompts of "I noticed this in the code isn't following X/Y/Z pattern, check out this place where X/Y/Z is followed and refactor" or similar.
If you're expecting a single prompt to get you to perfection, it's just not going to happen.
Though I can't blame you for having that expectation with how people talk about this stuff. Lots of people seem to be frontloading a ton of work making "spec files" and then letting the ai go ham on their codebase and I don't agree with that approach.