Claude-skill-registry-data migrate-page
Migrate Angular page from local source following DDD architecture. Use when migrating pages from Angular 16 to Angular 20 with domain-driven design patterns.
git clone https://github.com/majiayu000/claude-skill-registry-data
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry-data "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/migrate-page" ~/.claude/skills/majiayu000-claude-skill-registry-data-migrate-page && rm -rf "$T"
data/migrate-page/SKILL.mdPage Migration Command
Migrate a page from legacy Angular project (Angular 16) to new one-ui monorepo (Angular 20) following DDD architecture.
Arguments
- Format:$ARGUMENTS--from <source_path> --to <target_path>
: Source path in old project (e.g.,--from
)/Users/jayden/f2e-networking-jayden/apps/mxsecurity-web/src/app/pages/account
: Target path in new project (e.g.,--to
)libs/mxsecurity/account-page
Note: No page ID required
Only provide
and--frompath arguments, no additional page ID needed.--to
Workflow
Phase 1: Source Analysis
Analyze the source path and create a migration analysis document in
{target}/domain/src/lib/docs/MIGRATION-ANALYSIS.md:
-
File Structure Analysis
- List all files in the source directory
- Categorize by type: components, services, models, templates, styles
-
Component Analysis
- Identify all components and their relationships
- Note parent/child relationships
- Identify dialog components
- Identify table/form components
-
Form Validation Analysis
- List all form controls and their validators
- Identify
usage that needsValidators.*
replacementOneValidators.* - Document custom validators
-
API Calls Analysis
- List all HTTP calls (endpoints, methods, request/response types)
- Identify API services being used
- Document data flow
-
Dependencies Analysis
- Third-party libraries used
- Angular Material components used
- Shared services/utils used
-
UI Interactions (for E2E testing)
- Button clicks and their actions
- Form submissions
- Dialog open/close triggers
- Table operations (select, edit, delete, add)
- Navigation actions
-
Translation Keys Analysis (CRITICAL)
- DO NOT create new translation keys
- DO NOT modify existing translation keys
- List all translation keys used in source HTML templates
- Copy exact keys for use in migrated components
- Document all translation keys by category:
- Page titles
- Tab labels
- Dialog titles and descriptions
- Form field labels
- Button labels
- Tooltip texts
- Table column headers
- Error messages and hints
-
Form Layout Analysis (CRITICAL)
- DO NOT change form field row groupings
- Analyze
patterns in source templatesfxLayout="row" - Document which fields appear on same row
- Use
class in migrated components to preserve layout.form-row
Phase 2: DDD Structure Migration
Reference documents from
one-ui-migration skill's rules/ directory:
Reference Docs (
rules/reference/):
- DDD layers, helper filesddd-architecture.md
- API types, def filesapi-types.md
- Full compliance checklistchecklist.md
- Common migration mistakespitfalls/
Tool Docs (
rules/tools/):
- OneValidators usage, pattern constantsforms/validators.md
- Template errors, custom errorsforms/error-handling.md
- Page layout, breadcrumbui/page-layout.md
- Form layout, validationui/forms.md
- Button types, loading statesui/buttons.md
- File upload, form patternsui/components.md
- Dialog config, viewContainerRefui/dialogs.md
- CommonTableComponenttables/basics.md
- Column API, custom templatestables/columns.md
- Paginator configtables/advanced.md
Guides (
rules/guides/):
- Page creation guidecreate-page.md
- Dialog creation guidecreate-dialog.md
- Table creation guidecreate-table.md
Generate libraries using the Nx plugin:
# Generate all library types at once nx g @one-ui/one-plugin:library mxsecurity {page-name} all # Or generate individually if needed nx g @one-ui/one-plugin:library mxsecurity {page-name} domain nx g @one-ui/one-plugin:library mxsecurity {page-name} features nx g @one-ui/one-plugin:library mxsecurity {page-name} ui nx g @one-ui/one-plugin:library mxsecurity {page-name} shell
Chunked Migration Strategy (Reducing Omission Risk)
Principle: Process from large sections to small units, completing each before proceeding
- Segment by
- First identify the number of tabs on the page, then process each tab independentlymat-tab - Segment by
/ section - Within each tab, identify all cards/sectionsmat-card - Migrate and verify incrementally - Execute
immediately after completing each segment/migration-lint
Example Checklist:
### Tab 1: General Settings - [x] Card 1.1: Basic Info - [ ] Card 1.2: Network Config ### Tab 2: Security - [ ] Card 2.1: Authentication
Phase 3: Layer-by-Layer Migration
-
Domain Layer (
) - seedomain/rules/reference/ddd-architecture.md- API response types → use existing types from
(e.g.,@one-ui/mxsecurity/shared/domain
)SRV_USER_ACCOUNT - If API type missing → create in
libs/mxsecurity/shared/domain/src/lib/models/api/ - Page-specific models (view models, form models) →
*.model.ts - Migrate API service →
*.api.ts - Create SignalStore →
*.store.ts - Migrate constants →
*.def.ts - Extract pure functions →
(data transformations, serialization)*.helper.ts - Keep
inMIGRATION-ANALYSIS.md
folderdomain/src/lib/docs/
- API response types → use existing types from
-
UI Layer (
) - seeui/rules/tools/tables/basics.md- Migrate tables → use
patternCommonTableComponent - Migrate forms → use
,input()
patternoutput() - Table toolbar → use
withmat-stroked-button
/general.button.createdelete - Keep components dumb (no store injection, no HTTP)
- Migrate tables → use
-
Features Layer (
) - seefeatures/
,rules/tools/ui/forms.md
andbuttons.mddialogs.md- Migrate page component → smart component pattern
- Migrate dialogs → use
,smallDialogConfig
,mediumDialogConfiglargeDialogConfig - Form tooltips → use
instead ofmxLabelTooltip
withmat-iconmatTooltip - Inject store, pass data to UI via inputs
-
Shell Layer (
)shell/- Create routes with resolver pattern
- Provide store and services
-
App Routes Registration (see
)rules/tools/ui/page-layout.md- Add route to
apps/mxsecurity/mxsecurity/src/app/app.routes.ts - Register in
children array with breadcrumb resolver:appRoutes
import { createBreadcrumbResolver, ROUTES_ALIASES } from '@one-ui/mxsecurity/shared/domain'; { path: ROUTES_ALIASES['{pageAlias}'].route, loadChildren: () => import('@one-ui/mxsecurity/{page-name}/shell').then((m) => m.createRoutes()), resolve: { breadcrumb: createBreadcrumbResolver(ROUTES_ALIASES['{pageAlias}'].id) } } - Add route to
Phase 4: Syntax Modernization
Apply Angular 20 syntax updates (see
rules/reference/angular-20-syntax.md):
→*ngIf@if
→*ngFor@for (item of items; track item.id)
→constructor(private service: Service)inject()
→@Input()input()
→@Output()output()
→BehaviorSubjectsignal()
Form Validation (see
rules/tools/forms/validators.md):
→Validators.required
(no parentheses)OneValidators.required
→Validators.email
(no parentheses)OneValidators.email
→Validators.minLength(n)OneValidators.minLength(n)- Import from
@one-ui/mxsecurity/shared/domain
UI Patterns:
-
Buttons (see
):buttons.md
→mat-raised-buttonmat-flat-button- Form tooltips: Use
instead ofmxLabelTooltip
withmat-iconmatTooltip - Loading states: Use
withMxLoadingButtonDirective[mxButtonIsLoading]="loading()"
-
Page Layout (see
):ui/page-layout.md
→mat-card<div class="content-wrapper">
-
Dialogs (see
):dialogs.md- Dialog sizing: Use
,smallDialogConfig
,mediumDialogConfiglargeDialogConfig - Dialog API calls: Call API inside dialog, close only on success via
callbacknext - Dialog viewContainerRef: Set
when dialog uses storeviewContainerRef: this.#viewContainerRef
- Dialog sizing: Use
-
Tables (see
):basics.md- Table toolbar buttons: Use
withmat-stroked-button
/general.button.creategeneral.button.delete
- Table toolbar buttons: Use
Helper Files (see
rules/reference/ddd-architecture.md):
- Extract pure functions to
files in domain layer*.helper.ts - Keep store files focused on state management
Translation Keys (see
rules/reference/pitfalls/translation-layout.md):
- MUST use exact same translation keys as source
- Read source HTML templates to find correct keys
- DO NOT create new keys or modify existing ones
- Example:
→{{ 'general.common.name' | translate }}{{ t('general.common.name') }}
Number-Only Input Directive (see
rules/reference/pitfalls/forms-services.md):
- MUST replace
withappNumberOnlyoneUiNumberOnly - Search source for
usage:appNumberOnlygrep -r "appNumberOnly" {source_path} - Import
fromNumberOnlyDirective@one-ui/mxsecurity/shared/domain - Location:
libs/mxsecurity/shared/domain/src/lib/directives/number-only.directive.ts
Phase 5: Verification
# Type check npx tsc --noEmit --project libs/mxsecurity/{page-name}/domain/tsconfig.lib.json # Lint nx lint mxsecurity-{page-name}-domain nx lint mxsecurity-{page-name}-features nx lint mxsecurity-{page-name}-ui nx lint mxsecurity-{page-name}-shell # Build nx build mxsecurity-web
Output Format
After completing migration analysis (Phase 1), save the analysis to:
{target}/domain/src/lib/docs/MIGRATION-ANALYSIS.md
The document should contain:
- File structure overview
- Component hierarchy
- Form validations to migrate
- API endpoints to migrate
- UI interaction steps (for E2E testing)
- Migration checklist with checkboxes
Reference Examples
- MAF Account Settings:
libs/maf/act-account/ - Switch L3 Interface:
libs/switch/l3-interface/ - MXsecurity Login:
libs/mxsecurity/login-page/