refactor(rules): keep Angular index focused

This commit is contained in:
fraujulian committed 2026-09-24 21:45:15 +02:00
1 parent 5c25b4fe5a
commit c91505a568
2 files changed
+15 -36

No files matched your search

+12 -36
View File
@@ -1,38 +1,14 @@
# Angular Code Guidelines # Angular Rules
* Use modern Angular patterns and current framework conventions. For Angular work, open the focused topic rule that matches the change. Apply the security and accessibility rule whenever browser-facing behavior is affected.
* Prefer standalone components, directives and pipes for new code.
* Avoid introducing `NgModule` unless the existing project architecture requires it.
* Keep components small and focused.
* Keep templates simple.
* Move complex logic out of templates.
* Keep business logic out of components where practical.
* Prefer services, facades or dedicated domain logic for non-trivial behavior.
* Avoid god components and god services.
* Keep dependencies explicit.
* Prefer composition over inheritance.
* Avoid unnecessary abstractions.
* Avoid unnecessary wrapper components.
* Follow the existing project architecture unless there is a strong reason to change it.
## Safety Rule | Topic | Codex rule | Claude skill |
| --- | --- | --- |
* Angular frontend code is never a security boundary. | Components and state | `references/components-and-state.md` | `rules-angular-components-and-state` |
* Client-side validation, guards, hidden controls and disabled UI elements do not replace backend enforcement. | Templates and styling | `references/templates-and-styling.md` | `rules-angular-templates-and-styling` |
* Do not bypass Angular's built-in security mechanisms without a verified and explicit reason. | RxJS | `references/rxjs.md` | `rules-angular-rxjs` |
* Prefer safe framework defaults over custom low-level behavior. | Services and HTTP | `references/services-and-http.md` | `rules-angular-services-and-http` |
| Forms and routing | `references/forms-and-routing.md` | `rules-angular-forms-and-routing` |
## Detailed guidance | Security and accessibility | `references/security-and-accessibility.md` | `rules-angular-security-and-accessibility` |
| Performance | `references/performance.md` | `rules-angular-performance` |
Read the matching reference file before working in that area: | Testing and architecture | `references/testing-and-architecture.md` | `rules-angular-testing-and-architecture` |
| Read this reference for... | ...this kind of work |
| --- | --- |
| `references/components-and-state.md` | Component structure, signal-based state |
| `references/templates-and-styling.md` | Template markup, CSS/styling |
| `references/rxjs.md` | RxJS observables and subscriptions |
| `references/services-and-http.md` | Dependency injection, services, HTTP/API access |
| `references/forms-and-routing.md` | Reactive forms, routing |
| `references/security-and-accessibility.md` | Security, DOM/browser APIs, accessibility |
| `references/performance.md` | Performance work and its priority order |
| `references/testing-and-architecture.md` | Testing, architecture, code quality, dependency rules |
@@ -1,5 +1,8 @@
## Components ## Components
* Prefer standalone components, directives, and pipes for new work. Avoid introducing `NgModule` unless the existing architecture requires it.
* Keep components small; move substantial business logic to a focused service or domain layer.
* Keep dependencies explicit and follow the feature architecture. Avoid god components, god services, unnecessary wrappers, and abstractions without a concrete need.
* Use `ChangeDetectionStrategy.OnPush` unless there is a concrete reason not to. * Use `ChangeDetectionStrategy.OnPush` unless there is a concrete reason not to.
* Prefer signal-based state for local component state. * Prefer signal-based state for local component state.
* Prefer `computed` for derived state. * Prefer `computed` for derived state.