Ive been working with React for like ten years now so I thought I had a handle on things but I just started using Claude Code for this freelance gig I took on for a shop here in Seattle and honestly I am panicking a little bit. The deadline is this Friday and I decided to try and speed up my workflow by using the new CLI tool but its doing some really weird stuff with the state management. Like my logic was that if I let it handle the boilerplate for these data-heavy forms it would save me hours but instead it keeps trying to use these outdated patterns or it just straight up ignores the local context I am trying to provide. I keep seeing people talk about specific skills or custom instruction sets you can feed it but I am not sure which ones actually move the needle for a modern React stack with Vite and Tailwind.
Ive tried telling it to prioritize functional components and specific hook patterns but it still feels like its guessing half the time. Like yesterday it generated this massive useEffect block that caused an infinite loop and I spent two hours debugging something I could have written in ten minutes. So I was thinking maybe there are specific system-level skills or custom MCP servers people are using to make Claude Code smarter about the component lifecycle? Or maybe my prompting just sucks because I am used to the web interface and the CLI feels different? I really need to know what the best practices are for getting it to understand complex prop drilling or even better how to get it to stop hallucinating types in my TSX files.
If I cant get this form logic stabilized by tomorrow morning I am gonna have to pull an all-nighter and just do it manually which defeats the whole purpose of paying for the tool. Does anyone have a specific set of rules or a skill theyve defined that actually makes it competent at refactoring messy React code without breaking everything else in the file? I am mostly worried about it messing up the memoization logic I already have in place and I just dont know if I should be feeding it the whole directory or just specific files to keep it from getting confused...
I had a similar nightmare with a Tailwind project recently where the CLI went rogue on my state logic. I ended up burning through way too many tokens because it kept looping through the same bug. Before you pull that all-nighter, are you running the CLI with the default Anthropic Claude 3.5 Sonnet or did you try connecting a custom MCP server to index your specific library versions? I have found a few ways to keep the budget down and the logic stable:
Coming back to this... honestly i am pretty new to the CLI too so i keep things simple to avoid mistakes. Quick question though, are you working in a monorepo or just a flat structure? That usually changes how it searches for context. I mostly use Microsoft Visual Studio Code IDE to double check everything it does. Try only passing the specific file path in the command line instead of the whole folder, it is way safer.
Great info, saved!
Just wanted to say thanks for everyone chiming in. Super helpful discussion.
> I keep seeing people talk about specific skills or custom instruction sets you can feed it I would suggest being very careful about feeding it your whole directory at once. Claude Code can get pretty aggressive and lose track of local context if you give it too much to chew on. Might want to consider passing specific files instead. Honestly, its usually safer to use manual checkpoints before letting it refactor anything significant, especially with complex state.
I definitely agree with eknyvvghfo about being careful with the directory context. In my experience, throwing a whole project at the CLI is usually where things go sideways for React. Its tempting to give it everything, but the hallucinations usually start when the context window gets cluttered, and the token burn gets expensive fast. If youre hitting a wall with the CLI, here is how I think it compares to some of the other brands out there: