Skip to content

docs: Add DESIGN-MD-PROMPT.md for consumer repos - #865

Open
ledfut wants to merge 1 commit into
mainfrom
docs/design-md-prompt
Open

docs: Add DESIGN-MD-PROMPT.md for consumer repos#865
ledfut wants to merge 1 commit into
mainfrom
docs/design-md-prompt

Conversation

@ledfut

@ledfut ledfut commented Apr 27, 2026

Copy link
Copy Markdown

Summary

Adds docs/DESIGN-MD-PROMPT.md — a copy-pasteable prompt for coding agents (Claude Code, Cursor, Gemini CLI, Aider, etc.) that bootstraps both a DESIGN.md and a generator pipeline that keeps it in sync in any repo consuming @lukso/web-components.

The DESIGN.md format itself is the google-labs/design.md spec — a YAML-front-matter + prose contract that gives coding agents a stable, token-addressable description of the consumer product's visual identity.

No code changes. Single new file at docs/DESIGN-MD-PROMPT.md (163 lines). Zero impact on the library's build, tests, or runtime.

Why this lives here

The prompt's job is to tell coding agents how to integrate this library. Keeping it next to the library means the prompt and the library version evolve together — bumping the LUKSO scale, adding a new <lukso-*> component, restructuring the typography classes, or moving the radius/spacing tokens to a different file can all be reflected in the prompt in the same PR. Consumers git pull-ing the library get the up-to-date integration playbook by default.

What the prompt does

When pasted into an agent session inside a consumer repo, the agent:

  1. Confirms @lukso/web-components is in package.json.
  2. Reads the live node_modules/@lukso/web-components/dist/styles/{colors,typography,component}-v4.css for token values.
  3. Inventories <lukso-*> library usage across the consumer's templates.
  4. Inventories bespoke in-repo components — wrappers, compositions, domain widgets — so the produced DESIGN.md surfaces both layers.
  5. Emits scripts/generate-design-md.mjs + a project config + DESIGN.md at repo root, with HTML comment fence markers around the dynamic sections so evergreen prose stays human-curated.
  6. Wires the generator into the consumer's package.json, pre-commit hook, and CI (yarn lint:design as a parallel sub-lint).
  7. Validates against npx @google/design.md lint DESIGN.md and the consumer's formatter.

Reference implementation

universal-everything/universaleverything.io#780 adopts this exact pattern. That PR's DESIGN.md, scripts/generate-design-md.mjs, scripts/design-md.config.mjs, and .husky/pre-commit are a worked example of the shape this prompt produces.

Use cases

  1. Agent-authored UI work in consumer repos — agents see <lukso-button variant="primary"> plus the consumer's existing <AppLink>/<ProfileCard>/<TokenCard> wrappers as the canonical implementations and stop hand-rolling primitives in Tailwind.
  2. New consumer onboarding — paste the prompt in a fresh dApp and you get a spec-compliant DESIGN.md plus the pipeline that keeps it in sync, in one agent session.
  3. Drift detection across the LUKSO ecosystem — once consumers adopt the pattern, npx @google/design.md diff between releases of this library can surface token-level breaking changes.
  4. Token export — consumers' DESIGN.md files become first-class inputs to Figma, Style Dictionary, and other design-tooling pipelines via --format tailwind / --format dtcg.

How to test

Render the file on GitHub and confirm:

  • The 'The prompt' section uses 4-backtick outer fences containing 3-backtick inner fences (the most common rendering risk).
  • All five external links resolve: google-labs/design.md spec, this repo, the Storybook (tools-web-components.pages.dev), universaleverything.io, and the npm package.
  • Prettier is clean: npx prettier --check docs/DESIGN-MD-PROMPT.md.

To dry-run the prompt itself: clone any LUKSO dApp that doesn't yet have a DESIGN.md, paste the fenced block from the file into a fresh agent session, and verify the agent produces a working pipeline. Iterate on the prompt here when it doesn't.

Follow-ups (not in this PR)

  • Consider adding a brief link from README.md and/or CLAUDE.md pointing at this file so consumers discover it.
  • Once the spec stabilises beyond alpha, revisit the prompt's "Validate" step to drop the warning-tolerance language.

Adds docs/DESIGN-MD-PROMPT.md — a copy-pasteable prompt for coding
agents (Claude Code, Cursor, Gemini CLI, etc.) that bootstraps a
google-labs/design.md-compliant DESIGN.md *plus* a generator pipeline
in any consumer repo of @lukso/web-components.

Why this lives here, in the library repo: the prompt's job is to tell
agents how to integrate this library. Keeping it next to the library
itself means the prompt and the library version evolve together —
bumping the LUKSO scale, adding a new <lukso-*> component, or
restructuring the typography classes can be reflected in the prompt
in the same PR.

How consumers use it: paste the fenced markdown block in 'The prompt'
section into an agent session opened inside the *consumer* repo.
The agent emits scripts/generate-design-md.mjs + a project config +
DESIGN.md at the consumer's repo root, wires it into pre-commit and
CI, and validates against the spec linter.

Reference implementation: universaleverything.io adopted this pattern
in PR #780 — link from the prompt for a worked example.
@github-actions

Copy link
Copy Markdown
Contributor

Storybook deployed with Cloudflare Pages ☁️ 📖 🚀

Storybook

Built from commit d8f2e30

Comment thread docs/DESIGN-MD-PROMPT.md
Comment on lines +22 to +27
**Reference implementation:** [universaleverything.io](https://github.com/universal-everything/universaleverything.io) is the canonical example —

- [`DESIGN.md`](https://github.com/universal-everything/universaleverything.io/blob/main/DESIGN.md) — the generated artifact
- [`scripts/generate-design-md.mjs`](https://github.com/universal-everything/universaleverything.io/blob/main/scripts/generate-design-md.mjs) — the generator
- [`scripts/design-md.config.mjs`](https://github.com/universal-everything/universaleverything.io/blob/main/scripts/design-md.config.mjs) — project-specific role mapping
- [`.husky/pre-commit`](https://github.com/universal-everything/universaleverything.io/blob/main/.husky/pre-commit) — auto-regenerate hook

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't mention outside repos here, docs should stay generic

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new copy-pasteable agent prompt (docs/DESIGN-MD-PROMPT.md) intended for consumer repos of @lukso/web-components to bootstrap a spec-compliant DESIGN.md plus an automation pipeline to keep it in sync.

Changes:

  • Add docs/DESIGN-MD-PROMPT.md documenting a 7-step agent workflow to generate and validate DESIGN.md.
  • Include guidance for scanning <lukso-*> usage and in-repo custom components, plus hook/CI integration.
  • Provide reference links and a validation checklist for consumers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/DESIGN-MD-PROMPT.md
Comment on lines +130 to +135
```bash
yarn design:generate # writes DESIGN.md
yarn lint:design # exit 0 ⇒ committed file matches sources
npx @google/design.md lint DESIGN.md # spec validation, expect 0 errors
yarn lint:fmt # prettier-clean across the new files
```
Comment thread docs/DESIGN-MD-PROMPT.md
yarn lint:fmt # prettier-clean across the new files
```

Target: `errors: 0` from the spec linter. Warnings are acceptable when they stem from upstream LUKSO values (e.g. `button-primary-hover` using `lukso-60` `#bb7793` for hover, `status-error` using `red-55` `#e23636`). If the linter flags any other warnings, fix them in the role mapping or component recipes — never silently accept them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants