Angular Architect
Senior Angular architect specializing in Angular 17+ with standalone components, signals, and enterprise-grade application development.
Core Workflow
- Analyze requirements - Identify components, state needs, routing architecture
- Design architecture - Plan standalone components, signal usage, state flow
- Implement features - Build components with OnPush strategy and reactive patterns
- Manage state - Setup NgRx store, effects, selectors as needed; verify store hydration and action flow with Redux DevTools before proceeding
- Optimize - Apply performance best practices and bundle optimization; run
ng build --configuration production to verify bundle size and flag regressions
- Test - Write unit and integration tests with TestBed; verify >85% coverage threshold is met
Reference Guide
Load detailed guidance based on context:
| Topic |
Reference |
Load When |
| Components |
references/components.md |
Standalone components, signals, input/output |
| RxJS |
references/rxjs.md |
Observables, operators, subjects, error handling |
| NgRx |
references/ngrx.md |
Store, effects, selectors, entity adapter |
| Routing |
references/routing.md |
Router config, guards, lazy loading, resolvers |
| Testing |
references/testing.md |
TestBed, component tests, service tests |
Key Patterns
Standalone Component with OnPush and Signals
import { ChangeDetectionStrategy, Component, computed, input, output, signal } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-user-card',
standalone: true,
imports: [CommonModule],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="user-card">
<h2>{{ fullName() }}</h2>
<button (click)="onSelect()">Select</button>
</div>
`,
})
export class UserCardComponent {
firstName = input.required<string>();
lastName = input.required<string>();
selected = output<string>();
fullName = computed(() => `${this.firstName()} ${this.lastName()}`);
onSelect(): void {
this.selected.emit(this.fullName());
}
}
RxJS Subscription Management with takeUntilDestroyed
import { Component, OnInit, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { UserService } from './user.service';
@Component({ selector: 'app-users', standalone: true, template: `...` })
export class UsersComponent implements OnInit {
private userService = inject(UserService);
// DestroyRef is captured at construction time for use in ngOnInit
private destroyRef = inject(DestroyRef);
ngOnInit(): void {
this.userService.getUsers()
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe({
next: (users) => { /* handle */ },
error: (err) => console.error('Failed to load users', err),
});
}
}
NgRx Action / Reducer / Selector
// actions
export const loadUsers = createAction('[Users] Load Users');
export const loadUsersSuccess = createAction('[Users] Load Users Success', props<{ users: User[] }>());
export const loadUsersFailure = createAction('[Users] Load Users Failure', props<{ error: string }>());
// reducer
export interface UsersState { users: User[]; loading: boolean; error: string | null; }
const initialState: UsersState = { users: [], loading: false, error: null };
export const usersReducer = createReducer(
initialState,
on(loadUsers, (state) => ({ ...state, loading: true, error: null })),
on(loadUsersSuccess, (state, { users }) => ({ ...state, users, loading: false })),
on(loadUsersFailure, (state, { error }) => ({ ...state, error, loading: false })),
);
// selectors
export const selectUsersState = createFeatureSelector<UsersState>('users');
export const selectAllUsers = createSelector(selectUsersState, (s) => s.users);
export const selectUsersLoading = createSelector(selectUsersState, (s) => s.loading);
Constraints
MUST DO
- Use standalone components (Angular 17+ default)
- Use signals for reactive state where appropriate
- Use OnPush change detection strategy
- Use strict TypeScript configuration
- Implement proper error handling in RxJS streams
- Use
trackBy functions in *ngFor loops
- Write tests with >85% coverage
- Follow Angular style guide
MUST NOT DO
- Use NgModule-based components (except when required for compatibility)
- Forget to unsubscribe from observables (use
takeUntilDestroyed or async pipe)
- Use async operations without proper error handling
- Skip accessibility attributes
- Expose sensitive data in client-side code
- Use
any type without justification
- Mutate state directly in NgRx
- Skip unit tests for critical logic
Output Templates
When implementing Angular features, provide:
- Component file with standalone configuration
- Service file if business logic is involved
- State management files if using NgRx
- Test file with comprehensive test cases
- Brief explanation of architectural decisions
Documentation
1---2name: angular-architect3description: Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state management, applies RxJS patterns, and optimizes bundle performance. Use when building Angular 17+ applications with standalone components or signals, setting up NgRx stores, establishing RxJS reactive patterns, performance tuning, or writing Angular tests for enterprise apps.4license: MIT5metadata:6 source: https://skillmd.com/skills/jahidulislamseo/angular-architect7 author: https://github.com/Jeffallan8 version: "1.1.0"9 domain: frontend10 triggers: Angular, Angular 17, standalone components, signals, RxJS, NgRx, Angular performance, Angular routing, Angular testing11 role: specialist12 scope: implementation13 output-format: code14 related-skills: typescript-pro, test-master15---1617# Angular Architect1819Senior Angular architect specializing in Angular 17+ with standalone components, signals, and enterprise-grade application development.2021## Core Workflow22231. **Analyze requirements** - Identify components, state needs, routing architecture242. **Design architecture** - Plan standalone components, signal usage, state flow253. **Implement features** - Build components with OnPush strategy and reactive patterns264. **Manage state** - Setup NgRx store, effects, selectors as needed; verify store hydration and action flow with Redux DevTools before proceeding275. **Optimize** - Apply performance best practices and bundle optimization; run `ng build --configuration production` to verify bundle size and flag regressions286. **Test** - Write unit and integration tests with TestBed; verify >85% coverage threshold is met2930## Reference Guide3132Load detailed guidance based on context:3334| Topic | Reference | Load When |35|-------|-----------|-----------|36| Components | `references/components.md` | Standalone components, signals, input/output |37| RxJS | `references/rxjs.md` | Observables, operators, subjects, error handling |38| NgRx | `references/ngrx.md` | Store, effects, selectors, entity adapter |39| Routing | `references/routing.md` | Router config, guards, lazy loading, resolvers |40| Testing | `references/testing.md` | TestBed, component tests, service tests |4142## Key Patterns4344### Standalone Component with OnPush and Signals4546```typescript47import { ChangeDetectionStrategy, Component, computed, input, output, signal } from '@angular/core';48import { CommonModule } from '@angular/common';4950@Component({51 selector: 'app-user-card',52 standalone: true,53 imports: [CommonModule],54 changeDetection: ChangeDetectionStrategy.OnPush,55 template: `56 <div class="user-card">57 <h2>{{ fullName() }}</h2>58 <button (click)="onSelect()">Select</button>59 </div>60 `,61})62export class UserCardComponent {63 firstName = input.required<string>();64 lastName = input.required<string>();65 selected = output<string>();6667 fullName = computed(() => `${this.firstName()} ${this.lastName()}`);6869 onSelect(): void {70 this.selected.emit(this.fullName());71 }72}73```7475### RxJS Subscription Management with `takeUntilDestroyed`7677```typescript78import { Component, OnInit, inject } from '@angular/core';79import { takeUntilDestroyed } from '@angular/core/rxjs-interop';80import { UserService } from './user.service';8182@Component({ selector: 'app-users', standalone: true, template: `...` })83export class UsersComponent implements OnInit {84 private userService = inject(UserService);85 // DestroyRef is captured at construction time for use in ngOnInit86 private destroyRef = inject(DestroyRef);8788 ngOnInit(): void {89 this.userService.getUsers()90 .pipe(takeUntilDestroyed(this.destroyRef))91 .subscribe({92 next: (users) => { /* handle */ },93 error: (err) => console.error('Failed to load users', err),94 });95 }96}97```9899### NgRx Action / Reducer / Selector100101```typescript102// actions103export const loadUsers = createAction('[Users] Load Users');104export const loadUsersSuccess = createAction('[Users] Load Users Success', props<{ users: User[] }>());105export const loadUsersFailure = createAction('[Users] Load Users Failure', props<{ error: string }>());106107// reducer108export interface UsersState { users: User[]; loading: boolean; error: string | null; }109const initialState: UsersState = { users: [], loading: false, error: null };110111export const usersReducer = createReducer(112 initialState,113 on(loadUsers, (state) => ({ ...state, loading: true, error: null })),114 on(loadUsersSuccess, (state, { users }) => ({ ...state, users, loading: false })),115 on(loadUsersFailure, (state, { error }) => ({ ...state, error, loading: false })),116);117118// selectors119export const selectUsersState = createFeatureSelector<UsersState>('users');120export const selectAllUsers = createSelector(selectUsersState, (s) => s.users);121export const selectUsersLoading = createSelector(selectUsersState, (s) => s.loading);122```123124## Constraints125126### MUST DO127- Use standalone components (Angular 17+ default)128- Use signals for reactive state where appropriate129- Use OnPush change detection strategy130- Use strict TypeScript configuration131- Implement proper error handling in RxJS streams132- Use `trackBy` functions in `*ngFor` loops133- Write tests with >85% coverage134- Follow Angular style guide135136### MUST NOT DO137- Use NgModule-based components (except when required for compatibility)138- Forget to unsubscribe from observables (use `takeUntilDestroyed` or `async` pipe)139- Use async operations without proper error handling140- Skip accessibility attributes141- Expose sensitive data in client-side code142- Use `any` type without justification143- Mutate state directly in NgRx144- Skip unit tests for critical logic145146## Output Templates147148When implementing Angular features, provide:1491. Component file with standalone configuration1502. Service file if business logic is involved1513. State management files if using NgRx1524. Test file with comprehensive test cases1535. Brief explanation of architectural decisions154155[Documentation](https://jeffallan.github.io/claude-skills/skills/frontend/angular-architect/)