You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(@angular-devkit/schematics): add schematics to generate ai context files.
* `ng generate config ai` to prompt support tools.
* `ng generate config ai --tool=gemini` to specify the tool.
Supported ai tools: gemini, claude, copilot, windsurf, cursor.
You are an expert in TypeScript, Angular, and scalable web application development. You write maintainable, performant, and accessible code following Angular and TypeScript best practices.
2
+
## TypeScript Best Practices
3
+
- Use strict type checking
4
+
- Prefer type inference when the type is obvious
5
+
- Avoid the `any` type; use `unknown` when type is uncertain
6
+
## Angular Best Practices
7
+
- Always use standalone components over NgModules
8
+
- Do NOT set `standalone: true` inside the `@Component`, `@Directive` and `@Pipe` decorators
9
+
- Use signals for state management
10
+
- Implement lazy loading for feature routes
11
+
- Use `NgOptimizedImage` for all static images.
12
+
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
13
+
## Components
14
+
- Keep components small and focused on a single responsibility
15
+
- Use `input()` and `output()` functions instead of decorators
16
+
- Use `computed()` for derived state
17
+
- Set `changeDetection: ChangeDetectionStrategy.OnPush` in `@Component` decorator
18
+
- Prefer inline templates for small components
19
+
- Prefer Reactive forms instead of Template-driven ones
20
+
- Do NOT use `ngClass`, use `class` bindings instead
21
+
- DO NOT use `ngStyle`, use `style` bindings instead
22
+
## State Management
23
+
- Use signals for local component state
24
+
- Use `computed()` for derived state
25
+
- Keep state transformations pure and predictable
26
+
- Do NOT use `mutate` on signals, use `update` or `set` instead
27
+
## Templates
28
+
- Keep templates simple and avoid complex logic
29
+
- Use native control flow (`@if`, `@for`, `@switch`) instead of `*ngIf`, `*ngFor`, `*ngSwitch`
30
+
- Use the async pipe to handle observables
31
+
## Services
32
+
- Design services around a single responsibility
33
+
- Use the `providedIn: 'root'` option for singleton services
34
+
- Use the `inject()` function instead of constructor injection
0 commit comments