Skip to content

Commit 248e9c1

Browse files
Jad31atscott
authored andcommitted
docs: add Signal Forms and v22 guidance to AI best-practices and llms.txt
Update the AI codegen resources for Angular v22: - best-practices.md: OnPush is the default in v22+ (don't set it explicitly), recommend Signal Forms, and recommend the @service decorator. - llms.txt: add a Signal Forms reference, the httpResource guide, and an Accessibility section linking the Angular Aria overview.
1 parent 2e4ed80 commit 248e9c1

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

adev/src/llms.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Angular — Deliver web apps with confidence 🚀
6464
- [Setting up the HttpClient](https://angular.dev/guide/http/setup)
6565
- [Making requests](https://angular.dev/guide/http/making-requests)
6666
- [Intercepting requests](https://angular.dev/guide/http/interceptors)
67+
- [Reactive data fetching with httpResource](https://angular.dev/guide/http/http-resource)
6768
- [Testing](https://angular.dev/guide/http/testing)
6869

6970
## Forms
@@ -73,6 +74,10 @@ Angular — Deliver web apps with confidence 🚀
7374
- [Template driven forms](https://angular.dev/guide/forms/template-driven-forms)
7475
- [Validate forms input](https://angular.dev/guide/forms/form-validation)
7576
- [Building dynamic forms](https://angular.dev/guide/forms/dynamic-forms)
77+
- [Signal Forms](https://angular.dev/guide/forms/signals/overview)
78+
79+
## Accessibility
80+
- [Angular Aria overview](https://angular.dev/guide/aria/overview)
7681

7782
## Routing
7883
- [Routing overview](https://angular.dev/guide/routing)

packages/core/resources/best-practices.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ You are an expert in TypeScript, Angular, and scalable web application developme
1010

1111
- Always use standalone components over NgModules
1212
- Must NOT set `standalone: true` inside Angular decorators. It's the default in Angular v20+.
13+
- Do NOT set `changeDetection: ChangeDetectionStrategy.OnPush` explicitly. `OnPush` is the default in Angular v22+.
1314
- Use signals for state management
1415
- Implement lazy loading for feature routes
1516
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
@@ -29,7 +30,8 @@ You are an expert in TypeScript, Angular, and scalable web application developme
2930
- Use `computed()` for derived state
3031
- Use `linkedSignal()` for state derived from multiple reactive sources that must stay synchronized
3132
- Prefer inline templates for small components
32-
- Prefer Reactive forms instead of Template-driven ones
33+
- Prefer Signal Forms (`@angular/forms/signals`) for new forms. They are stable in Angular v22+ and provide signal-based state, type-safe field access, and schema-based validation
34+
- When not using Signal Forms, prefer Reactive forms instead of Template-driven ones
3335
- Do NOT use `ngClass`, use `class` bindings instead
3436
- Do NOT use `ngStyle`, use `style` bindings instead
3537
- When using external templates/styles, use paths relative to the component TS file.
@@ -52,4 +54,5 @@ You are an expert in TypeScript, Angular, and scalable web application developme
5254

5355
- Design services around a single responsibility
5456
- Use the `providedIn: 'root'` option for singleton services
57+
- Prefer the `@Service` decorator over `@Injectable({providedIn: 'root'})` for new singleton services (Angular v22+)
5558
- Use the `inject()` function instead of constructor injection

0 commit comments

Comments
 (0)