angular-best-practices by alfredoperez/angular-best-practices
npx skills add https://github.com/alfredoperez/angular-best-practices --skill angular-best-practices一套完整的规则集,涵盖从 TypeScript 严格性到基于信号的响应式、SSR 水合、包优化和无障碍 UI 等方方面面——确保您交付的每个组件、服务和路由都快速、经过测试且易于维护。
strict: true 进行严格类型检查any;类型不确定时使用 unknownimport typereadonlyChangeDetectionStrategy.OnPushinput() 和 output() 函数,而非 / 装饰器广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
@Input()@Output()inject() 而非构造函数注入computed() —— 具有记忆化功能,仅在依赖项变化时重新计算@if、@for、@switch 替代 *ngIf、*ngFor、*ngSwitch[class.active] 绑定替代 [ngClass]@defer@for 循环提供 trackcomputed() 替代 gettereffect() 用于副作用——切勿用于状态同步toSignal() 将 RxJS 可观察对象桥接到基于信号的模板中@defertakeUntilDestroyed() 或 async 管道catchError 放在 switchMap 内部以保持外部流存活switchMap,对“忙碌时忽略”使用 exhaustMapjasmine.createSpyObj 或 jest.fn() 模拟服务| 模式 | 使用 | 避免 |
|---|---|---|
| 信号输入 | input<T>() | @Input() |
| 信号输出 | output<T>() | @Output() |
| 依赖注入 | inject() | 构造函数注入 |
| 控制流 | @if, @for, @switch | *ngIf, *ngFor |
| 类绑定 | [class.active] | [ngClass] |
| 变更检测 | OnPush | 默认 |
| 派生状态 | computed() | Getter |
将此核心技能与特定库的规则一起安装:
| 库 | 技能页面 |
|---|---|
| NgRx | angular-best-practices-ngrx |
| SignalStore | angular-best-practices-signalstore |
| TanStack Query | angular-best-practices-tanstack |
| Angular Material | angular-best-practices-material |
| PrimeNG | angular-best-practices-primeng |
| Spartan UI | angular-best-practices-spartan |
| Transloco | angular-best-practices-transloco |
MIT
每周安装量
236
仓库
GitHub 星标数
19
首次出现
2026年2月7日
安全审计
安装于
github-copilot228
opencode222
codex222
gemini-cli219
kimi-cli216
amp216
A complete set of rules covering everything from TypeScript strictness to signal-based reactivity, SSR hydration, bundle optimization, and accessible UI — so every component, service, and route you ship is fast, tested, and maintainable.
strict: true in tsconfigany; use unknown when type is uncertainimport type for type-only importsreadonly for data that should not be mutatedChangeDetectionStrategy.OnPushinput() and output() functions instead of @Input() / @Output() decoratorsinject() instead of constructor injectioncomputed() for derived state — memoized, only recalculates when dependencies change@if, @for, @switch instead of *ngIf, *ngFor, *ngSwitch[class.active] bindings instead of [ngClass]@defer for heavy below-fold contenttrack with @for loopscomputed() for derived state instead of getterseffect() for side effects only — never for state synchronizationtoSignal() to bridge RxJS observables into signal-based templates@defer heavy viewstakeUntilDestroyed() or async pipecatchError inside switchMap to keep the outer stream aliveswitchMap for latest-only, exhaustMap for ignore-while-busyjasmine.createSpyObj or jest.fn()| Pattern | Use | Avoid |
|---|---|---|
| Signal inputs | input<T>() | @Input() |
| Signal outputs | output<T>() | @Output() |
| Dependency injection | inject() | Constructor injection |
| Control flow | @if, @for, |
Install library-specific rules alongside this core skill:
| Library | Skill Page |
|---|---|
| NgRx | angular-best-practices-ngrx |
| SignalStore | angular-best-practices-signalstore |
| TanStack Query | angular-best-practices-tanstack |
| Angular Material | angular-best-practices-material |
| PrimeNG | angular-best-practices-primeng |
| Spartan UI | angular-best-practices-spartan |
| Transloco | angular-best-practices-transloco |
MIT
Weekly Installs
236
Repository
GitHub Stars
19
First Seen
Feb 7, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot228
opencode222
codex222
gemini-cli219
kimi-cli216
amp216
Vue.js测试最佳实践:Vue 3组件、组合式函数、Pinia与异步测试完整指南
3,700 周安装
OpenAI Assistants API v2 使用指南与迁移方案 - 2026年弃用前必看
313 周安装
MCP CLI 脚本开发指南:为Claude Code构建高效本地工具与自动化脚本
313 周安装
Playwright MCP 开发指南:如何为微软 Playwright 添加 MCP 工具和 CLI 命令
313 周安装
Shopify开发专家 | 电商平台定制、API集成、主题开发与无头电商解决方案
313 周安装
Sentry SDK 设置指南:跨平台错误监控、性能追踪与会话回放集成
313 周安装
LLM安全指南:OWASP LLM十大安全风险2025防护规则与最佳实践
313 周安装
@switch*ngIf, *ngFor |
| Class binding | [class.active] | [ngClass] |
| Change detection | OnPush | Default |
| Derived state | computed() | Getters |