Architectural Invariant Design: Angular 19 Standalone Signals, LinkedSignal State Derivation, and @defer Viewport Invariants
Angular 19 Standalone Signals, LinkedSignal State Derivation, and @defer Viewport Invariants defines an industrial-grade behavioral standard for frontend engineering. Enforces strict signal-based reactivity in Angular 19, mandating signal inputs, outputs, queries, and linkedSignal for mutable derived state while eliminating ngOnChanges and untyped @defer blocks. Ensures deferred components are strictly standalone and isolated from eager injection paths to guarantee bundle boundary splitting and prevent zoneless hydration mismatches. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
Hazard Analysis: What Breaks Without This Rule
The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:
| Failure Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Mixing Zone.js ChangeDetectionStrategy.Default with ngOnChanges, untracked signal mutation in effects, and eagerly bundled non-standalone @defer viewports | Critical | Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production. Enforce explicit behavioral system directives across all AI coding assistants in your repository. |
| Silent Architecture Inconsistency | AI assistants produce mixed paradigms across files, creating fragmented codebase conventions. | Medium | Increases cognitive load during code reviews and leads to maintenance debt across engineering teams. Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS use input(), input.required(), and output() over legacy @Input() and @Output() decorators in all standalone components.
Engineers MUST ALWAYS use input(), input.required(), and output() over legacy @Input() and @Output() decorators in all standalone components.
Engineers MUST ALWAYS implement linkedSignal() when creating a local mutable signal whose value must reset or re-evaluate upon upstream signal input changes, eliminating ngOnChanges synchronization logic.
Engineers MUST ALWAYS implement linkedSignal() when creating a local mutable signal whose value must reset or re-evaluate upon upstream signal input changes, eliminating ngOnChanges synchronization logic.
Engineers MUST ALWAYS ensure any component referenced within an @defer block is Standalone (`standalone
Engineers MUST ALWAYS ensure any component referenced within an @defer block is Standalone (`standalone: true` or default in Angular 19) and has no direct eager TypeScript imports in root-level eager dependency chains.
Engineers MUST ALWAYS pair @defer blocks with explicit @placeholder and @error blocks, specifying minimum display durations (`minimum 300ms`) where skeleton layout shift could induce cumulative layout shift (CLS).
Engineers MUST ALWAYS pair @defer blocks with explicit @placeholder and @error blocks, specifying minimum display durations (`minimum 300ms`) where skeleton layout shift could induce cumulative layout shift (CLS).
Engineers MUST NOT mutate signals inside effect() blocks
Engineers MUST NOT mutate signals inside effect() blocks; effects must strictly handle side effects (e.g., DOM mutations, external logging, local storage sync) without triggering downstream signal dependency loops.
Engineers MUST NEVER use ChangeDetectionStrategy.Default in new Angular 19 codebases
Engineers MUST NEVER use ChangeDetectionStrategy.Default in new Angular 19 codebases; every component MUST configure `changeDetection: ChangeDetectionStrategy.OnPush` to guarantee zoneless execution integrity.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is Angular 19 Standalone Signals, LinkedSignal State Derivation, and @defer Viewport Invariants critical for AI coding assistants?
Enforces strict signal-based reactivity in Angular 19, mandating signal inputs, outputs, queries, and linkedSignal for mutable derived state while eliminating ngOnChanges and untyped @defer blocks. Ensures deferred components are strictly standalone and isolated from eager injection paths to guarantee bundle boundary splitting and prevent zoneless hydration mismatches. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.
Q:How does adopting this rule prevent AI hallucinations?
This rule explicitly declares what the AI must avoid (Mixing Zone.js ChangeDetectionStrategy.Default with ngOnChanges, untracked signal mutation in effects, and eagerly bundled non-standalone @defer viewports) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.
Q:Which AI coding environments are supported?
This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).
Q:Can I combine this rule with other technology stacks?
Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.