angular-modernization

Modernizes Angular code such as components and directives to follow best practices using both automatic CLI migrations and Bitwarden-specific patterns. YOU must use this skill when someone requests modernizing Angular code. DO NOT invoke for general Angular discussions unrelated to modernization.

16 stars

Best use case

angular-modernization is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Modernizes Angular code such as components and directives to follow best practices using both automatic CLI migrations and Bitwarden-specific patterns. YOU must use this skill when someone requests modernizing Angular code. DO NOT invoke for general Angular discussions unrelated to modernization.

Teams using angular-modernization should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/angular-modernization/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/frontend/angular-modernization/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/angular-modernization/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How angular-modernization Compares

Feature / Agentangular-modernizationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Modernizes Angular code such as components and directives to follow best practices using both automatic CLI migrations and Bitwarden-specific patterns. YOU must use this skill when someone requests modernizing Angular code. DO NOT invoke for general Angular discussions unrelated to modernization.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Angular Modernization

Transforms legacy Angular components to modern architecture using a two-step approach:

1. **Automated migrations** - Angular CLI schematics for standalone, control flow, and signals
2. **Bitwarden patterns** - ADR compliance, OnPush change detection, proper visibility, thin components

## Workflow

### Step 1: Run Angular CLI Migrations

**⚠️ CRITICAL: ALWAYS use Angular CLI migrations when available. DO NOT manually migrate features that have CLI schematics.**

Angular provides automated schematics that handle edge cases, update tests, and ensure correctness. Manual migration should ONLY be used for patterns not covered by CLI tools.

**IMPORTANT:**

- Always run the commands using `npx ng`.
- All the commands must be run on directories and NOT files. Use the `--path` option to target directories.
- Run migrations in order (some depend on others)

#### 1. Standalone Components

```bash
npx ng generate @angular/core:standalone --path=<directory> --mode=convert-to-standalone
```

NgModule-based → standalone architecture

#### 2. Control Flow Syntax

```bash
npx ng generate @angular/core:control-flow
```

`*ngIf`, `*ngFor`, `*ngSwitch` → `@if`, `@for`, `@switch`

#### 3. Signal Inputs

```bash
npx ng generate @angular/core:signal-input-migration
```

`@Input()` → signal inputs

#### 4. Signal Outputs

```bash
npx ng generate @angular/core:output-migration
```

`@Output()` → signal outputs

#### 5. Signal Queries

```bash
npx ng generate @angular/core:signal-queries-migration
```

`@ViewChild`, `@ContentChild`, etc. → signal queries

#### 6. inject() Function

```bash
npx ng generate @angular/core:inject-migration
```

Constructor injection → `inject()` function

#### 7. Self-Closing Tag

```bash
npx ng generate @angular/core:self-closing-tag
```

Updates templates to self-closing syntax

#### 8. Unused Imports

```bash
npx ng generate @angular/core:unused-imports
```

Removes unused imports

### Step 2: Apply Bitwarden Patterns

See [migration-patterns.md](migration-patterns.md) for detailed examples.

1. Add OnPush change detection
2. Apply visibility modifiers (`protected` for template access, `private` for internal)
3. Convert local component state to signals
4. Keep service observables (don't convert to signals)
5. Extract business logic to services
6. Organize class members correctly
7. Update tests for standalone

### Step 3: Validate

- Fix linting and formatting using `npm run lint:fix`
- Run tests using `npm run test`

If any errors occur, fix them accordingly.

## Key Decisions

### Signals vs Observables

- **Signals** - Component-local state only (ADR-0027)
- **Observables** - Service state and cross-component communication (ADR-0003)
- Use `toSignal()` to bridge observables into signal-based components

### Visibility

- `protected` - Template-accessible members
- `private` - Internal implementation

### Other Rules

- Always add OnPush change detection
- No TypeScript enums (use const objects with type aliases per ADR-0025)
- No code regions (refactor instead)
- Thin components (business logic in services)

## Validation Checklist

Before completing migration:

- [ ] OnPush change detection added
- [ ] Visibility modifiers applied (`protected`/`private`)
- [ ] Signals for component state, observables for service state
- [ ] Class members organized (see [migration-patterns.md](migration-patterns.md#class-member-organization))
- [ ] Tests updated and passing
- [ ] No new TypeScript enums
- [ ] No code regions

## References

### Bitwarden ADRs

- [ADR-0003: Observable Data Services](https://contributing.bitwarden.com/architecture/adr/observable-data-services)
- [ADR-0025: No TypeScript Enums](https://contributing.bitwarden.com/architecture/adr/no-enums)
- [ADR-0027: Angular Signals](https://contributing.bitwarden.com/architecture/adr/angular-signals)
- [Bitwarden Angular Style Guide](https://contributing.bitwarden.com/contributing/code-style/web/angular)

### Angular Resources

- [Angular Style Guide](https://angular.dev/style-guide)
- [Angular Migrations](https://angular.dev/reference/migrations)
- [Angular CLI Schematics](https://angular.dev/tools/cli/schematics)

Related Skills

frontend-angular-store

16
from diegosouzapw/awesome-omni-skill

Use when implementing state management with PlatformVmStore for complex components requiring reactive state, effects, and selectors.

frontend-angular-form

16
from diegosouzapw/awesome-omni-skill

Use when creating reactive forms with validation, async validators, dependent validation, and FormArrays using platform patterns.

frontend-angular-api-service

16
from diegosouzapw/awesome-omni-skill

Use when creating API services for backend communication with proper patterns for caching, error handling, and type safety.

angular

16
from diegosouzapw/awesome-omni-skill

Modern Angular (v20+) expert with deep knowledge of Signals, Standalone Components, Zoneless applications, SSR/Hydration, and reactive patterns.

angular-v21-development

16
from diegosouzapw/awesome-omni-skill

Develop Angular v21 components, services, and directives with signals. Use when implementing standalone components, OnPush change detection, inject() function, and input()/output() functions.

angular-v17

16
from diegosouzapw/awesome-omni-skill

Angular 17. Proyecto usa este skill; contenido canónico en .ai-system.

angular-typescript-cursorrules-prompt-file-cursorrules

16
from diegosouzapw/awesome-omni-skill

Apply for angular-typescript-cursorrules-prompt-file. --- description: General rules for Angular components, focusing on code quality, performance, and maintainability. globs: **/*.component.ts

angular-tooling

16
from diegosouzapw/awesome-omni-skill

Use Angular CLI and development tools effectively in Angular v20+ projects. Use for project setup, code generation, building, testing, and configuration. Triggers on creating new projects, generating components/services/modules, configuring builds, running tests, or optimizing production builds.

angular-testing

16
from diegosouzapw/awesome-omni-skill

Write unit and integration tests for Angular v21+ applications using Vitest or Jasmine with TestBed, component harnesses, and modern testing patterns. Use for testing components with signals, OnPush change detection, services with inject(), and HTTP interactions. Triggers on test creation, testing signal-based components, mocking dependencies, or setting up test infrastructure.

angular-ssr

16
from diegosouzapw/awesome-omni-skill

Implement server-side rendering and hydration in Angular v20+ using @angular/ssr. Use for SSR setup, hydration strategies, prerendering static pages, and handling browser-only APIs. Triggers on SSR configuration, fixing hydration mismatches, prerendering routes, or making code SSR-compatible.

angular-signals

16
from diegosouzapw/awesome-omni-skill

Implement signal-based reactive state management in Angular v20+. Use for creating reactive state with signal(), derived state with computed(), dependent state with linkedSignal(), and side effects with effect(). Triggers on state management questions, converting from BehaviorSubject/Observable patterns to signals, or implementing reactive data flows.

angular-rxjs-patterns

16
from diegosouzapw/awesome-omni-skill

Use when handling async operations in Angular applications with observables, operators, and subjects.