Articles
ArticleBy Piotr MyszkiewiczPublished: Nov 01, 202610 min read
Includes a free template · Jump to download ↓

How to Keep AI-Generated UI Consistent: A Practical Design System for Coding Agents

The new page works. The form submits. The typography looks deliberate. Yet put it next to the rest of the product and it feels as if it belongs to another website.

That was our problem with the sAIgnals newsletter page. The first version used the site's dark colors and fonts, but its oversized hero, generous spacing, and separate benefit cards gave it a different rhythm from News and Articles. Asking for a more polished page had produced a locally plausible result. It had not made the product more coherent.

This guide shows the correction we made on November 1, 2026: identify the existing patterns, record them in a small design document, connect that document to repository instructions, and verify the result in a browser. It is a case study of one interface change, not a model comparison or evidence that the redesign increased signups.

A reusable design-system document and UI review checklist are available at the end. The workflow is intended for coding agents working in an existing repository, regardless of which assistant you use.

Start with the neighboring pages

Before asking an agent to implement a screen, choose two or three existing views that represent the product well. Name their source files and inspect their rendered output. A component can contain the right class names while still producing an awkward layout at a particular width.

For sAIgnals, the useful references were the News and Articles pages, the shared navigation, and the global stylesheet. They established a compact page heading, restrained surfaces, thin borders, technical labels, and content arranged in rows or purposeful panels.

The newsletter already shared the palette. The mismatch was in hierarchy and composition: a headline up to 54 pixels, a padded promotional hero, and repeated explanations spread over several sections. A different accent color would not have solved that.

The earlier sAIgnals newsletter page has a large promotional heading and a separate preview panel below the signup hero
Before: the newsletter used the site's palette, but its large hero and separate preview created a different rhythm. Screenshot: sAIgnals, November 1, 2026.

Give the agent a bounded investigation before the edit:

Inspect the target page and two representative neighboring pages.
Read the shared stylesheet and the components those views use.

List:
- existing tokens and reusable components;
- differences in hierarchy, spacing, and interaction;
- the smallest changes that would make this page fit.

Cite the relevant files and selectors. Treat existing accessibility
problems as defects to fix, not patterns to copy.

This produces an implementation brief grounded in the repository. For a broader approach to choosing task context, see our context engineering guide.

Give code, design rules, and task instructions different jobs

A design document is most useful when it explains decisions the stylesheet cannot express on its own.

LocationWhat belongs thereExample
Styles and componentsValues and executable behaviorSurface tokens, heading classes, form states
Design documentMeaning and usage rulesWhen to use a panel, how ordinary pages begin
Repository instructionsA short pointer and working expectationsRead the design document before UI changes
Task briefThe specific change and its acceptance criteriaRestyle the newsletter while preserving signup behavior

Our document lives at docs/design-system.md. The exact filename is a project convention; creating a file with that name does not automatically make every assistant read it. Put an explicit pointer in the instruction mechanism your environment uses, and verify that the agent actually inspected it.

In our repository we added this rule to AGENTS.md:

For website UI changes, read and follow docs/design-system.md.
Reuse existing style tokens and shared page patterns. Update the
document when intentionally changing a shared design rule, and
verify both desktop and mobile layouts.

Keep the pointer short. Repeating the whole document in several instruction files creates more places for rules to diverge. Tools have their own loading and scoping rules; for example, Claude Code documents how project instructions and imports are loaded . Check your environment instead of assuming one filename behaves identically everywhere. Our repository-instructions guide covers that distinction in more detail.

Write rules that resolve real choices

“Make it modern and consistent” leaves almost every implementation decision open. A useful rule identifies a choice and gives the agent a way to settle it.

For this site, the document records:

  • Page hierarchy: ordinary views start with the existing .view-heading pattern. A large hero needs a reason tied to the page's role.
  • Surfaces: reuse the dark panel and border tokens. Keep corners square by default; avoid adding a new glow or shadow system for one view.
  • Typography: use the existing sans-serif family for reading and monospace for short labels, metadata, and technical markers.
  • Composition: use separated rows for a sequence of content; use a panel to group a distinct task or object.
  • Interactions: preserve visible labels, keyboard focus, native input behavior, and loading, success, and error messages.
  • Responsive behavior: account for the sidebar's width and test real content before deciding where columns collapse.

These are sAIgnals decisions, not universal rules for good design. A consumer storefront or a playful game may need a different visual language. Extract the rules from the product you are extending.

Keep token values authoritative in code

The design document can explain that cyan means a primary action or active choice. The stylesheet should remain the source of the actual color value. CSS custom properties let declarations refer to shared values with var(); they do not decide when a color is appropriate.

For example, these are existing sAIgnals values:

:root {
  --panel: #10141b;
  --line-strong: #394252;
  --text: #edf2f7;
  --muted: #9aa7b7;
  --cyan: #67e8f9;
}

Do not paste a second, slightly different palette into a page component. If a document includes a token table for readability, update it when the underlying tokens intentionally change. A reference to a source file is easier to maintain than a duplicated catalog of every CSS declaration.

A four-step diagram connects inspecting existing screens, recording design rules, implementing a bounded change, and checking the browser result
The document connects existing product decisions to implementation and review. It does not replace reusable components or browser checks. Diagram: sAIgnals.

The newsletter change: what we actually did

We replaced the promotional hero with the same page-heading pattern used by ordinary content views. The signup and preview now sit beside each other on a wide screen, with a single-column layout when space is limited.

The signup panel groups one task: choose a frequency, enter an address, and request the briefing. Its monthly and weekly options retain native radio inputs, with a more visible selected state. The form still defaults to monthly.

The preview is a numbered sequence: changes worth knowing, one workflow to try, and one repository to explore. Each row has a relevant link. Delivery and subscription-control details sit in a compact footer instead of another set of benefit cards.

The functional component was reused. This edit changed the page composition and styles; it did not replace the subscription endpoint, confirmation flow, or analytics events. Page-specific form styles were scoped under .newsletter-page, so the homepage signup did not inherit the larger frequency controls.

The revised sAIgnals newsletter uses a compact page heading, a signup panel on the left, and three numbered preview rows on the right
After: a shared heading, one signup task, and a compact preview align the newsletter with other content views. Screenshot: sAIgnals, November 1, 2026.

Both screenshots show a 1280-pixel viewport width; the before image is a shorter capture. The improvement is visible in the shared hierarchy and patterns. It is not a conversion result. To assess signups, we would need a defined observation period, comparable traffic, and confirmed-subscription data. A small before-and-after comparison alone would not establish that the design caused a change in conversion.

Turn the rules into a bounded implementation request

After agreeing on the direction, give the agent a concrete target and the evidence you expect back:

Update the newsletter page to follow docs/design-system.md.
First read that file, the shared styles, and the Articles/News headers.

Reuse the shared page heading and existing signup component.
Group signup as one task and preview content as numbered rows.
Preserve submission, validation, confirmation, and analytics behavior.
Scope page-specific styles so other signup placements are unaffected.

Check wide and narrow layouts, including 320 px. Verify the frequency
choice with keyboard input and inspect visible focus and form labels.
Run the relevant existing tests and the build.

Report changed files, verified states, and checks not performed.
Do not claim improved conversion or full accessibility compliance
from screenshots or passing tests.

This prompt gives the agent room to solve layout details while keeping product behavior and review evidence explicit. Add the real constraints of your project: localized strings, a supported browser matrix, a component library, or a screenshot comparison process. Leave out requirements that do not apply.

Verify appearance and behavior separately

For our newsletter change, we checked desktop at 1280 pixels and narrow layouts at 390 and 320 pixels. At the two narrow widths, the document did not overflow horizontally. We switched frequency with the keyboard, checked that the selected option and consent text changed together, ran the build, and passed 30 existing newsletter tests.

Those checks have limits. The newsletter tests cover existing backend behavior; they do not prove the new layout is accessible. A screenshot does not establish screen-reader usability or contrast compliance. We did not perform a complete accessibility audit or a conversion experiment for this change.

For your own UI review, include:

  • Layout: compare against the reference pages; inspect long labels, real content, zoom, and narrow screens.
  • Keyboard: follow the focus order, operate controls, and confirm that focus stays visible.
  • States: inspect loading, success, failure, and validation states using controlled fixtures or a test environment.
  • Contrast: measure foreground/background pairs instead of trusting a token name. WCAG's text-contrast guidance specifies 4.5:1 for ordinary text and 3:1 for large text, with defined exceptions.
  • Targets: use comfortable control sizes. Our document sets a local 44-pixel height target for primary buttons and fields. That is a project convention, not a statement that WCAG 2.2 AA universally requires 44 pixels: its minimum target-size criterion uses 24 by 24 CSS pixels with exceptions, including spacing and inline targets.
  • Regression: check shared placements, preserved behavior, and relevant tests before deployment.

When a shared style changes, inspect another consumer of that style. When the change is page-specific, keep the selector local. This reduces the chance that polishing one form changes another form elsewhere in the product.

Keep the document small enough to use

A design document should evolve with reviewed product decisions. Update it when the team intentionally changes a shared rule. Do not add every one-off exception as a permanent instruction for future screens.

If the document and a component disagree, investigate which reflects the current decision. Then fix the stale reference or the implementation. Silently following whichever file was read last makes drift harder to see.

You do not need to build a component library before improving one page. Start with the tokens and patterns already present. Extract a shared component when repeated implementations make that useful; a document should not become an excuse for a speculative refactor.

Take the workflow into your repository

Download the starter below, replace its placeholders with real files and decisions, and apply it to one page that currently feels out of place. The file includes a document skeleton, an instruction-file pointer, and a review checklist. Keep that first change small enough to compare with neighboring views.

The goal is a repeatable review: an agent can explain which existing rules it followed, a reviewer can inspect the result, and the next page can reuse the same decisions.

Put this guide to work · free Markdown resource

Give your agent a design reference

A design-system starter, an instruction-file pointer, and a UI review checklist. Replace the placeholders with real project files and decisions.

Download Markdown

No email required. Adapt the template to your project.

Preview the template
# [Product name] — design rules

Replace every bracketed placeholder before using this file. Keep the document
in your repository (for example, docs/design-system.md). The filename itself
does not automatically load these rules into an assistant.

## Product and reference views

- Audience and primary task: [who uses this product, to do what]
- Visual character: [three concrete qualities already present in the product]
- Reference pages: [two or three routes and their component files]
- Authoritative tokens: [stylesheet, theme, or token file]
- Reusable components: [actual header, button, field, list, and panel components]

## Color and surfaces

Use existing semantic tokens. Record their roles here; keep actual values in
code. If you include a value table, update it when the tokens change.

- Main surface: [token and intended use]
- Raised surface: [token and intended use]
- Main/supporting text: [tokens; verify contrast on the actual background]
- Accent/selection/focus: [tokens and intended use]
- Success/warning/error: [tokens plus a textual or shape-based signal]
- Borders, radii, shadows: [existing conventions and justified exceptions]

Do not create a page-local palette unless the design explicitly calls for one.

## Typography and hierarchy

- Reading family: [existing font stack]
- Metadata family: [existing font stack, if different]
- Ordinary page header: [component or selector]
- Heading/body/metadata scale: [existing sizes and line heights]
- Uppercase/letter spacing: [where already used]
- Heading structure: one descriptive h1 and meaningful section levels.

## Layout and spacing

- Shared container and navigation: [files/components]
- Page/panel/row spacing: [existing scale or tokens]
- Use a panel for: [a distinct task or object]
- Use rows for: [repeated or sequential content]
- Column collapse: [based on content and available width, including navigation]
- Long content: [wrapping and truncation rules, with access to full values]

## Interactions and states

Reuse existing components. Keep links for navigation and buttons for actions.
Preserve visible labels, native input behavior, keyboard focus, and form status
announcements. Do not make a static panel look clickable.

Define loading, empty, success, validation, and error states where applicable.
Document the product's target-size convention and test actual controls.
Respect reduced-motion preferences; information must not depend on animation.

## Content and visuals

- Interface language and tone: [actual product conventions]
- Example content: clearly label previews and illustrative data.
- Claims: do not invent user counts, performance gains, or conversion results.
- Images: explain the specific content, with appropriate alternatives/captions.

## Verification

- Compare with the named reference pages.
- Inspect wide and narrow layouts, including 320 px where supported.
- Check long content and text zoom; record horizontal overflow if present.
- Operate relevant controls using the keyboard; inspect focus and labels.
- Inspect relevant loading, validation, success, and failure states.
- Measure contrast against the actual background; do not infer compliance
  from a token name or a screenshot.
- Check other consumers when shared CSS/components change.
- Run [verified existing test/build commands].
- Report what was checked and what remains unverified.

## Maintenance

Update this document when a reviewed shared design decision changes. Resolve
conflicts with implementation explicitly; do not silently follow the last-read
file. Avoid turning every local exception into a permanent global rule.

---

# Suggested instruction-file pointer

Put a short rule in the instruction mechanism your assistant actually reads:

> For UI work, read docs/design-system.md and the named reference components
> before editing. Reuse existing tokens and patterns. Preserve behavior unless
> the task explicitly changes it. Verify the rendered result on wide and narrow
> screens. Update the design document when intentionally changing a shared rule.

# Per-change review checklist

- [ ] The page follows the product's existing hierarchy and spacing.
- [ ] New styles reuse tokens and are scoped appropriately.
- [ ] The diff is limited to the requested change and its necessary cleanup.
- [ ] Form behavior, accessibility semantics, and analytics remain intact.
- [ ] Keyboard navigation, focus, labels, and relevant states were inspected.
- [ ] No unexplained overflow, clipped content, or overlapping controls.
- [ ] Other consumers of changed shared styles were inspected.
- [ ] Relevant tests/build passed, or failures are explicitly reported.
- [ ] Screenshots record the route and viewport dimensions.
- [ ] Any claimed improvement has evidence; visual consistency is not proof
      of higher conversion or full accessibility compliance.

Your next step

Keep building with Claude Code

Explore Claude Code updates and practical guides in one place.

Explore Claude Code →

Keep up at your pace

Get useful changes, a workflow to try, and a repository to explore. Choose a weekly or monthly briefing.

Preview the briefing and subscribe →

Frequently asked questions

Will a design-system.md file automatically make an agent follow my design?

No. The filename is a project convention. Point to it from your environment’s repository instructions or task brief, verify that the agent reads it, and review the rendered result.

Should design rules live in AGENTS.md or in a separate document?

Keep a short pointer and working expectations in the instruction file. Put design decisions and reference components in a separate document, and keep actual tokens and behavior authoritative in code.

Did the sAIgnals newsletter redesign increase conversions?

We have not established that. This case study documents a change in visual consistency and its implementation checks, not a controlled conversion experiment.

Explore these tool hubs

Claude CodeCodexGitHub Copilot

Related guides

12 min readThree Trending AI Repositories That Improve the Work Around the Model

Our November 3 AI repository review: how Impeccable, Claude-Mem and Superpowers address UI quality, persistent context and development discipline.

17 min readIs Code Review Still Worth It in the Age of AI? Best Practices for Human and AI Review

A risk-based guide to modern code review: what AI should inspect, where human judgment still matters, and how to review AI-generated code.

15 min readWhat Is Multi-Agent Coding? Architecture, Workflows, and Examples with Codex, Claude Code, and GitHub Copilot

A practical guide to multi-agent coding architecture, workflows, tradeoffs, and implementation patterns in Codex, Claude Code, and GitHub Copilot.