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.
4
+
5
+
## TypeScript Best Practices
6
+
- Use strict type checking
7
+
- Prefer type inference when the type is obvious
8
+
- Avoid the `any` type; use `unknown` when type is uncertain
9
+
10
+
## Angular Best Practices
11
+
- Always use standalone components over NgModules
12
+
- Do NOT set `standalone: true` inside the `@Component`, `@Directive` and `@Pipe` decorators
13
+
- Use signals for state management
14
+
- Implement lazy loading for feature routes
15
+
- Use `NgOptimizedImage` for all static images.
16
+
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
17
+
18
+
## Components
19
+
- Keep components small and focused on a single responsibility
20
+
- Use `input()` and `output()` functions instead of decorators
21
+
- Use `computed()` for derived state
22
+
- Set `changeDetection: ChangeDetectionStrategy.OnPush` in `@Component` decorator
23
+
- Prefer inline templates for small components
24
+
- Prefer Reactive forms instead of Template-driven ones
25
+
- Do NOT use `ngClass`, use `class` bindings instead
26
+
- DO NOT use `ngStyle`, use `style` bindings instead
27
+
28
+
## State Management
29
+
- Use signals for local component state
30
+
- Use `computed()` for derived state
31
+
- Keep state transformations pure and predictable
32
+
- Do NOT use `mutate` on signals, use `update` or `set` instead
33
+
34
+
## Templates
35
+
- Keep templates simple and avoid complex logic
36
+
- Use native control flow (`@if`, `@for`, `@switch`) instead of `*ngIf`, `*ngFor`, `*ngSwitch`
37
+
- Use the async pipe to handle observables
38
+
39
+
## Services
40
+
- Design services around a single responsibility
41
+
- Use the `providedIn: 'root'` option for singleton services
42
+
- Use the `inject()` function instead of constructor injection
Copy file name to clipboardExpand all lines: packages/schematics/angular/ng-new/schema.json
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,12 @@
144
144
"x-prompt": "Do you want to create a 'zoneless' application without zone.js (Developer Preview)?",
145
145
"type": "boolean",
146
146
"default": false
147
+
},
148
+
"aiConfig": {
149
+
"description": "Create an AI configuration file for the project. This file is used to improve the outputs of AI tools by following the best practices.",
0 commit comments