DesignContractMIT · agent-agnostic

DesignContract

DesignContract v1

The versioned JSON contract is canonical. Rendered Markdown, CSS, HTML, and scorecards are views of the same object — not separate opinions.

Overview

DesignContract v1 is the enforceable layer between your product brief and implementation. When strategy changes, you regenerate the contract. When layout tweaks, you patch the implementation and re-score.

JSON is canonical. DESIGN.md, route.json, tokens.css, scorecard.md, and contract-preview.html are rendered views of the same object so humans and agents read identical constraints.

Schema highlights

Full schema: contracts/schema/design-contract.schema.json. CI compiles 20 golden briefs and validates every output against this schema.

Field areaWhat it controls
audience + primaryActionWho the page is for and the single main CTA
route + sectionsPage type and ordered section jobs
proofRequirementsEvidence that must appear before the ask
forbiddenPatternsExplicit anti-slop rules (no generic bento proof, etc.)
qaGatesClause IDs used by lint and score
tokens + motionVisual grammar constraints
agentHandoffHow builders should read and obey the pack

Commands

Compile contract pack
npx dzine-skill compile "premium AI product site" --contract --out dzine-pack
Validate
npx dzine-skill validate dzine-pack/design-contract.json
Lint (fail weak contracts)
npx dzine-skill lint dzine-pack/design-contract.json
Render views
npx dzine-skill render dzine-pack/design-contract.json --out-dir dzine-pack/rendered
Score live URL
npx dzine-skill score --contract dzine-pack/design-contract.json --url http://localhost:3003 --out dzine-pack/score-report.json
Repair
npx dzine-skill repair --contract dzine-pack/design-contract.json --scorecard dzine-pack/score-report.json --out dzine-pack/repair-prompt.md

Artifacts

FileReaderPurpose
design-contract.jsonScripts, CI, agentsSource of truth
DESIGN.mdAgents, humansStructured Markdown handoff
route.jsonAgentsSection architecture
tokens.cssImplementersStarter semantic tokens
scorecard.mdQA, agentsPass/fail review gates
contract-preview.htmlHumansBrowser dossier

Sample: examples/design-contracts/sample-ai-product/ · Gallery: Examples

Workflow

  1. Compile a brief into DesignContract v1.
  2. Lint before implementation — fix weak audience, proof, or action fields.
  3. Build with your agent using the rendered pack.
  4. Score the live URL against contract clause paths.
  5. Repair only failed clauses; re-score until gates pass.

Weak contracts

Lint intentionally fails contracts missing proof, vague primary actions, or empty accessibility rules. CI includes two weak fixtures to ensure the failure path stays working.