Taro Logo
0

Vibed coded my project - Now I wanna begin the refactor process to fix this

Profile picture
Entry-Level Software Engineer at Unemployed3 days ago

Hello, I made a project that started off as an MVP, but I feel like I vibed coded it and now it doesn't really work well as I hoped. But I see a learning to fix this AI code. How would you begin? I'm thinking of doing a refactor to try to decrease the file size and simply reduce the number of files and of course trying to follow React best practices and maybe introduce TypeScript to help.

32
2

Discussion

(2 comments)
  • 0
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero
    2 days ago
    1. Split the code up into a small, modular, focused components
    2. Go through each component and try to understand it. If you can't, just rewrite it from scratch
    3. Do #2 until all the terrible code is gone

    For the future, I don't recommend vibe coding (i.e. copy-pasting what the AI gives you while barely reading/understanding it). You should always understand at least 80% of what your code is doing line-by-line. If you don't, ask the AI until you do.

    You should also not use AI for a high-level thinking. You should have an idea of how your project is going to look, and the components it needs to have (+ the interfaces they use to communicate to one another). Then you use AI to fill in each individual piece, testing it thoroughly each time.

    I recommend this related discussion: "How to optimally use GenAI to leverage my coding prowess and become a better software engineer?"

    • 0
      Profile picture
      Entry-Level Software Engineer [OP]
      Unemployed
      a day ago

      Yeah it was like I had a good understanding of it, but then I was using it to make new features, but I feel the way it was doing caused it to be a mess. But thank you for the tips