PublicDesign engineering lab

Component Contract Lab

Making design intent explicit enough for implementation to be constrained, tested and reviewed.

The implementation gap

Traditional design artefacts communicate visual intent well, but leave many execution-critical decisions implicit. A component can look close to a reference and still fail in behaviour, states, semantics or implementation constraints.

Once implementation could be generated, ambiguity in the design intent became the real constraint.

Design intent survives implementation when the rules that matter are explicit enough to execute and validate, not just interpret.

The important question was not how to make the generator better. It was what implementation was being forced to infer because design had never made it explicit.

Looks right

  • matches the reference
  • uses similar tokens
  • appears visually plausible

Executes correctly

  • correct structure and semantics
  • expected behaviour and states
  • geometry and interaction boundaries
  • accessibility expectations
  • implementation constraints

Making intent executable

I reframed the gap around explicit execution intent. The contract records the decisions that matter strongly enough to constrain implementation and define acceptance, rather than leaving them to silent inference.

  • Structure
  • Behaviour
  • States
  • Geometry
  • Accessibility expectations
  • Constraints
  • Dependencies
  • Validation criteria

Controlled implementation workflow

I designed the execution boundary from design intent through contract, implementation and validation. AI can assist inside the implementation step; it does not define the acceptance boundary.

Workflow model

Deterministic validation

PASS / FAIL on structure, attributes, geometry and interaction behaviour.

Bounded correction

Correct against the contract and rerun against the same criteria.

Deferred checks

Unresolved intent and final acceptance remain visible human decisions.

Human-defined intent and criteria come first. AI may assist with implementation; the contract and review boundary determine what is accepted.

What the contract changed

A secondary-button example makes the boundary concrete: an implicit implementation choice becomes an explicit execution rule and then a reviewable result.

Secondary-button example

01Implicit implementation choice

The visual reference established a secondary button, but left execution-critical choices open.

Includes:

  • Hover could affect layout
  • Focus treatment was open
  • Dependency choice was open
02Explicit execution rule

The contract declared the decisions that implementation had to preserve rather than infer.

Includes:

  • Default and hover stroke
  • Compact focus treatment
  • No external dependencies
  • No layout impact
03Reviewable result

The result could be checked against the declared boundary, corrected and checked again.

Includes:

  • Layout-safe hover behaviour
  • Explicit focus treatment
  • Missing choices flagged
  • Patch, rerun and review

The contract turns an implicit implementation choice into a declared and reviewable boundary.

Contract anatomy

The format matters less than the boundary it declares: intent, behaviour, constraints and validation in one reviewable shape. Missing decisions stay visible instead of being silently guessed.

A simplified readability view of the model.

component: SecondaryButton

intent:
  purpose: Provide a lower-emphasis action without competing with the primary action.
  decision: Keep the button compact, layout-safe and dependency-free.

execution:
  visual:
    - default stroke
    - hover stroke
    - compact focus treatment

  constraints:
    - Do not import external fonts.
    - Do not stretch to fill the container.
    - Hover must not change layout dimensions.
    - Focus treatment must remain compact.

validation:
  criteria:
    - No external dependencies are introduced.
    - Hover and focus do not create layout shift.
    - Generated output matches the declared constraints.
    - Missing decisions are flagged instead of guessed.

The important part here is the declared boundary: what the model may decide, what it must not invent and what must be checked before acceptance.

Controlled results

I directed controlled comparisons to test the mechanism rather than rely on a convincing demo. The result was measured as first-pass conformance.

Controlled results · first-pass conformance

Toggle

Contract-mediated16 / 18
Direct4 / 18

Text Input

Contract-mediated17 / 18
Direct10 / 18

Across two controlled component benchmarks, contract-mediated implementation materially improved first-pass conformance.

Controlled comparison across Toggle and Text Input.

What I designed

I defined the model and the decisions around it, from the upstream design problem to the boundary between deterministic execution and human judgement.

  • 01

    Move the problem upstream

    I reframed implementation fidelity as a design problem: what is being forced to infer because intent was never made explicit?

  • 02

    Define the contract boundary

    I decided which choices needed to constrain execution, and where inference was acceptable versus where it had to be flagged.

  • 03

    Separate checks from judgement

    I split deterministic PASS / FAIL checks from deferred criteria that still required human review and acceptance.

  • 04

    Bound correction

    I shaped correction as a contract-led rerun against explicit criteria, rather than unrestricted regeneration.

  • 05

    Test the mechanism

    I directed controlled comparisons to test whether the model changed first-pass conformance, not just whether a demo looked convincing.

GitHub repository

The public repository contains the contract, implementation runs and validation notes as a working method artefact.

View GitHub repository

LinkedIn write-up

A concise account of the secondary-button experiment and the design decision behind explicit constraints and reviewable execution.

Read LinkedIn write-up