This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
frontendcritical PriorityID: angular-19-standalone-signals-defer-views

Angular 19 Standalone Signals, Linked Signals, and Defer View Invariants

Enforces Modern Angular 19 reactivity and lazy-loading standards by mandating signal inputs, linkedSignal for resettable derivations, and strictly partitioned @defer blocks with minimum rendering thresholds. Prohibits legacy decorator inputs, manual ngOnChanges synchronization, and untracked side-effects in computed signals.

Prohibited Anti-Pattern: Mixing Legacy ngOnChanges with Signal Inputs and Unbounded @defer Blocks Without Viewport Placeholders

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Angular 19 Standalone Signals, Linked Signals, and Defer View Invariants - Enforces Modern Angular 19 reactivity and lazy-loading standards by mandating signal inputs, linkedSignal for resettable derivations, and strictly partitioned @defer blocks with minimum rendering thresholds. Prohibits legacy decorator inputs, manual ngOnChanges synchronization, and untracked side-effects in computed signals.
globs: src/**/*.ts, src/**/*.html
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/angular-19-standalone-signals-defer-views"
---

# Angular 19 Standalone Signals, Linked Signals, and Defer View Invariants

> **Severity**: CRITICAL | **Category**: frontend
> **Anti-Pattern Warning**: Mixing Legacy ngOnChanges with Signal Inputs and Unbounded @defer Blocks Without Viewport Placeholders

## System Constraints
You are a Principal Angular Architect enforcing Angular 19 Standalone Component patterns, reactive Signal graphs, linkedSignal derivations, and @defer bundle optimization. Mandate ChangeDetectionStrategy.OnPush, immutable signal transformations, and complete placeholder-loading-error defer blocks.

## Strict Guidelines
- Components MUST ALWAYS specify `changeDetection: ChangeDetectionStrategy.OnPush` and set `standalone: true` (or rely on Angular 19 standalone defaults).
- Engineers MUST ALWAYS use `input()` and `input.required()` instead of the legacy `@Input()` decorator.
- Engineers MUST use `linkedSignal()` when internal state must derive from an input signal but remain locally mutable/resettable, avoiding manual `ngOnChanges` or `effect()` state duplication.
- Engineers MUST NOT write to any writable signals inside `computed()` expressions or invoke side effects inside computed callbacks.
- All heavy downstream component chunks MUST be wrapped in `@defer (on viewport; prefetch on idle)` and MUST explicitly define `@placeholder(minimum 300ms)` and `@loading` blocks to prevent Layout Shift (CLS).
- Engineers MUST use `output()` and `outputFromObservable()` instead of the legacy `@Output()` decorator with `EventEmitter`.

## Bad vs Good Implementations
### State Derivation: Legacy ngOnChanges vs Modern linkedSignal

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Uses legacy @Input decorators and ngOnChanges lifecycle hooks to manually synchronize state, which creates boilerplate and risks state drift in fine-grained reactive graphs.
```typescript
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';

@Component({
  selector: 'app-user-profile',
  template: `<input [(ngModel)]="selectedName" />`
})
export class UserProfileComponent implements OnChanges {
  @Input() initialName = '';
  selectedName = '';

  ngOnChanges(changes: SimpleChanges): void {
    if (changes['initialName']) {
      this.selectedName = this.initialName;
    }
  }
}
```

#### Production Standard (Correct)
> **Standard**: Adopts input.required() and linkedSignal() to automatically reset internal mutable state whenever the upstream input updates, completely removing lifecycle boilerplate.
```typescript
import { Component, ChangeDetectionStrategy, input, linkedSignal } from '@angular/core';
import { FormsModule } from '@angular/forms';

@Component({
  selector: 'app-user-profile',
  standalone: true,
  imports: [FormsModule],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `<input [ngModel]="selectedName()" (ngModelChange)="selectedName.set($event)" />`
})
export class UserProfileComponent {
  readonly initialName = input.required<string>();
  readonly selectedName = linkedSignal(() => this.initialName());
}
```

### Chunk Optimization: Plain Render vs @defer with Viewport Trigger and Thresholds

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Forces heavy dependencies into the parent bundle, worsening initial bundle size, Total Blocking Time (TBT), and First Contentful Paint (FCP).
```typescript
import { Component } from '@angular/core';
import { HeavyAnalyticsGraphComponent } from './heavy-analytics-graph.component';

@Component({
  selector: 'app-dashboard',
  standalone: true,
  imports: [HeavyAnalyticsGraphComponent],
  template: `
    <div class="container">
      <app-heavy-analytics-graph [data]="graphData()" />
    </div>
  `
})
export class DashboardComponent {
  // Heavy graph bundle is bundled into the main entry route unconditionally
}
```

#### Production Standard (Correct)
> **Standard**: Uses Angular @defer to split the heavy component into a separate lazy-chunk loaded on viewport entry, using @placeholder with minimum display times to avoid Cumulative Layout Shift (CLS).
```typescript
import { Component, ChangeDetectionStrategy, signal } from '@angular/core';
import { HeavyAnalyticsGraphComponent } from './heavy-analytics-graph.component';

@Component({
  selector: 'app-dashboard',
  standalone: true,
  imports: [HeavyAnalyticsGraphComponent],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <div class="container">
      @defer (on viewport; prefetch on idle) {
        <app-heavy-analytics-graph [data]="graphData()" />
      } @placeholder (minimum 300ms) {
        <div class="skeleton-loader" aria-busy="true">Loading visual analytics...</div>
      } @loading (after 100ms; minimum 500ms) {
        <div class="spinner">Rendering chart...</div>
      } @error {
        <p role="alert">Failed to load analytics engine.</p>
      }
    </div>
  `
})
export class DashboardComponent {
  readonly graphData = signal<number[]>([10, 20, 30]);
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Angular 19 Standalone Signals, Linked Signals, and Defer View Invariants

Angular 19 Standalone Signals, Linked Signals, and Defer View Invariants defines an industrial-grade behavioral standard for frontend engineering. Enforces Modern Angular 19 reactivity and lazy-loading standards by mandating signal inputs, linkedSignal for resettable derivations, and strictly partitioned @defer blocks with minimum rendering thresholds. Prohibits legacy decorator inputs, manual ngOnChanges synchronization, and untracked side-effects in computed signals. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Mixing Legacy ngOnChanges with Signal Inputs and Unbounded @defer Blocks Without Viewport Placeholders Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

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 ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftMixing Legacy ngOnChanges with Signal Inputs and Unbounded @defer Blocks Without Viewport PlaceholdersCritical
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 InconsistencyAI 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.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Components MUST ALWAYS specify `changeDetection

Components MUST ALWAYS specify `changeDetection: ChangeDetectionStrategy.OnPush` and set `standalone: true` (or rely on Angular 19 standalone defaults).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST ALWAYS use `input()` and `input.required()` instead of the legacy `@Input()` decorator.

Engineers MUST ALWAYS use `input()` and `input.required()` instead of the legacy `@Input()` decorator.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

Engineers MUST use `linkedSignal()` when internal state must derive from an input signal but remain locally mutable/resettable, avoiding manual `ngOnChanges` or `effect()` state duplication.

Engineers MUST use `linkedSignal()` when internal state must derive from an input signal but remain locally mutable/resettable, avoiding manual `ngOnChanges` or `effect()` state duplication.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Engineers MUST NOT write to any writable signals inside `computed()` expressions or invoke side effects inside computed callbacks.

Engineers MUST NOT write to any writable signals inside `computed()` expressions or invoke side effects inside computed callbacks.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

All heavy downstream component chunks MUST be wrapped in `@defer (on viewport

All heavy downstream component chunks MUST be wrapped in `@defer (on viewport; prefetch on idle)` and MUST explicitly define `@placeholder(minimum 300ms)` and `@loading` blocks to prevent Layout Shift (CLS).

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
6

Engineers MUST use `output()` and `outputFromObservable()` instead of the legacy `@Output()` decorator with `EventEmitter`.

Engineers MUST use `output()` and `outputFromObservable()` instead of the legacy `@Output()` decorator with `EventEmitter`.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Angular 19 Standalone Signals, Linked Signals, and Defer View Invariants critical for AI coding assistants?

Enforces Modern Angular 19 reactivity and lazy-loading standards by mandating signal inputs, linkedSignal for resettable derivations, and strictly partitioned @defer blocks with minimum rendering thresholds. Prohibits legacy decorator inputs, manual ngOnChanges synchronization, and untracked side-effects in computed signals. 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 Legacy ngOnChanges with Signal Inputs and Unbounded @defer Blocks Without Viewport Placeholders) 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.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

Related FRONTEND Rules

View all rules →
frontend
119

SolidStart 1.0 Server Functions & Async Boundaries Production Standard

SolidStart 1.0 relies on the Vinxi bundler to split `server$` closures into independent HTTP POST RPC endpoints. Direct lexical closure over client signals within `server$` scopes or failure to demarcate async boundaries with `<Suspense>` causes silent serialization failures, client-bundle secret leaks, and SSR hydration mismatches. Enforcing strict parameter passing, runtime input validation, and Solid async primitives maintains security and fine-grained reactivity across network boundaries.

frontend
119

Astro 5 Actions & Content Layer Production Standard

Enforces strict type safety and architectural correctness for Astro 5 Server Actions and the zero-waterfall Content Layer API. Prevents runtime contract mismatches, hydration mismatches, and unhandled mutation exceptions across dynamic and prerendered boundaries. Failure to follow these patterns leads to silent data fetching waterfalls, build-time cache corruptions, and unhandled server action exceptions.

frontend
51

Nuxt 4 Nitro Server Engine & Shared Directory Production Standard

Nuxt 4 enforces strict boundary segregation between client UI in the app/ directory, backend endpoints in server/, and universal contracts in shared/. Violating cross-boundary isolation or maintaining module-scoped state in Nitro server handlers causes catastrophic cross-request data corruption and hydration mismatches under concurrent production traffic. Architects must enforce request-isolated H3 event contexts, universal serialization schemas, and strict path-alias boundaries.

1 Rule in Stack

Angular