Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Angularjs To Angular Migration

ASecurity

当把 AngularJS(1.x) 应用迁移到现代 Angular(2+) 时使用;用 ngUpgrade 搭建混合应用、按特性渐进迁移 controller/directive/service/路由/表单并安全切换,产出可运行的 Angular 代码与迁移计划;不适用于已是现代 Angular 版本、或不涉及框架升级的小修。触发词:AngularJS 迁移、ngUpgrade、hybrid app、downgradeInjectable

3 stars
0 votes
0 copies
2 views
Added 9/19/2026
ai-agentstypescriptgoangularapifrontend

Works with

cursorcliapi

Security Analysis

A100/100

Scanned 9/19/2026

$npx -y skills add findscripter/everything-skills --skill angularjs-to-angular-migration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Angularjs To Angular Migration?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Angularjs To Angular Migration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/findscripter-angularjs-to-angular-migration/badge)](https://www.skillsdirectory.com/skills/findscripter-angularjs-to-angular-migration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: angularjs-to-angular-migration
title: AngularJS 到 Angular 迁移
description: 当把 AngularJS(1.x) 应用迁移到现代 Angular(2+) 时使用;用 ngUpgrade 搭建混合应用、按特性渐进迁移 controller/directive/service/路由/表单并安全切换,产出可运行的 Angular 代码与迁移计划;不适用于已是现代 Angular 版本、或不涉及框架升级的小修。触发词:AngularJS 迁移、ngUpgrade、hybrid app、downgradeInjectable
domain: 研发/frontend
triggers: [AngularJS 迁移到 Angular, ngUpgrade 混合应用, downgradeInjectable / upgrade, 把 controller/directive 改成 Angular 组件, $scope 重写为组件, $routeProvider 迁移到 RouterModule]
tags: [angular, angularjs, 迁移, ngupgrade, 前端, 重构]
level: 进阶
status: stable
agents: [claude-code, codex, cursor, gemini-cli]
tools: [Angular CLI, ngUpgrade, TypeScript, RxJS]
requires: []
related: [modern-angular-expert, legacy-codebase-modernizer, zero-downtime-migration-architect, typescript-advanced-types]
combines_with: [modern-angular-expert, legacy-codebase-modernizer, frontend-design]
license: MIT
source: sickn33/agentic-awesome-skills
source_license: MIT
---
## 何时使用

适用于:

- 把 AngularJS(1.x) 应用迁移到 Angular(2+)
- 运行 AngularJS / Angular 并存的混合(hybrid)应用
- 把 controller、directive 转换为 Angular 组件
- 把 factory/service 现代化为 `@Injectable` 服务
- 把 `$routeProvider`/`ui-router` 迁移到 `RouterModule`
- 把 `ng-model` 表单迁移到模板驱动 / 响应式表单
- 升级到最新 Angular 版本并落地最佳实践

不该用(负边界):

- 任务与「从 AngularJS 迁移到 Angular」无关
- 应用已在现代 Angular 版本上,无框架升级诉求
- 只需一个不涉及框架改动的小 UI 修复

## 步骤

1. **评估**:盘点 AngularJS 代码库、第三方依赖与迁移风险。
2. **选策略**并定里程碑:
   - **大爆炸(整体重写)**:并行开发、一次性切换。适合小应用 / 全新项目。
   - **渐进(混合)**:AngularJS 与 Angular 并存,逐特性迁移,靠 ngUpgrade 互操作。适合大应用 / 持续交付。
   - **垂直切片**:一次彻底迁移一个特性,新特性用 Angular、旧的保留 AngularJS,逐步替换。适合中等应用。
3. **搭混合应用**:配置 ngUpgrade,迁移模块、组件与路由。
4. **验证与切换**:用测试校验,规划可回滚的安全切换。

推荐迁移顺序:先服务 → 工具/共享组件 → 路由 → 逐特性 → 清理(移除 AngularJS 与 ngUpgrade,优化打包)。

## 指令

混合应用引导(main.ts + app.module.ts):

```typescript
// main.ts - 引导混合应用
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { UpgradeModule } from '@angular/upgrade/static';
import { AppModule } from './app/app.module';

platformBrowserDynamic()
  .bootstrapModule(AppModule)
  .then(platformRef => {
    const upgrade = platformRef.injector.get(UpgradeModule);
    upgrade.bootstrap(document.body, ['myAngularJSApp'], { strictDi: true });
  });
```

```typescript
// app.module.ts
@NgModule({ imports: [BrowserModule, UpgradeModule] })
export class AppModule {
  constructor(private upgrade: UpgradeModule) {}
  ngDoBootstrap() { /* 在 main.ts 中手动引导 */ }
}
```

跨框架依赖注入(互操作核心):

```typescript
// Angular 服务 → 供 AngularJS 使用:downgradeInjectable
import { downgradeInjectable } from '@angular/upgrade/static';
angular.module('myApp').factory('newService', downgradeInjectable(NewService));

// AngularJS 服务 → 供 Angular 使用:InjectionToken + $injector
export const OLD_SERVICE = new InjectionToken<any>('oldService');
@NgModule({
  providers: [{
    provide: OLD_SERVICE,
    useFactory: (i: any) => i.get('oldService'),
    deps: ['$injector']
  }]
})
// 注入:constructor(@Inject(OLD_SERVICE) private oldService: any) {}
```

## 示例

**Controller → 组件**:`$scope` 字段变为类属性,`$scope.xxx = function` 变为类方法,`.then()` 改为 `subscribe()`,在 `ngOnInit` 中初始化。

**Directive → 组件**:`scope: { user: '=' }` → `@Input() user`;`onDelete: '&'` → `@Output() delete = new EventEmitter<void>()`;模板里 `ng-click="onDelete()"` → `(click)="delete.emit()"`。

**Service**:`factory + $http` → `@Injectable({ providedIn: 'root' })` + `HttpClient`,返回 `Observable`:

```typescript
@Injectable({ providedIn: 'root' })
export class UserService {
  constructor(private http: HttpClient) {}
  getUser(id: number): Observable<any> { return this.http.get(`/api/users/${id}`); }
  saveUser(user: any): Observable<any> { return this.http.post('/api/users', user); }
}
```

**路由**:`$routeProvider.when('/users/:id', {...})` → `Routes` 数组 `{ path: 'users/:id', component: UserDetailComponent }`,由 `RouterModule.forRoot(routes)` 注册。

**表单**:`ng-model` + `userForm.$invalid` → 模板驱动 `[(ngModel)]` + `#userForm="ngForm"` + `userForm.invalid`;复杂表单优先用响应式表单 `FormBuilder` + `Validators`。

## 注意事项

- 不要在无回滚、无预发验证的情况下做一次性大爆炸切换。
- 渐进迁移期间持续做混合兼容性测试。
- 常见坑:混合应用配置不正确;先迁 UI 后迁逻辑(应反过来,先逻辑);忽视变更检测差异;scope 处理不当;AngularJS 与 Angular 模式混用;测试不充分。
- 最佳实践:先迁服务(最易);逐特性渐进;每步都测;尽早转 TypeScript;从第一天起遵循 Angular 风格指南;先跑通再优化;保留迁移笔记。
- 本技能输出不能替代针对具体环境的验证、测试与专家评审;若缺少必要输入、权限、安全边界或成功标准,应先停下来澄清。

## 互见

- 混合模式模式、组件转换、DI 迁移、路由迁移等可在源仓库 `references/` 与 `assets/`(如 `hybrid-bootstrap.ts`)、`scripts/analyze-angular-app.sh` 中进一步查阅。
- 研发/misc 域下其他「框架升级 / 大型重构」类技能。

---

采编自 sickn33/antigravity-awesome-skills(MIT)。

Attribution

findscripterfindscripter
View sourceSee grades on GitHubMore from findscripter →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →