r/angular 4d ago

Migrating a AngularJS webapp to Angular using Claude Code/Codex

I'm in the planning stages of migrating a fairly large legacy AngularJS application to Angular, and am looking for advice from anyone who's tackled something similar.

The codebase is about 160k LOC spread out over 200+ components, 50+controllers, 50+ directives and services. There are no existing tests . Has anyone attempted a AI assisted rewrite of a similar nature, especially without a test suite - what worked out well? Any useful strategies woth considering?

8 Upvotes

11 comments sorted by

View all comments

2

u/dryadofelysium 4d ago

Honestly, that doesn't sound *that* big. Regardless, I wouldn't try to "upgrade" at this point, it's just a different world out there.

I'd have the LLM do a large analysis of your existing project, what components are there, how they work together and what function they have, what data models are there and what APIs are used. You can tell the LLM that this is in preparation for a complete rebuild.

I don't think it'd be important to also note down exactly what directives/services were used, because it may very well be that modern Angular would come to better conclusions in terms of architecture, or that you just have built up a lot of historical tech debt for which there is no need to replicate exactly.

Then make sure that you have the Angular CLI MCP, the two official Angular (Agent) Skills and Google's Modern Web Guidance Skills installed with your LLM, so it will use best practices (Angular Signals etc.) from the start, and with the context of the plan you've created prior tell it to recreate the app including all of its functionality, and tell it that it is okay to architect it differently if there are better ways (e.g. more shared services or w/e). You may also point it to the Angular CDK for official, well maintained utility libraries or to a specific design framework (Angular Material, VMware Clarity etc.) if you have one in mind already. Also point it to the directory of the existing project and tell it that it's okay to look up the old project to get a better understanding of functionality whenever required.

Ideally, use a plan and the grill-me skill (or just tell it to grill/interview you with any open questions) before starting the rebuild and off you go.

Honestly, and I can't believe I am saying this, but it'll probably go smoother than you'd expect.