From c91505a568b53232dc101985dc4c88c7da5aa9c2 Mon Sep 17 00:00:00 2001 From: Julian Lechner Date: Thu, 24 Sep 2026 21:45:15 +0200 Subject: [PATCH] refactor(rules): keep Angular index focused --- shared/rules/angular/index.md | 48 +++++-------------- .../references/components-and-state.md | 3 ++ 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/shared/rules/angular/index.md b/shared/rules/angular/index.md index 1343c17..2bd13cd 100644 --- a/shared/rules/angular/index.md +++ b/shared/rules/angular/index.md @@ -1,38 +1,14 @@ -# Angular Code Guidelines +# Angular Rules -* Use modern Angular patterns and current framework conventions. -* 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. +For Angular work, open the focused topic rule that matches the change. Apply the security and accessibility rule whenever browser-facing behavior is affected. -## Safety Rule - -* Angular frontend code is never a security boundary. -* Client-side validation, guards, hidden controls and disabled UI elements do not replace backend enforcement. -* Do not bypass Angular's built-in security mechanisms without a verified and explicit reason. -* Prefer safe framework defaults over custom low-level behavior. - -## Detailed guidance - -Read the matching reference file before working in that area: - -| 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 | +| Topic | Codex rule | Claude skill | +| --- | --- | --- | +| Components and state | `references/components-and-state.md` | `rules-angular-components-and-state` | +| Templates and styling | `references/templates-and-styling.md` | `rules-angular-templates-and-styling` | +| RxJS | `references/rxjs.md` | `rules-angular-rxjs` | +| 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` | +| Security and accessibility | `references/security-and-accessibility.md` | `rules-angular-security-and-accessibility` | +| Performance | `references/performance.md` | `rules-angular-performance` | +| Testing and architecture | `references/testing-and-architecture.md` | `rules-angular-testing-and-architecture` | diff --git a/shared/rules/angular/references/components-and-state.md b/shared/rules/angular/references/components-and-state.md index 1dc7621..5ef82ab 100644 --- a/shared/rules/angular/references/components-and-state.md +++ b/shared/rules/angular/references/components-and-state.md @@ -1,5 +1,8 @@ ## 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. * Prefer signal-based state for local component state. * Prefer `computed` for derived state.