---
name: html-form-generator
description: "A complete, accessible HTML form ready to drop into a page: correctly named fields, labels and fieldsets, native validation attributes, autocomplete hints, a working submit, and optional minimal CSS. Use when a page needs a new HTML form scaffolded with the right input types, labels, validation attributes, and a working submit, optionally styled. Do not use for documenting, auditing, or debugging a form that already exists, or building the server endpoint. Related topics: coding, html."
---

# HTML Form Generator

A complete, accessible HTML form ready to drop into a page: correctly named fields, labels and fieldsets, native validation attributes, autocomplete hints, a working submit, and optional minimal CSS.

## When to use

Use this skill when a page needs a new HTML form scaffolded with the right input types, labels, validation attributes, and a working submit, optionally styled. Do not use it for documenting, auditing, or debugging a form that already exists, or building the server endpoint.

## 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. Map each requested field to the most specific input type and give it a server-readable name and an autocomplete token.
3. Wrap every control in a label, group radios and checkboxes in a fieldset with a legend, and mark required fields visibly and with the attribute.
4. Add constraint attributes from the field notes, a real submit button, the right enctype for file fields, and a honeypot for POST forms.
5. Add the custom validity script or the minimal style block only when the matching option is selected.
6. Return the form in one html block with a comment on each line the user must edit before deploying.

## Inputs

- **Form title** (free text, e.g. "Contact Us")
- **Action URL** (free text, e.g. "/submit-contact")
- **Method** (choose one: GET, POST)
- **Fields needed** (longer free text)
- **Control types to use** (choose any: Text input, Email input, Number input, Textarea, Checkbox, Radio button, Select dropdown, Date input, File upload)
- **Validation** (choose one: Native HTML attributes only, Native plus a small script for custom messages, None)
- **Include basic CSS styling** (choose one: Yes, No)
- **Submit button label** (free text, e.g. "Send Message")

## Output

One fenced html block containing the optional style block, the complete form, and the optional script, with comments marking the lines to customise.

## Prompt template

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

### HTML Form Generator

Generate a form I can paste into a page and submit as is.

#### Details
- Form title: {{Form title}}
- Action URL: {{Action URL}}
- Method: {{Method}}
- Fields needed: {{Fields needed}}
- Control types to use: {{Control types to use}}
- Validation: {{Validation}}
- Include basic CSS styling: {{Include basic CSS styling}}
- Submit button label: {{Submit button label}}

Pick the most specific input type for each field (email, tel, url, number, date) so mobile keyboards and native validation do the work, and give every field a name the server can read and an autocomplete token where one exists. Wrap each control in an explicit label, group radios and checkboxes in a fieldset with a legend, mark required fields with the attribute and a visible indicator, and add maxlength, min, max, or pattern from the field notes. Use a real submit button, set enctype to multipart/form-data when a file field is present, and add a honeypot field for spam when the method is POST. When the script option is selected, add a short unobtrusive script that sets custom validity messages and nothing else. When CSS is on, put a minimal style block above the form that handles layout, focus, and error states only. Return the markup in one fenced html block with a comment above any line the user must change, such as the action URL.

## Pitfalls

- Using a div with a click handler as the submit control, which breaks Enter-to-submit and keyboard users.
- Leaving the name attribute off a field, so it renders perfectly and never reaches the server.
- Forgetting enctype multipart/form-data on a form with a file input, which submits the filename and not the file.
