Hey everyone! I've been using Claude 3.7 Sonnet in Cursor for a while, and after hearing all the hype about Claude Code, I decided to upgrade to the Pro plan and give it a shot. I tried using it for a refactor of a React project where I wanted to replace similar patterns in several components using a reusable Component A. Unfortunately, Claude seemed to mess it up by ignoring parts of my request and adding unnecessary changes. I followed the instructions carefully, but it skipped over multiple components and kept insisting it had completed everything successfully. I'm really puzzled—what am I doing wrong? Any tips for getting better results?
5 Answers
Sometimes, it’s about how well you structure your prompts. Try something like asking Claude to plan how it will refactor each component individually, complete with testing procedures. That way, it has a clear roadmap to follow!
True! When I gave Claude a precise outline of what to do, it worked wonders.
Additionally, try using positive instructions instead of negatives. Rather than saying "Don't do X", focus on what you want it to accomplish. It seems to respond better to that kind of prompting.
Absolutely! I've learned that the hard way. Positive framing makes a difference.
Yes! Rephrasing my prompts helped a lot with Claude.
You might also want to check the model you’re using—it defaults to Opus, which isn’t always ideal for code refactoring tasks. Switching to Sonnet for tasks like the one you described could give you better outcomes. Sonnet is great for simpler, more direct tasks, while Opus can get bogged down with complex requests.
Exactly! I had to experiment a bit to find which model worked best for me. Sonnet really does shine for straightforward tasks.
Yep, switching models helped me get much more accurate results too.
Also, keep in mind that your inputs need to be detailed enough. Claude Code tends to struggle with sparse information. If you don't give it enough context, it might not know where to start or what to focus on. Consider refining what you're asking to ensure it knows exactly what you want!
I’ve noticed that too; the clearer you are, the better the results.
For sure! Clarity is key in getting good output.
It sounds like you might need to improve your prompt engineering a bit! Claude Code needs very clear instructions. In your case, you should break down the refactor into smaller tasks for each component instead of a broad request. This could help it focus on just one task at a time and reduce confusion about what you need. Also, consider creating a CLAUDE.md file where you outline your project specifics for better context.
Yeah, I had a similar issue. Giving Claude separate, focused tasks really makes a difference!
I totally agree! Smaller, detailed prompts work way better. Once I started breaking down my requests, Claude’s output improved dramatically.
That's a great idea! Giving it a detailed plan could help avoid the issues of it missing components.