Imagine a design system with three alert variants: caution, warning, and critical. All three have examples in the library. A designer who has been there for years knows which one to use when a form fails to save. A new teammate reads the names, compares the examples, and asks around. An AI coding tool can pick a plausible color and keep building. The screen can look right and still invite someone to continue after their changes failed to save.
AI makes that ambiguity expensive because a single unstated rule can turn into several implementations. Each team then has to resolve the severity, message, and recovery action again in review. Start with the choice that keeps getting made by feel. Write down the product condition, the response a person needs, and where the rule should live.
Define Alert Variants by What Happened
Take a form where someone has unsaved edits. The same person can face two different situations minutes apart. They might be about to discard their edits, or the system might already have failed to save them. The distinction changes what the product should ask them to do.
- Warning fits a preventable loss before someone commits. If leaving the form would discard edits, explain what will be lost and offer a way to stay.
- Critical fits an active failure that blocks completion. If a save has already failed, say the edits haven’t been saved, keep them available when possible, and offer a retry or a clear recovery path.
- Caution needs a condition and action of its own. If the audit finds that it covers the same situations as warning, migrate those uses to warning and retire the duplicate.
These are example rules for one product. Review the existing alerts before adopting them. If two states require different recovery actions, keyboard behavior, or announcements, keep the distinction explicit even when their visual treatments are similar.
Put the Rule Where People and Tools Use It
A designer should be able to see the difference in the component library. An engineer should find the same rule in the component’s usage guidance, with examples of both the discard decision and the failed save. The component can require the right inputs, such as a recovery action for a blocking failure. Product code still needs to identify which state occurred and preserve the edits when it can.
Check that design and code expose the same supported choices. Give the duplicate variant a migration path: document its replacement, update real usages, and remove the old choice once those usages have moved. The examples should describe the expected behavior as well as the appearance, including how a failed save is announced and how a person can recover. Generative UI Still Needs a Design System
Give a New Teammate and the AI Tool the Same Case
Try two short prompts using only the approved design and code guidance. Leave the variant names out of the scenarios.
Before saving: Someone wants to leave a form with unsaved edits. If they leave now, those edits will be lost.
After a failed save: Someone pressed Save. The request failed, and the edits are still open in the form.
Ask someone unfamiliar with the library to choose a variant and point to the rule. Give the AI tool the same guidance and scenarios. Inspect what it builds: the variant selected, the message, the action offered, and what happens to the edits. In the second case, the screen should make the failed save clear and give the person a way to recover.
If both consumers hesitate, revise the rule or remove the overlap. If the person can find the rule and the tool keeps choosing the wrong variant, check which guidance and code examples the tool actually received. Save the two cases so you can rerun them after a change to the system. AI-Generated Tests Need to Earn Your Confidence
Start With the Choice Your Team Keeps Debating
Pick one component decision that regularly interrupts a review. Find two real examples, write the condition and the action for each, and align them in design and code. Then ask someone who wasn’t in that discussion to make the choice. When they can explain it from the system itself, the rule can travel with the component.