refactor(rules): keep Angular index focused
This commit is contained in:
1 parent
5c25b4fe5a
commit
c91505a568
2 files changed
+15
-36
No files matched your search
@@ -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` |
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user