What this prompt does
This prompt asks the AI to build an advanced reactive-forms system in Angular [angular_version] with strict typing. It uses typed FormGroup/FormControl via a TypedFormGroup<T> interface, generates forms dynamically from a [form_schema_format] schema, and implements cross-field validation for [cross_validations]. It adds debounced async validators for [async_validations], FormArray support with add/remove for [array_fields], and a multi-step wizard with [step_count] steps validated per step.
The structure works because naive reactive forms fall apart exactly where real forms get complex — cross-field rules, dynamic arrays, wizards — and this prompt targets those failure points directly. Draft persistence saves to [storage] and restores, a custom control implements ControlValueAccessor, and an i18n-aware error component gives field-specific messages. Optimistic submission with rollback on error rounds out a system users actually notice, with full TypeScript types and validator unit tests. Generating forms dynamically from a [form_schema_format] schema is what keeps this maintainable at scale: instead of hand-coding every field and validator, you describe the form as data and let the system build the typed controls, which is the difference between a form library and a one-off page.
When to use it
- Your forms have cross-field rules like
[cross_validations]that simple validators can't express cleanly. - You generate forms from a
[form_schema_format]config rather than hardcoding every field. - You have repeating sections —
[array_fields]— needing dynamic add and remove. - You are building a
[step_count]-step wizard with validation gating each step. - You want draft persistence to
[storage]so users don't lose work. - You want strictly typed forms so refactors don't silently break field bindings.
Example output
Expect typed FormGroup/FormControl definitions with a TypedFormGroup<T> interface, a dynamic form generator reading [form_schema_format], cross-field validators for [cross_validations], debounced async validators for [async_validations], FormArray handling for [array_fields], a [step_count]-step wizard, draft persistence to [storage], a ControlValueAccessor control, an i18n error component, and validator unit tests.
Pro tips
- Pin
[angular_version]accurately; typed reactive forms and strictly typed APIs differ across versions and the generated code must match yours. - Keep
[form_schema_format]consistent with how you actually store schemas, so the generator maps cleanly to your config. - Name
[cross_validations]precisely — "start before end" and "conditional required" generate different validator shapes, and vagueness produces generic stubs. - Debounce
[async_validations]so username or email checks don't fire on every keystroke and hammer your API. - For
[storage], if drafts include sensitive fields, encrypt them rather than dropping raw values into localStorage. - Validate the wizard per step, but verify that navigating back doesn't wipe state — that is a common bug in
[step_count]-step flows. - Build the
ControlValueAccessorcontrol carefully; a half-implemented one breaks form validity andtouched/dirtystate in subtle ways that only show up under specific interaction sequences.