Communitygithub.com

guillaume-flambard/craft-ui

Build or fix a web interface so it looks finished on any model: match real references, read the docs of the UI library version actually installed, build on one token system with the five screen states, then verify by measurement in the browser (overflow at every width, contrast, targets, input size) before showing it. Use before any web UI work: a page, a dashboard, a component, a redesign, a responsive fix or a UI review.

Qu'est-ce que craft-ui ?

craft-ui is a Claude Code agent skill that build or fix a web interface so it looks finished on any model: match real references, read the docs of the UI library version actually installed, build on one token system with the five screen states, then verify by measurement in the browser (overflow at every width, contrast, targets, input size) before showing it. Use before any web UI work: a page, a dashboard, a component, a redesign, a responsive fix or a UI review.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/guillaume-flambard/engineering-skills/tree/HEAD/plugins/design/skills/craft-ui

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation


name: craft-ui description: Build or fix a web interface so it looks finished on any model: match real references, read the docs of the UI library version actually installed, build on one token system with the five screen states, then verify by measurement in the browser (overflow at every width, contrast, targets, input size) before showing it. Use before any web UI work: a page, a dashboard, a component, a redesign, a responsive fix or a UI review. license: MIT

Craft UI: references, the real API, tokens, measured verification

Interfaces made with coding agents fail in the same few ways: they look generic, they use classes the installed library does not have, they only design the happy path, and they break between breakpoints. This method closes each gap with something checkable. Taste helps; measurement makes it reliable.

Inputs

  • The task and the product: its current screens, brand, labels and information architecture.
  • The project's UI library and its installed version (package.json, the vendored CSS header, the CDN URL).
  • The project's design notes or checklist, if any (DESIGN.md or similar).

Steps

  1. Ground truth. Collect what the UI must resemble before designing: the product's current screens, its public site, a sibling product's tokens, frames from a demo video (ffmpeg -i demo.mp4 -vf fps=1/2.5 frames/%02d.png). Keep the product's labels and structure; modernise the rendering. Keep references in a git-ignored folder. Done when you can name the screens, labels and brand colours you are matching.
  2. The library's real API. Read the documentation of the version actually installed, starting with its LLM index when it has one (<site>/llms.txt), and its migration page if the major version is new. Confirm every class or component you plan to use exists in what ships: grep the installed CSS (grep -c '\.btn-primary' node_modules/<lib>/dist/<lib>.css), or for a CDN build, the file at the exact pinned URL. A class from another major version often does nothing, silently. In the answer, list the classes used and say how they were confirmed. Done when every class in the plan is confirmed.
  3. One token system, even on top of a UI library: declare a short set of custom properties (brand colour, text, surface, border, radius, spacing steps, focus colour) and map the library's variables onto them, so every value in your CSS comes from a token. Dark mode redefines tokens. Follow references/quality-floor.md while building.
  4. Five states per screen: loading, empty, error, partial, normal, each designed and written (copy included), not only the happy path. A destructive action gets a confirmation that names what will be lost. Done when every screen has all five.
  5. Accessibility while building, not after: a visible label for every field (a placeholder is not a label), errors tied to their field (aria-describedby) and announced, a visible focus ring that nothing covers, every action reachable by keyboard, targets of at least 24 px (44 px on touch), text contrast of 4.5:1 and 3:1 for button edges and icons, nothing said by colour alone (WCAG 2.2 AA). Done when each point is checked on every screen.
  6. Specialist skills, if installed. Use one direction skill per surface, never two at once (they contradict each other): for example impeccable for product UI, or a landing-page skill for a marketing page. Use review skills such as web-design-guidelines or an accessibility audit for the finish. Load a skill for its method, not its rituals.
  7. Anti-slop sweep. Generated interfaces share recognisable tells, and a client spots them at once. Run a deterministic detector if one is installed (for example impeccable detect <url>) on every page you changed, and fix what it reports rather than suppressing it. The usual tells: a default face seen everywhere (Inter, Geist, Space Grotesk and the like), a decorative grid or stripe background outside a real measuring surface, an italic accent word in a heading, a numbered "how it works in three steps" section, logo walls, status chips with a coloured dot, glow and gradient blobs, lines over 80 characters, and AI writing tells in the copy (em dashes, "seamless", "leverage"). Done when the detector reports no anti-pattern, or each remaining finding is named with its reason.
  8. Verify by measurement. Serve the UI and run scripts/ui-check.js in the browser console (or a browser tool's JavaScript runner): await uiCheck({ pages: ['/'] }). It sweeps 375, 768, 1024 and 1440 px in light and dark, and counts horizontal overflow, lines over 80 characters, buttons that stand out from their background by less than 3:1, text under WCAG AA contrast, and, in mobile emulation, targets under 44 px and inputs under 16 px. Then run scripts/overflow-sweep.mjs with Playwright on the running app: every width from 320 to 1440 px in 8 px steps, failing on any page-level overflow and naming the elements. Read the console for errors, and look at screenshots at phone and desktop width yourself. Done when every count is zero, or each remaining count is named with its reason.
  9. Know the blind spots. A zero is a floor, not a proof. The sweep skips placeholders, input values, pre text and disabled controls for contrast, treats semi-transparent backgrounds as absent, and measures no accessibility semantics. Check those by eye, and do a keyboard and screen-reader pass (labels, focus after an error, live regions).
  10. Fix in the shared layer. For each defect: measure it (getBoundingClientRect, computed style), find the cause, fix it in the token or component CSS so every screen benefits, measure again. A fix is done when the measurement changes, not when the code looks right.

Template: assets/template.md for the verification report.

Writing the document

  • Numbers, not impressions: widths tested, counts from the last sweep, what stayed untested.
  • Plain words; name the screen and the element.

Mistakes, and what to do instead

  • Designing from memory of what the library looks like. Read the installed version's docs and grep the shipped CSS.
  • The happy path only. Design all five states, with their copy.
  • Checking four breakpoints. Sweep every width; bugs live between them.
  • A green sweep presented as done. Look at the screenshots, do the keyboard pass, and say what was not tested (real devices, Safari, touch gestures).
  • Fixing a defect on one screen. Fix the token or the component.
  • Two direction skills loaded together. Pick one per surface.
  • Shipping what the anti-slop detector flags. Change the face or remove the device; suppress a finding only with a named reason.

Ready for the next step when

  • References collected; labels and brand colours named.
  • Every class or component used is confirmed in the installed version.
  • Every colour, radius, spacing and font comes from a token.
  • Every screen has its loading, empty, error, partial and normal states.
  • Labels, focus, keyboard, target size and contrast are checked on every screen.
  • The anti-slop detector reports no anti-pattern on the changed pages, or each finding has its reason.
  • ui-check.js and overflow-sweep.mjs report zero, or each count has its reason.
  • Screenshots looked at, keyboard pass done, untested areas named.

Worked example

An admin dashboard rebuilt on a new major version of its UI library. Step 2 found that three button classes from the old version did not exist in the shipped CSS; they rendered as plain text. The first sweep reported 14 contrast failures (a branded grey at 3.9:1) and overflow at 352 to 368 px only, caused by a table header that a four-breakpoint check had missed. The grey token was darkened once, and the header got min-width: 0: the next sweep reported zero. Not tested: Safari on a real iPhone.

Next step

Hand the screens over with hand-off-to-human (agents family) if it is installed, with the sweep numbers.

Evals

Trigger cases, quality cases and the last scores, in the plugin's eval folder: evals/craft-ui/.

Skills associés