angular-modernization

작성자: bitwarden

Angular 코드(예: 컴포넌트 및 디렉티브)를 자동 CLI 마이그레이션과 Bitwarden 특화 패턴을 모두 사용하여 모범 사례를 따르도록 현대화합니다. YOU…

npx skills add https://github.com/bitwarden/clients --skill angular-modernization

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

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

NgModule-based → standalone architecture

2. Control Flow Syntax

npx ng generate @angular/core:control-flow

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

3. Signal Inputs

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

@Input() → signal inputs

4. Signal Outputs

npx ng generate @angular/core:output-migration

@Output() → signal outputs

5. Signal Queries

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

@ViewChild, @ContentChild, etc. → signal queries

6. inject() Function

npx ng generate @angular/core:inject-migration

Constructor injection → inject() function

7. Self-Closing Tag

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

Updates templates to self-closing syntax

8. Unused Imports

npx ng generate @angular/core:unused-imports

Removes unused imports

Step 2: Apply Bitwarden Patterns

See 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)
  • Tests updated and passing
  • No new TypeScript enums
  • No code regions

References

Bitwarden ADRs

Angular Resources

bitwarden의 다른 스킬

figma-to-angular
bitwarden
이 스킬은 Figma 디자인 스펙을 Bitwarden Clients 모노레포 내에서 Storybook 스토리와 함께 완전히 구현된 Angular 컴포넌트로 변환합니다. 출력물은 모든 코드베이스 규칙을 따르면서 시각적으로 디자인과 일치해야 합니다.
force-multiplier
bitwarden
하나의 의도를 여러 대상에 동시에 적용합니다 — Bitwarden 생태계 전반의 저장소 플릿, 또는 모노레포 내 많은 프로젝트 — N개의 일관된 작업으로, …
analyzing-git-sessions
bitwarden
특정 기간이나 커밋 범위 내의 Git 커밋과 변경 사항을 분석하여 코드 리뷰, 회고, 작업 로그 또는 세션을 위한 구조화된 요약을 제공합니다.
coordinating-cross-team-breakdown
bitwarden
크로스 팀 리뷰 및 Bitwarden 기술 분석에 대한 승인을 조정합니다. 영향을 받는 팀을 식별하고, 파트 3 승인 테이블을 작성하며, 후속 조치를 진행할 때 사용하세요.
assessing-jira-issue-relevance
bitwarden
사용자가 개별 Jira 이슈 키를 제공하고 그것이 여전히 관련이 있는지, 여전히 적용 가능한지, 여전히 보류 중인지, 여전히 버그인지, 수정되었는지, 또는 …인지 물을 때 사용합니다.
assessing-test-coverage
bitwarden
특정 변경(PR, Jira 키, Tech Breakdown 문서, Testmo CSV, 변경된 경로 또는 명명된 항목)에 대해 이미 존재하는 테스트 커버리지를 파악할 때 사용합니다.
retrospecting
bitwarden
Claude Code 세션에 대한 포괄적인 분석을 수행하며, git 히스토리, 대화 로그, 코드 변경 사항을 검토하고 사용자 피드백을 수집하여 생성합니다…
reviewing-incremental-changes
bitwarden
이미 코멘트가 달린 PR을 재검토하거나 초기 리뷰 후 개발자의 변경 사항에 응답할 때 이 스킬을 사용하세요. PR 스레드가 존재하거나...