# Datamaran design harness

Writing the product's design judgment down once, so every screen built on it, shipped or prototyped, comes out the same.

## The problem

Two developers could give an AI agent the same prompt and get two different screens. Both used our components. Both worked. They were two different UX patterns.

That's the problem the components alone couldn't solve. A design system tells you what a button looks like; it doesn't tell you how many primary buttons a header can have, or when a page gets a breadcrumb. Those calls lived in people's heads, and the fix happened afterwards, in code review, one comment at a time.

It showed up at two ends of the product process.

**At the production end**, the same screen got built differently by different people. A back button was outlined in one module and a bare icon in another. A breadcrumb's current page was a link here and a `<span>` there. A title used `--pv-font-size-xl` one quarter and `--pv-font-size-2xl` the next.

**At the prototype end**, every exploration paid the same setup cost. Set up the app shell, add the navigation, wire up the design tokens, pick the PrimeVue components, decide where mock data lives. All before a single design idea could be tried. The prototypes that came out didn't look like the product, and stakeholders made decisions from artifacts that had never behaved like it.

AI-assisted development made both worse. An agent with no reference invents a plausible component on every new screen: fine in isolation, inconsistent with everything around it. It can't know that the back button is always `severity="secondary" outlined size="small"` unless someone has written that down.

Both problems came from the same gap. The product's design judgment was scattered across documentation files, packages, prototypes and Figma documentation. It was written down, but never as something an agent could read and follow.

## My role

**Senior Product Designer**: I started the harness as a joint initiative with engineering, because the people who'd feel the drift in review were the ones who'd have to adopt the fix. I wrote the pattern library, sourcing each entry from production components in the modules I design for. I scoped and designed the prototyping shell as a design infrastructure investment, with a senior front-end developer on the implementation.

## The reframe

The question wasn't "how do we document the design system" or "how do we prototype faster." It was: **how does the product's design judgment reach the code, whoever writes it?**

The answer is the harness: one written layer of design judgment (which component, which props, which token, which rule) that sits between the design system and whoever writes the code. Its core is the pattern library, where each pattern is defined. Two kinds of work build on it:

| Uses the harness | Stage | What it constrains |
| --- | --- | --- |
| Production work | Building a shipped screen | Which component, which props, which token |
| Prototyping shell | Exploring an idea | Where code lands, and what it starts from |

## Inside the harness: the pattern library

The pattern library is where the harness defines each pattern, and what production work builds from. A general spec isn't enough to build a screen that ships: "use PrimeVue" doesn't tell an agent which button goes in a header, or that the title is an `<h2>`.

The pattern library is the answer to "how do we build this again?". Agents implementing features read it first. Engineers use it as a baseline. Reviewers cite a specific rule instead of a preference.

**Entries come from shipped code, not design intent.**
If a pattern is documented, it exists in a shipped screen. When the code and the document disagree, the code wins and the entry gets updated. I made this choice so the library could never become another spec that describes a product nobody built.

**Every entry has four parts.**

| Part | What it holds |
| --- | --- |
| Anatomy | A text diagram of what sits where |
| Components & props | The PrimeVue or datamaran_ui component, with only the props that differ from defaults |
| Tokens | The `--pv-*` token for every spacing, colour and type value. No hardcoded numbers |
| Rules | The constraints that are easy to miss. One sentence each, directly actionable |

A text diagram, not a screenshot, because an agent reads it reliably. Rules in one sentence, because a rule that needs a paragraph is usually two rules.

**The scope is deliberately narrow.**
Only patterns that recur across two or more modules: page headers, breadcrumbs, back navigation, action menus, meta rows. Component internals stay with PrimeVue and datamaran_ui. Visual decisions stay with the design system. The library records which token to use, not why that token has its value.

## One pattern, three variants

The page header was the first entry. It sits at the top of every main surface, and it was the place where screens drifted most.

**Shared rules** across every variant: the title is always an `<h2>`, because these screens are embedded in host pages that own the top-level heading. At most one primary button per header. The current breadcrumb carries `aria-current="page"` and is never interactive.

Then three variants, each with a test for when to use it:

**A: Landing.** The page has no parent. Static title, subtitle, actions on the right.

**B: Detail.** The page has a parent to go back to. A breadcrumb, a back button, an editable title and a meta row.

```
[ nav: crumb-link (button) / current page (static) ]
[ ← Back ]  [ h2 Title / Inplace rename ]      [ ··· Menu ]
[ Avatar  Owner · N entities · N regs · Date · Tag ]
```

**C: Analysis selector.** Switching the selected item *is* the navigation, so the title is a transparent `Select`. Borrowed from Double Materiality. The rule that decides it: use it only when the selection changes the entire page. If it filters a view, it's a regular `Select` in the page body.

The rules are where the library pays for itself. These are the ones a capable engineer or agent gets wrong from the component API alone:

- **Two affordances, one handler.** The back button and the breadcrumb parent both emit the same `back` event.
- **`@mousedown.prevent` on the rename buttons.** Without it, the input's blur saves the title before the click registers, so Discard never works.
- **The chevron comes from the `Select`.** Adding a `pi pi-chevron-down` by hand gives the title two chevrons.
- **Breadcrumb links are `<button>`, not `<a>`.** Navigation here is a Vue emit, not a URL change.
- **The owner avatar is `aria-hidden`.** A sibling `sr-only` span gives screen readers "Owner:" instead of a pair of initials.

None of these are visible in a Figma file. All of them are visible in a code review, after the fact.

## As an environment: the prototyping shell

The same harness also runs as an environment. The shell is a template where every prototype starts inside the real product, with the rules already applied, so an exploration can't drift from the product even when an agent writes it.

**A sandbox zone set by the architecture, not by convention.**
Prototypes only touch `<div class="main-content">`. The sidebar, user menu, tokens and routing can't be edited from there. Teams can't break shared infrastructure while experimenting. I chose architecture over documentation so the boundary holds without anyone having to remember it.

**The ESG domain as typed mock data.**
All 99 Datamaran topics, typed in TypeScript and matching the real API shape, plus regulations, reports, targets, IROs and companies. A topic selector that looks clean with three placeholder items falls apart with "Transition to a circular economy" next to "Spills". Real domain content shows layout problems that lorem ipsum hides.

**A `design.md` the code generator reads first.**
A machine-readable spec: use only PrimeVue, write single-file components, use the mock data, never touch the global layout. A designer can direct AI code generation without writing TypeScript, and the output lands in the right place, in the right style.

**`DmPreset.ts` for the brand.**
The `dm-ocean` palette, spacing and type scale, and component overrides for buttons, chips, tables and form fields. Every prototype inherits them, so a new team member's prototype looks like a senior designer's.

## How it fits together

The harness holds the judgment, and the pattern library inside it is where each pattern is defined. Production work applies it to what a shipped screen is made of. The shell applies it to what a prototype starts from. Both read the same rules, written for a reader that can't fill gaps from experience, in files the agent reads before it writes, not in a doc someone has to remember.

## The first test

Same prompt, same prototyping shell (Vue, PrimeVue, the DM preset, mock data, a sidebar, no database), run twice: once with the harness, once without. The brief was a page with a table plus a detail page. I scored both outputs against eight of our UX/UI pattern rules.

**Without the harness: 2 of 8. With it: 8 of 8.**

The differences, grouped:

| | Without the harness | With the harness |
| --- | --- | --- |
| Actions | Two primary buttons | One primary action, everything else secondary |
| Button size | Large | Small, as the header pattern specifies |
| Header | No breadcrumbs, bold title at the wrong size | Breadcrumbs, correct title size, semibold |
| Detail page | A generic page, disconnected from the app layout | The detail variant: back button and a secondary menu |

Both versions worked. Only one looked like Datamaran, and every difference maps to a one-sentence rule in the library.

It's one test: one prompt, one run, inside the shell rather than the production app. It shows the rules can be followed, not that they always will be. The next step is a wider set of prompts, run inside the app environment too, scored the same way.

## The outcomes

The harness is still in development. Early results are promising, and these are what exists today.

**The library has its first pattern.** The page header, across Applicability Assessment and Double Materiality. It grows one recurring pattern at a time. The goal is for reviews to cite a rule instead of a preference; that's one of the numbers below, not a result yet.

**The shell is in use.** It has been used for explorations of new regulatory dashboard patterns, Double Materiality flows and Applicability Assessment. The Applicability Assessment exploration fit in one working day; comparable explorations before the shell took several days.

**Feedback changed.** Stakeholder comments moved from "this looks different from what we have" to actual product decisions. In user testing, participants engaged with real features instead of reacting to placeholders.

The library is new, so these are the numbers to track:

| Metric | What it tells us |
| --- | --- |
| Pattern compliance across a wider set of prompts | Does 8 of 8 hold beyond one brief? |
| UX fixes needed in code review | Is design judgment arriving before the code, not after? |
| Agent-built screens that pass review without pattern fixes | Are the rules complete enough to follow? |
| Review comments that cite a library rule | Has review moved from taste to rules? |
| Time from brief to stakeholder-ready prototype | Is the shell still fast as the product grows? |
| Entries updated because the code changed | Is the library keeping up with production? |

## What I learned

Writing the pattern library showed how much of the design system had never been written down in one place. Most of the rules weren't decisions anyone remembered making. They were habits a senior engineer had and a new one didn't, like `@mousedown.prevent` on the rename buttons. An agent made the gap obvious, because it can't learn by osmosis.

The gap between a working screen and a Datamaran screen is small rules. In the side-by-side test, both versions worked. The one without the harness broke six of the eight rules it was scored on (two primary buttons, large buttons, a bold title among them), and each was a rule the library already had in one sentence.

The design work wasn't drawing the header. It was deciding which rules were worth a sentence, and making sure the code could always overrule them.
