mcpbeat Sign in

Reference Signal Forms Agent Skill

Explains the mental model and architecture of the code under `packages/forms/signals`. You MUST use this skill any time you plan to work with code in `packages/forms/signals`

1.1k tokens
context cost
SKILL.md, read when the skill is used
2
files
plus reference files
0
copies elsewhere
how many repositories repackaged it
100 701
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/angular/angular --skill reference-signal-forms

What comes with it

3 313 bytes besides the instruction
references/integration.md

The instruction itself

11 sections, as written by the author

Signal Forms Architecture

The packages/forms/signals directory contains an experimental, signal-based forms API for Angular.

This system differs significantly from the existing Reactive and Template-driven forms.

Mental Model

  • Model-Driven: The system is built around a WritableSignal<T> which serves as the single source of truth.

Unlike Reactive Forms where the FormControl holds the value, here the Signal holds the value.

The form is merely a _view_ or _projection_ of that signal, adding form-specific state (validity, dirty, touched).

  • Proxy-Based Traversal: The form API (form(signal)) returns a FieldTree. This object is a Proxy.

It allows accessing nested fields (e.g., myForm.user.name) without manually creating control groups.

Accessing a property on the proxy lazily resolves or creates the corresponding FieldNode.

  • Schema-Based Logic: Validation, disabled state, and other metadata are defined separately via Schemas.

Schemas are applied to the form structure using functions like apply, applyEach (for arrays), and applyWhen.

This separates the _structure_ of the data from the _rules_ governing it.

  • Directives as Glue: The [formField] directive binds a DOM element (native input or custom control) to a FieldNode.

It handles:

  • Syncing the value between the DOM and the Signal.
  • Reflecting state (valid, touched, etc.) to the UI.
  • Handling user interaction events (blur, input).

Key Components

1. FieldNode (src/field/node.ts)

The central internal class representing a single field in the form graph. It aggregates several state managers:

  • structure: Manages parent/child relationships and signal slicing.
  • validationState: Computes valid, invalid, errors signals.
  • nodeState: Tracks touched, dirty, pristine.
  • metadataState: Stores metadata like min, max, required.
  • submitState: Tracks submission status and server errors.

2. ValidationState (src/field/validation.ts)

Manages the complexity of validation:

  • Synchronous Errors: Derived from schema rules.
  • Asynchronous Errors: Handled via signals, including 'pending' states.
  • Tree Errors: Errors that bubble up or are targeted at specific fields.
  • Submission Errors: Server-side errors injected imperatively via submit().

3. FormField Directive (src/directive/form_field_directive.ts)

The bridge between the FieldNode and the DOM.

  • Selector: [formField]
  • It supports:
  • Native Elements: <input>, <select>, <textarea>.
  • Custom Controls: Components implementing FormUiControl or FormValueControl.
  • Legacy Interop: Components implementing ControlValueAccessor (via InteropNgControl).

4. Schema (src/api/structure.ts & src/api/rules)

Defines the behavior.

  • Created via schema(fn).
  • Applied via apply(path, schema).
  • Rules include validators (required, pattern, min, max) and state modifiers (disabled, hidden).

Data Flow

  • Read: form.field.value() reads directly from the underlying signal (projected to the specific path).
  • Write: Writing to the form (e.g., via UI) updates the underlying signal.
  • Validation: A computed effect observes the value signal and runs validators defined in the schema.

Usage Example (Conceptual)

// 1. Define Model
const user = signal({name: '', age: 0});

// 2. Define Schema
const userRules = schema((u) => {
  required(u.name);
  min(u.age, 18);
});

// 3. Create Form
const userForm = form(user, userRules); // OR apply(userForm, userRules)

// 4. Bind in Template
// <input [formField]="userForm.name">

Important Files

  • packages/forms/signals/src/api/structure.ts: Public API entry points (form, apply).
  • packages/forms/signals/src/api/control.ts: Interfaces for custom controls (FormUiControl).
  • packages/forms/signals/src/field/node.ts: The FieldNode implementation.
  • packages/forms/signals/src/directive/form_field_directive.ts: The [formField] directive.

Supplemental Information

  • Compiler & Core Integration: Details how [formField] hooks into type-checking and the runtime.

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×16

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

2.3k tokens scripts
Finishing A Development Branch
by ZhanlinCui
×9

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1.1k tokens
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

3.4k tokens scripts
Vercel React Best Practices
by ratacat
×7

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

1.3k tokens
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

1.1k tokens
Using Git Worktrees
by ZhanlinCui
×6

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1.4k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

1k tokens

How to use it

Copy the folder

Take angular/reference-signal-forms from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.