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 laborious 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.

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. 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 time consuming 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