---
name: html-form-analyzer
description: "A structured audit of an existing HTML form: every field catalogued with its type and constraints, an accessibility checklist against WCAG, the validation that is and is not enforced on client and server, and prioritised fixes. Use when an existing HTML form needs a structured audit of its fields, accessibility, and validation coverage before a redesign or compliance review. Do not use for fixing a form that will not submit, writing reference docs for a form, or generating a new one. Related topics: coding, html."
---

# HTML Form Analyzer

A structured audit of an existing HTML form: every field catalogued with its type and constraints, an accessibility checklist against WCAG, the validation that is and is not enforced on client and server, and prioritised fixes.

## When to use

Use this skill when an existing HTML form needs a structured audit of its fields, accessibility, and validation coverage before a redesign or compliance review. Do not use it for fixing a form that will not submit, writing reference docs for a form, or generating a new one.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Catalogue every control with name, type, required flag, default, and constraint attributes in a table.
3. Audit accessibility at the selected depth: labels, grouping, error linkage, focus order, button semantics, and non-colour error cues.
4. Separate validation into browser-enforced, script-enforced, and server-required checks, when the validation summary is on.
5. List each script listener with its event and whether it can block native validation, when scripts are highlighted.
6. Rank the recommendations by user impact and give the exact markup change for each.

## Inputs

- **HTML markup** (longer free text)
- **Form purpose** (free text, e.g. "user registration")
- **Target browsers** (choose any: Chrome, Firefox, Safari, Edge, Mobile Safari, Mobile Chrome)
- **Accessibility focus** (choose one: Basic, Moderate, Full WCAG 2.2 AA)
- **Include validation summary** (choose one: Yes, No)
- **Highlight custom scripts** (choose one: Yes, No)

## Output

A markdown report with sections Overview, Fields table, Accessibility checklist (pass or fail per item), Validation notes, and Recommendations ranked with code snippets.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### HTML Form Analyzer

Audit my form's markup for structure, validation, and accessibility.

#### Details
- HTML markup: {{HTML markup}}
- Form purpose: {{Form purpose}}
- Target browsers: {{Target browsers}}
- Accessibility focus: {{Accessibility focus}}
- Include validation summary: {{Include validation summary}}
- Highlight custom scripts: {{Highlight custom scripts}}

Catalogue the fields first: for each control record its name, type, whether it is required, its default, and any constraint attributes (pattern, min, max, maxlength, autocomplete). Then audit accessibility at the depth selected: every control has a programmatically associated label, groups use fieldset and legend, error messages are linked by aria-describedby and announced, focus order follows the visual order, the submit control is a real button, and colour is never the only error signal. For the validation summary, state what the browser enforces from attributes, what the script enforces, and what the server must still check because client validation can be bypassed. When scripts are highlighted, list each listener with the event it handles and whether it could block native validation or submission. Note browser-specific behaviour only for the targets selected, such as date inputs on Safari. Rank recommendations by user impact, with the markup change for each.

## Pitfalls

- Counting a placeholder as a label, which disappears on input and is not read as a name by screen readers.
- Treating client-side validation as sufficient, so the server trusts input that any user can bypass.
- Auditing against desktop Chrome only when the selected targets include mobile Safari, where date and number inputs behave differently.
