agentleFS
L-X-TL-X-T/ng-agentic-skills/.agents/skills/ng-forms/SKILL.md

ng-forms

Skill13 starsChanged 43 days agoMITView on GitHub

Build signal-based forms in Angular v22+ using the Signal Forms API (public API since v22, imported from @angular/forms/signals). Use for form creation with automatic two-way binding, schema-based validation, field state management, and dynamic forms. Triggers on form implementation, adding validation, creating multi-step forms, or building forms with conditional fields. Don't use for template-driven forms without signals or third-party form libraries like Formly or ngx-formly.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run from the repo root and confirm no errors:

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Angular Signal Forms

Build type-safe, reactive forms with Angular's Signal Forms API: a signal model is the single source of truth, the form structure is derived from it, and a schema function declares validation and field state. Signal Forms are public API in Angular v22 (imported from @angular/forms/signals).

For exhaustive API depth, read the angular-developer skill's canonical reference at ../angular-developer/references/signal-forms.md (vendored from Angular's official skill and corrected locally to the stable v22 API – see the local adaptations in 02-SKILLS.md before re-syncing it). The references below are the project-shaped fast path.

End-to-end example

import { Component, inject, signal } from '@angular/core';
import { form, FormField, required, email, submit } from '@angular/forms/signals';

@Component({
  selector: 'app-login',
  imports: [FormField],
  template: `
    <form (submit)="onSubmit($event)">
      <input type="email" [formField]="loginForm.email" />
      @if (loginForm.email().touched() && loginForm.email().invalid()) {
        <p class="error">{{ loginForm.email().errors()[0].message }}</p>
      }
      <input type="password" [formField]="loginForm.password" />
      <button [disabled]="loginForm().invalid()">Login</button>
    </form>
  `,
})
export class Login {
  private readonly auth = inject(AuthService);

  // Model signal is the single source of truth.
  protected readonly loginModel = signal({ email: '', password: '' });

  protected readonly loginForm = form(this.loginModel, (path) => {
    required(path.email, { message: 'Email is required' });
    email(path.email, { message: 'Enter a valid email address' });
    required(path.password, { message: 'Password is required' });
  });

  onSubmit(event: Event) {
    event.preventDefault();
    // submit() marks all fields touched, then runs the async action only if valid.
    submit(this.loginForm, async () => {
      await this.auth.login(this.loginModel());
    });
  }
}

Critical rules

RuleCorrect
Call the field to reach its state signals.form.field().valid(), not form.field.valid()
The model is the source of truth – never .set() the field tree; update the model signal.this.model.update(...), not form.field.set(...)
Forbidden [formField] attributes – these are handled by the directive or by schema rules.Never set value/min/max/[disabled]/[readonly]
submit() callback must be async and return a Promise.submit(form, async () => { ... })
Schema paths are not signals – don't call them; read other fields via context helpers.valueOf(path.x) / stateOf(path.x), not path.x()
Every component runs on the default OnPush + zoneless (v22+).Do not set changeDetection; never opt into Eager

Which reference to load

TaskReference
Set up a form, read/update model values, display errors, style, resetreferences/build-a-form.md
Read field-level or form-level state (valid, touched, dirty, pending…)references/field-state.md
Add validation (built-in, debounce, conditional, custom, cross-field, async)references/validation.md
Conditional fields, submission, arrays / dynamic fieldsreferences/dynamic-forms.md
Build a custom form control (FormValueControl)references/custom-controls.md
Maintain or migrate an existing Reactive Forms areareferences/reactive-forms.md
Full API surface, common pitfalls, build-error recovery../angular-developer/references/signal-forms.md

Verify – zero errors before done

Run from the repo root and confirm no errors:

  • pnpm exec tsc --noEmit (or pnpm build)
  • pnpm lint

There is no nx here – do not run nx lint.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.