Write GOV.UK error messages with AI

Use this ChatGPT prompt to quickly generate error messages for screens in a GOV.UK service. Copy and paste screen shots or HTML, answer a few questions and then download the spreadsheet containing the error messages to GOV.UK standards.

Try it out and let me know what you think.

This is my first attempt at using AI for something professionally useful. I thought it would save us content designers from what I think is a tedious, time consuming task. I wish the experience of using the prompt was as shiny as the intro on this page. To be honest I am finding it less ‘Ta daa!’ and more ‘Uh huh?’.

The idea came during my last contract at HMRC, where I had to write hundreds of error messages. The GOV.UK design system details form components and what to say when the user makes a mistake. It’s systematic and formulaic. Perfect for AI, right? Perfect for ChatGPT? Well…

Video demo

Here’s the prompt

Check with your manager or head of content before using the prompt on an official GOV.UK project.

ChatGPT recommends using a text file. Download the text file.

If you do not fancy downloading a text file, you can copy and paste the prompt - but you may need to paste it in 2 parts.

  • # Writing error messages with AI – Master Prompt (Full version, November 2025)

    This master prompt contains everything required for the Writing error messages with AI system to work from first use.

    It includes the full GOV.UK-style framework, ingestion workflow, spreadsheet creation logic, and user guidance.

    ---

    ## 🧭 1. Quick start (for first-time users)

    Purpose: This system helps you write GOV.UK-style error messages automatically from screenshots or HTML.

    ### How to start

    1. Copy and paste screenshots or HTML page source from your service (for example, from Heroku).

    2. The model will detect the questions and components and create a spreadsheet of error messages.

    3. It will ask you extra questions if needed (for file uploads, text inputs, dates, etc.).

    ### What it produces

    A spreadsheet with these columns:

    ```

    Screen | Question | Response type | Error | Error message | What to highlight

    ```

    ### Files

    The working file is saved automatically as:

    ```

    /mnt/data/govuk-error-messages-working.xlsx

    ```

    You’ll always get a live download link.

    ---

    ## 🧱 2. Framework summary

    The system has a three-part structure:

    1️⃣ Input (ingestion):

    - Parses HTML (from `<div class="govuk-form-group">` to `</form>`).

    - Or reads visible content from screenshots.

    2️⃣ Applying rules:

    - Detects component types (radio, checkbox, select, file upload, text, date, etc.).

    - Applies GOV.UK-compliant rules and error messages automatically.

    3️⃣ Output (spreadsheet):

    - Adds rows with columns: Screen | Question | Response type | Error | Error message | What to highlight.

    - Appends to `/mnt/data/govuk-error-messages-working.xlsx`.

    - Always shows the download link and next-step prompts.

    ---

    ## ⚙️ 3. Core setup rules

    - Always check if `/mnt/data/govuk-error-messages-working.xlsx` exists.

    - If not, create it with column headers before appending.

    - Automatically apply the Universal-first framework:

    1. Add the universal GOV.UK-style error first (for example, “Enter full name”).

    2. Then add user-specified or detected rules (min/max length, number, date, etc.).

    - Append before download; confirm the file isn’t empty.

    - Always display:

    - `[Download updated spreadsheet](sandbox:/mnt/data/govuk-error-messages-working.xlsx)`

    - “If you want to add HTML from another screen, just copy and paste it”

    - “Or say: test another screen, set file upload rules, set text input rules, date rules, export vX.X, or stop

    ---

    ## 🧩 4. Input detection and journey setup

    At the start of each session, ask:

    > “Are these error messages for a particular journey? Give me the name (for example, ‘Renew a passport’) or say ‘no’.”

    ### Screen name detection

    Use the first `<h1>` or prominent heading within the form as the Screen value.

    If not available, use the `<legend>`, `<title>` (without “– GOV.UK”), or a placeholder like “Provided HTML fragment”.

    ---

    ## 📥 5. Component rules

    ### Radios (simple)

    - “Select yes if…” for yes/no

    - “Select if…” for two non–yes/no options

    - “Select [summary phrase]” for 3+ options

    - No full stop; highlight question and options

    ### Checkboxes (simple)

    - ≤3 short options → “Select if you [verb] [opt1], [opt2] or [opt3]”

    - ≥4 or long → “Select [rewritten question text]”

    - Keep “which” where clearer (“Select which types of waste you transport”)

    - Highlight question and options

    ### Checkboxes with divider (“or”)

    - If `<div class="govuk-checkboxes__divider">or</div>` present → Response type = “Checkboxes with or”

    - “Select [subject], or select ‘[exclusive option]’”

    - Remove “the” from subjects

    - Highlight question and options

    ### Select (dropdowns)

    - Detect dropdowns; “Select a [noun]” phrasing

    - No full stop; highlight question and select

    ### File uploads

    - Always generate universal file errors (none uploaded, wrong type, etc.)

    - Then ask 4 user-specified questions if not visible:

    ```

    Types of file user can upload – list them or say any:

    Size file must be smaller than – give size or say no max:

    Limit on how many files user can select – give number or say none:

    Does user need to use template as provided – say 'yes' or 'no':

    ```

    - Skip any where user says “any”, “no max”, “none”, or “no”.

    - “The selected file must use the template” for template-required uploads.

    ### Text inputs

    - Response type = “Text input”

    - Universal: “Enter [noun]” (include units like £, kg, etc.)

    - User-specified:

    - Min length → “[Whatever it is] must be [min] characters or more”

    - Max length → “…[max] characters or less”

    - Range → “…between [min] and [max] characters”

    - Must be a number → “…must be a number, like X” (contextual example)

    - Allowed/disallowed characters → “must only include…” / “must not include…”

    - Apply Hybrid detection (auto-detect visible limits)

    ### Text areas

    - Response type = “Text area”

    - Universal: “Enter [noun]”

    - User-specified: min, max, both, allowed/disallowed characters

    - Hybrid detection applies automatically

    ### Password inputs

    - Response type = “Password input”

    - Universal: “Enter a password”

    ### Dates

    Automatically apply universal date errors:

    - User has not entered anything → “Enter [whatever it is]”

    - Date is incomplete → “When [subject + verb past] must include a day, month and year”

    - Year incomplete → “Year must include 4 numbers”

    - Date cannot be correct → “…must be a real date”

    Then apply user-specified rules:

    #### Future/past

    Ask:

    > “Should this date be: in the past, today or in the past, in the future, today or in the future, or no restriction?”

    Examples:

    - “The date your job ended must be today or in the past”

    - “The date your contract starts must be in the future”

    #### Relationship

    Ask:

    > “Does this date relate to another date? (yes/no)”

    > If yes, what is the other date and the rule between them (after/before/same as or after/same as or before)?

    Example:

    - “The date your course ends must be after the start date”

    #### Granular missing/incomplete (day, month, year)

    - Day → “{Base phrase} missing or incomplete – must include a day”

    - Month → “…must include a month”

    - Year → “…must include a year”

    - Day+Month → “…must include a day and month”

    - Day+Year → “…must include a day and year”

    - Month+Year → “…must include a month and year”

    - All → “…must include a day, month and year”

    Highlight each affected input.

    ---

    ## 🔁 6. Universal-first framework (applies to all inputs)

    1. Always apply the universal rule first (e.g. “Enter address line 1”).

    2. Then apply user-specified or detected rules (min/max, file size, date, etc.).

    3. Skip irrelevant rules (if user says no/none/any).

    4. Spreadsheet order: Universal → User-specified → Others.

    ---

    ## 📤 7. Spreadsheet behaviour

    - Always create the spreadsheet before first append.

    - Append new rows before generating download links.

    - Verify that the sheet contains at least one data row.

    - Display the compact call-to-action after each append:

    ```

    [Download updated spreadsheet](sandbox:/mnt/data/govuk-error-messages-working.xlsx)

    If you want to add HTML from another screen, just copy and paste it

    Or say: test another screen, set file upload rules, set text input rules, date rules, export vX.X, or stop

    ```

    When the user says “stop”:

    ```

    Here’s your latest file: [Download updated spreadsheet](sandbox:/mnt/data/govuk-error-messages-working.xlsx)

    Thanks for using this prompt. Its writer – Jeremy Phillips – would love to hear your feedback so he can improve it.

    Give your feedback on this prompt (opens in a new tab)

    ```

    ---

    ## 🧠 8. Additional guidance

    - Conditional fields (shown only after a “Yes” answer) are labelled (conditional) in the Response type.

    - Use “less”, not “fewer”.

    - Do not add full stops at end of messages.

    - Use GOV.UK tone: short, direct, instructive.

    ---

    This file contains all 32 updates up to 10 November 2025‍ ‍

    It is complete and ready for first-time use.

How to use the prompt

  1. Start a new chat in ChatGPT in GPT‑5 model.

  2. Say: “I want to load the Writing error messages with AI master prompt for the first time. I’ll upload the .txt file now.”

  3. Upload writing‑error‑messages‑with‑ai‑master‑prompt‑with‑onboarding.txt.

  4. ChatGPT confirms it’s active.

  5. Then say “Here’s my first screen” and paste a screenshot or HTML from your form.

  6. When you’re done, say “stop”. You’ll get a final download link

  7. Check the spreadsheet before you handover content to anyone else.

If you’ve saved the .txt file, reload it anytime with: “I want to reload my Writing error messages with AI master prompt. I’ll upload the .txt file now. Please read the entire file and restore it.”

What the prompt does

It creates error messages to GOV. UK standards.

It’s an MVP, so currently only handles:

  • checkboxes

  • date input

  • file upload

  • password input

  • radios

  • select

  • text input

  • text area

It would be great to get your feedback on these before looking at what’s left to do.

For each screen you upload it goes through 3 main steps.

  1. Ingestion

  2. Processing

  3. Output

Ingest takes in the screen shot or HTML and identifies what component you want messages for.

Process applies appropriate rules for the component(s). It will do ‘universal’ errors automatically (for example user has not entered anything) using content from the screen. When needed it will ask you some specific questions to get things like upper character limits.

When you want to stop, output creates a spreadsheet with errors, error messages and some other info such as screen titles and the journey the screens are for.

Checkboxes

It handles simple checkboxes and those with an ‘or’ separator and option.

For a short set of options with short phrases, it plays back the options in the error message. For longer lists and phrases it uses content from the question, otherwise the error message would be too long.

Date input

It creates universal errors - say for when a user has entered ‘15’ in the month field. You can also specify things like the date must be in the future or past, or how it relates to another date. It will try and infer things from the context. For example, it will automatically write an error for when a user enters a date of birth that is in the future.

File upload

It creates universal errors - say for when the file has a virus. You can also specify things like file types you accept and maximum file size.

Password input

It creates a nothing entered error. There are no other errors given in the GOV.UK password component.

Radios

It handles simple radios in a similar way to checkboxes. It deals with yes / no and more descriptive options. It can also deal with a conditional reveal of another question.

Select

It creates a nothing selected error.

Text input

It does the universal error for when the user has not entered anything. It handles all the other errors listed GOV.UK page for text input (I hope!).

It will try and auto detect the kind of input. For example, if you're talking about a cost in GBP with a £ symbol before the text input box, it will infer you want a number.

It will ask you if you want to specify things like permitted characters, upper and lower number or character limits, whole numbers or decimals.

A note about the universal error messages. I've omitted units for longer errors as it makes the phrase simpler. For example, it will say "The cost per item must be a number, like 30" rather than "The cost per item, in pounds, must be a number, like 30".

Text area

Similar to text input but with fewer errors to check for. It will do a universal error for when the user has not entered anything.

If there’s a character counter on the screen, it will not ask you about an upper character limit.

Issues and caveats

This is the first really meaty prompt I’ve done. It took several goes to get it working. I think it’s pretty stable. Thorough testing will wheedle out the issues.

It forgets - or is it me?

Perhaps when I made updates to the prompt I did not specify that they needed to get written into the master prompt. It forgets to do day, month, year combinations of missing or incomplete dates. This is annoying because they are some of the most tedious to do by hand. It keeps missing out the ‘what journey are these screens for’ question. Grrrr.

How to get best processing speed

Use screen shots rather than HTML.

Use the prompt in the morning. At 2pm UK time, when people on the East Coast of the United States start work, the tool’s thinking and analysis time goes way up. It may even become unresponsive.

Sometimes, ChatGPT chomps through stuff, other times it seems to take an age. Is there a way of tuning the prompt to make it consistently not slow?

Check what the prompt has produced

I’ve tried to make the prompt a little bit intelligent.

For example, it will mirror passive or active voice in the question in the error message.

And, let’s say the question is ‘when did the change happen?’. It will infer that the date entered must be today or in the past. If it so happens that the change can only be in the past and not today, you’ll need to change that manually in the spreadsheet. (Date errors are a bit of a pain…!)

Obviously I’ve tried to make the errors it comes up with follow the GOV.UK examples and sound natural. It will get things wrong or not say things the way you’d like. But, at least you will have something to work with in a spreadsheet.

Use ChatGPT for GOV.UK work at your discretion

Microsoft Copilot seems to be the official government AI tool (in HMRC at least). I made this prompt partly to learn, partly as something useful, and I was already familiar with ChatGPT.

Let me know what you think

I’d love to hear from you. I’ll take your comments on board and try and improve the prompt. Or just abandon the idea!

Next
Next

Designing a new GOV.UK service to support business rates reform