Make the agent use the existing Alert or InlineMessage, not a homemade colored banner
The PR needs a banner under a form or at the top of a settings panel. The agent adds a div with a background color, a hard-coded icon, and a sentence. Success is a green box. Error is a red box. The repo already has an A
The PR needs a banner under a form or at the top of a settings panel. The agent adds a div with a background color, a hard-coded icon, and a sentence. Success is a green box. Error is a red box. The repo already has an Alert or InlineMessage with tone tokens, a title and description slot, a dismiss control, and a documented live-region role. Nearby save and validation messages already use it.
I've started treating a homemade status banner as an incomplete message, not as a lighter alert. Putting text on a colored background is the easy part. A consistent tone, a real status or alert role, and a dismiss pattern that matches the rest of the app are why the primitive is there.
Why the homemade banner shows up
A tutorial "success box" is a div plus a utility class. The model can write that without finding components/Alert. Your primitive may be named InlineMessage, Banner, or Notice, which is easy to miss if the prompt only says "show an error."
You also skip the difference between a polite status update and an assertive alert, the icon that already maps to each tone, and the rule about not using an alert for long helper text that should stay a hint.
A simple Alert policy
- New page-level or form-level status messages use the existing Alert or InlineMessage
- Do not invent a colored div in a feature file for success, warning, or error copy
- Keep the tone on the primitive's tokens, not a one-off background
- A new tone or layout is a primitive change, with a story
If the copy is a persistent hint next to a field, that may be helper text on the existing FormField, not an Alert. If the message must interrupt, follow the primitive's assertive path instead of adding role="alert" to a random div.
What to put in the prompt
Use the existing Alert or InlineMessage for this status message.
Do not build a colored div in this file.
Keep the tone, the title and description slots, and the documented live-region role on the primitive.
If this is field-level helper text, use the existing FormField hint or error instead.
Paste one existing Alert usage. In review, search the diff for a raw backgroundColor banner, a role="alert" that is not the primitive, and a dismiss button that does not use the shared control.
Reject / send back
Reject
- A feature-level success, warning, or error banner that reimplements the Alert
- A
divwith a hard-coded green or red background and no status role - A second banner component added for one form message
- An assertive
role="alert"on a leftover helper sentence
Accept
- A message that uses the existing Alert or InlineMessage
- A primitive PR that adds a documented tone or layout and a story
- Field-level help or errors that stay on the existing FormField
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.