migrate-angularjs
Skill4 starsChanged 10 days agoMITView on GitHub
Plan and run a migration off AngularJS 1.x (EOL since 31 Dec 2021, unfixed CVEs) to Angular - choose between an incremental hybrid with ngUpgrade (@angular/upgrade), a per-route strangler rewrite, or a full rewrite; prepare the AngularJS code (1.8.3, components, TypeScript, a bundler, tests); then move services and components feature by feature and remove AngularJS. Use when asked to migrate, upgrade or replace AngularJS, or when legacy/angularjs applies and the user wants out.
In this repository32 other files it gives its agents.
- llms.txtllms.txt
- cve-checkSkill
- dependency-vetSkill
- git-commitSkill
- incident-supply-chainSkill
- migrate-class-to-hooksSkill
- migrate-cordovaSkill
- migrate-cra-to-viteSkill
- migrate-dotnet-frameworkSkill
- migrate-ingress-nginxSkill
- migrate-strutsSkill
- migrate-vue2Skill
- migrate-xamarinSkill
- secrets-scanSkill
- security-auditSkill
- threat-model-liteSkill
- upgrade-angularSkill
- upgrade-djangoSkill
- upgrade-dotnetSkill
- upgrade-expressSkill
- upgrade-jquerySkill
- upgrade-laravelSkill
- upgrade-nestjsSkill
- upgrade-nextjsSkill
- upgrade-nodeSkill
- upgrade-nuxtSkill
- upgrade-phpSkill
- upgrade-pythonSkill
- upgrade-railsSkill
- upgrade-react-nativeSkill
- upgrade-spring-bootSkill
- upgrade-supabaseSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Ask the user to choose an approach (explain the trade-offs):
- Very specific: line 33
Follow the AngularJS style that maps to Angular: one component per file, .component() with </& bindings instead of $scope-heavy controllers …
- Very specific: line 39
Create the Angular app (standalone bootstrap) and add @angular/upgrade.
- Very specific: line 43
Remove AngularJS when no AngularJS components, services or routes remain.
- Very specific: line 47
Put both apps behind one origin (reverse proxy or server routing).
- Distinctive: line 49
Keep shared chrome (header, navigation) visually consistent.
- Very specific: line 53
Verify (next section); show the diff and results.
- Very specific: line 54
Keep the security controls from legacy/angularjs (CSP, no trustAs*, no user-controlled templates) on the AngularJS side until it's gone.
- Distinctive: line 67
Check in the browser: migrated features behave the same (forms, validation messages, routing, deep links), no console errors from either …
- Distinctive: line 71
Never rewrite everything in one change.
- Very specific: line 72
Never relax $sce or CSP to make hybrid templates work.
- Very specific: line 73
Never leave two-way data sharing via $rootScope events as the integration layer.
- Distinctive: line 74
Never auto-commit, push or deploy.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Migrate AngularJS → Angular
When to use
- The app depends on
angular1.x and the user wants to move to Angular (or another framework). - Security review flagged the unfixed AngularJS CVEs (see
legacy/angularjs).
Before you start
- Inventory: AngularJS version, module count, routes (
ngRouteor ui-router), directives withlink/compilefunctions, filters,$scopeusage, third-party AngularJS modules, build tool (none, gulp, grunt, webpack), and test coverage. - Ask the user to choose an approach (explain the trade-offs):
- Hybrid (ngUpgrade): AngularJS and Angular run in one page; migrate component by component. Best for large apps that must keep shipping. Requires a bundler and TypeScript.
- Strangler (per route): a new Angular app serves migrated routes; a proxy or server routes the rest to the old app. Simpler runtime, but shared UI (header, auth) must exist in both.
- Full rewrite: for small apps or ones with little reusable logic; freeze the old app behind compensating controls until cut-over.
- Target: the current Angular major (22; see
frontend/angular) with standalone components. - Working tree clean; new branch; E2E tests (Playwright or Cypress) for main flows. Add them first if missing.
Steps
Prepare the AngularJS app (all approaches)
- Upgrade to AngularJS 1.8.3 and fix console warnings.
- Follow the AngularJS style that maps to Angular: one component per file,
.component()with</&bindings instead of$scope-heavy controllers and two-way=bindings, services instead of$rootScopeevents,controllerAssyntax. - Introduce a module bundler (webpack or Vite) and TypeScript for the AngularJS code if they're missing; replace script-tag ordering with imports.
- Replace jQuery-heavy directives and AngularJS-only third-party modules with plain code or libraries that have Angular equivalents.
Hybrid with ngUpgrade
- Create the Angular app (standalone bootstrap) and add
@angular/upgrade; bootstrap the hybrid withUpgradeModule(ordowngradeModulefor lazy Angular). - Migrate services first (upgrade AngularJS services with providers, or write Angular services and downgrade them with
downgradeInjectable). - Migrate leaf components to Angular and expose them to AngularJS templates with
downgradeComponent; upgrade AngularJS components that Angular needs withUpgradeComponentonly temporarily. - Move routing last: switch the router to Angular's once most routes' components are Angular, keeping AngularJS routes behind a catch-all during the transition.
- Remove AngularJS when no AngularJS components, services or routes remain; drop
@angular/upgrade.
Strangler
- Put both apps behind one origin (reverse proxy or server routing); share auth via
HttpOnlycookies. - Rebuild a route in Angular, switch the proxy for that path, and delete the AngularJS route; repeat.
- Keep shared chrome (header, navigation) visually consistent; move it early or render it in both.
Every step
- Verify (next section); show the diff and results; wait for approval before the next feature. Commit only when asked (
git-commitskill). - Keep the security controls from
legacy/angularjs(CSP, notrustAs*, no user-controlled templates) on the AngularJS side until it's gone.
Verify
npm ci
npx ng build && npx ng test --watch=false # Angular side
npm test # AngularJS side (Karma or the existing runner)
npx playwright test # or Cypress: the same E2E suite against the current build
npm audit --audit-level=moderate
npm ls angular @angular/core @angular/upgradeCheck in the browser: migrated features behave the same (forms, validation messages, routing, deep links), no console errors from either framework, and change detection works across the boundary (values update both ways).
Safety
- Never rewrite everything in one change; migrate one feature or route per change with E2E coverage.
- Never relax
$sceor CSP to make hybrid templates work. - Never leave two-way data sharing via
$rootScopeevents as the integration layer; use services. - Never auto-commit, push or deploy.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

