angular-frontend-patterns
Skill34 starsChanged 9 days agoMITView on GitHub
Angular component and state patterns built on signals. Use when building Angular components, signal state, RxJS interop, routing or forms. angular-3d-scene-crafter and angular-gsap-animation-crafter are compatible siblings for scene construction and scroll motion, not replacements for this component and state guidance. React component work belongs to composition-patterns and react-best-practices.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Hive-Academy/ptah-extensionword for word, first seen Nov 3, 2026
Other versions1 project uses a version of this.
Word for word · 1
- Hive-Academy/ptah-extension★ 34100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-lanesSkill
- angular-3d-scene-crafterSkill
- angular-gsap-animation-crafterSkill
- ddd-architectureSkill
- execute-phase-gated-taskSkill
- frontend-designSkill
- humanize-librarySkill
- nestjs-backend-patternsSkill
- nestjs-deploymentSkill
- nx-workspace-architectSkill
- orchestrationSkill
- ptah-surface-authoringSkill
- resilient-nestjs-patternsSkill
- saas-platform-patternsSkill
- saas-workspace-initializerSkill
- session-handoffSkill
- skill-creatorSkill
- technical-content-writerSkill
- tribunalSkill
- ui-ux-designerSkill
- webhook-architectureSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use signals for synchronous state, observables for async streams.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Modern Angular Frontend Patterns
Signal-first, push-based architecture patterns for Angular 17+.
Core Principle: Signals Over Observables
Use signals for synchronous state, observables for async streams.
| Use Case | Pattern |
| Component state | signal(), computed() |
| API responses | toSignal() from observable |
| Form values | signal() for model |
| Event streams | Keep as Observable |
| WebSocket streams | Keep as Observable |
Signal Types Quick Reference
import { signal, computed, effect, input, output, model } from '@angular/core';
import { toSignal, toObservable } from '@angular/core/rxjs-interop';
// Writable signal
const count = signal(0);
count.set(5); // Replace value
count.update((v) => v + 1); // Update based on current
// Computed (derived, read-only)
const doubled = computed(() => count() * 2);
// Effect (side effects)
effect(() => console.log(count()));
// Input signals (component inputs)
name = input<string>(); // Optional
userId = input.required<string>(); // Required
size = input(10); // With default
active = input(false, { transform: booleanAttribute });
// Output
clicked = output<MouseEvent>();
// Model (two-way binding)
value = model(0); // Creates input + output
// Usage: <comp [(value)]="parentVal" />Smart vs Dumb Components
Smart (Container) Components
// libs/[domain]/feature/src/lib/user-list/user-list.component.ts
@Component({
selector: 'app-user-list',
standalone: true,
imports: [UserCardComponent, UserFilterComponent],
template: `
<app-user-filter (filterChange)="onFilterChange($event)" />
@if (loading()) {
<app-spinner />
} @else { @for (user of filteredUsers(); track user.id) {
<app-user-card [user]="user" (select)="onSelectUser($event)" />
} }
`,
})
export class UserListComponent {
private userService = inject(UserService);
private router = inject(Router);
// State
private filter = signal('');
loading = signal(false);
// Data from service
users = toSignal(this.userService.users$, { initialValue: [] });
// Derived state
filteredUsers = computed(() => {
const filter = this.filter().toLowerCase();
return this.users().filter((u) => u.name.toLowerCase().includes(filter));
});
onFilterChange(value: string) {
this.filter.set(value);
}
onSelectUser(userId: string) {
this.router.navigate(['/users', userId]);
}
}Dumb (Presentational) Components
// libs/[domain]/ui/src/lib/user-card/user-card.component.ts
@Component({
selector: 'app-user-card',
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div class="card" (click)="select.emit(user().id)">
<img [src]="user().avatar" [alt]="user().name" />
<h3>{{ user().name }}</h3>
<p>{{ user().email }}</p>
</div>
`,
})
export class UserCardComponent {
user = input.required<User>();
select = output<string>();
}State Management Pattern
// libs/[domain]/data-access/src/lib/user.service.ts
@Injectable({ providedIn: 'root' })
export class UserService {
private http = inject(HttpClient);
// Private writable state
private _users = signal<User[]>([]);
private _selectedUserId = signal<string | null>(null);
private _loading = signal(false);
private _error = signal<string | null>(null);
// Public read-only state
users = this._users.asReadonly();
loading = this._loading.asReadonly();
error = this._error.asReadonly();
// Computed state
selectedUser = computed(() => {
const id = this._selectedUserId();
return this._users().find((u) => u.id === id) ?? null;
});
activeUsers = computed(() => this._users().filter((u) => u.isActive));
// Observable for HTTP (keeps RxJS benefits)
users$ = this.http.get<User[]>('/api/users');
// Actions
loadUsers() {
this._loading.set(true);
this._error.set(null);
this.http
.get<User[]>('/api/users')
.pipe(
tap((users) => {
this._users.set(users);
this._loading.set(false);
}),
catchError((err) => {
this._error.set(err.message);
this._loading.set(false);
return EMPTY;
})
)
.subscribe();
}
selectUser(id: string | null) {
this._selectedUserId.set(id);
}
addUser(user: User) {
this._users.update((users) => [...users, user]);
}
updateUser(id: string, changes: Partial<User>) {
this._users.update((users) => users.map((u) => (u.id === id ? { ...u, ...changes } : u)));
}
}RxJS Integration
import { toSignal, toObservable } from '@angular/core/rxjs-interop';
// Observable → Signal
const users = toSignal(this.http.get<User[]>('/api/users'), {
initialValue: [],
});
// With loading state
const usersResource = toSignal(
this.http.get<User[]>('/api/users').pipe(
map((data) => ({ data, loading: false, error: null })),
startWith({ data: [], loading: true, error: null }),
catchError((err) => of({ data: [], loading: false, error: err.message }))
)
);
// Signal → Observable (for interop)
const searchTerm = signal('');
const searchTerm$ = toObservable(this.searchTerm);
// Debounced search
const searchResults = toSignal(
toObservable(this.searchTerm).pipe(
debounceTime(300),
distinctUntilChanged(),
switchMap((term) => this.searchService.search(term))
),
{ initialValue: [] }
);Decision Matrix
| Need | Pattern | Reference |
| Component state | Signals | SKILL.md |
| Component inputs | input() signals | SKILL.md |
| Derived/computed | computed() | SKILL.md |
| Side effects | effect() | effects-patterns.md |
| Forms | Signal-based | forms-patterns.md |
| HTTP/async | RxJS → toSignal() | rxjs-patterns.md |
| Container component | Smart component pattern | component-patterns.md |
| Reusable UI | Dumb component pattern | component-patterns.md |
References
Load these for detailed implementation guidance:
- component-patterns.md - Smart/dumb patterns, composition
- rxjs-patterns.md - RxJS best practices with signals
- forms-patterns.md - Reactive forms with signals
- effects-patterns.md - Effect patterns and pitfalls
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

