Hello all.
I have old code base in JavaScript which I like to convert to Go or C++. The code base is small to medium in size; it is a server. I like to utilize Cursor for the job. I know I can just say convert it, what do you think is the best way to tackle this task using Cursor?
Hi OP, I would recommend setting up a cursor rules file that defines best practices for what the new language/script code should follow (such as syntax best practices). Have the AI systematically review (and use the right models of course; I’d recommend Claude-related models for this effort).
I’m not an expert developer, but hopefully this helps. Expect errors and don’t try to one-shot everything too much. Tackle specific modules and ensure business logic is always separated from the rest of the codebase (like UI matters).
Thanks, but all this is done and known.
Still, I am looking for tips from someone who did this.
As still having done this, it is very error prone.
I did this with a personal react/typescript app coming off from Javascript recently so I’m speaking from personal experience on my “success” (my app didn’t have too much technical debt as I was struggling to get an Electron app up and running and decided to commit to an actual web browser server app instance).
My first step is always to have the AI do an analysis/review of the codebase, with specific emphasis on identifying business logic vs. other types of logic (the idea is to identify separation of concerns the AI can build over time as part of its conversion efforts to ensure long-term maintainability of the project).
Also, I’ve seen some devs instruct AI agents to build “Regression” tests after each phase of refactoring/conversion so the AI can continually test its changes, re-iterate code if a regression test fails, etc. before it’s allowed to move on to other conversion efforts.
I’d also recommend leveraging the “Plan” mode to hash out the details and get clarifying details from the AI agent before they start systematically overhauling your codebase. The plan mode I feel is great at tackling this at scale before you have to go into the weeds with the Agent mode.
Good luck!
Thank you very much for replying.
Can you please recommend how to write the right roles for the task? Should I ask AI? Should I use the Cursor directory? I’m afraid there’s too much information regarding the roles. I’m afraid they can be too much and too cluttered with just dumping roles (what I’ve seen on YouTube tutorials).
Also, how did you use the “PLAN” mode for that? There’s also the new “DEBUG” mode—maybe it can help as well.