agentleFS
bydioramabydiorama/ui/.claude/skills/craft/SKILL.md

craft

Skill11 starsChanged 7 days agoMITView on GitHub

Craft rules for building interfaces with @bydiorama/ui. Use when building or reviewing UI components, animations, hover states, shadows, radii, icons, or micro-interactions in a project that consumes the Diorama design system. Triggers on UI polish, "feels off", border radius, shadows, press feedback, enter/exit animations, icon states, motion review.

15 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If it looks clickable, all of it is clickable: No dead zones — a checkbox and its label are one target.

    line 115
  2. Distinctive:

    Never signal a state with a partial edge: No left bar, no bottom rule, no inset stripe — not for hover, not for current, not for …

    line 142
  3. Distinctive:

    Two states that must differ need two values: If hover and current would paint the same fill, the answer is a missing token, not a marker …

    line 155
  4. Distinctive:

    Contrast fixes move lightness: When a pair fails, adjust L and keep chroma and hue — that keeps the colour recognisably itself.

    line 173

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Diorama UI craft

The small details that make interfaces built with @bydiorama/ui feel finished. These rules complement — never override — the system's binding conventions (CONVENTIONS.md in bydiorama/ui) and its semantic tokens: when a rule below names a value, use the token that carries it, not the number.

Adapted for the Diorama design system from "skills" by Jakub Krehel (github.com/jakubkrehel/skills) — © 2026 Jakub Krehel, MIT. The full licence and permission notice are at the end of this file: MIT requires both to travel with substantial portions, and a pointer to another repository's CREDITS.md travels nowhere.

This skill was called ui-craft (installed as diorama-ui-craft) until ADR 0027. Comments in the library still cite its rules as "ui-craft rule N": the numbers are the same.

Review method

Slow the interface down: replay motion at 10% speed in the browser's Animations panel and walk every state — hover, focus, active, loading, empty. What feels off at 10% speed is what is subtly wrong at full speed.

Rules

Radii

  1. Concentric border radius. Nested rounded elements share a centre: outerRadius = innerRadius + padding. Equal radii on a card and the button inside it is the single most common thing that makes a layout feel off. Derive from the --ui-radius-* scale; never invent a radius.
  2. A large radius insets its bare text. Inside a panel at --ui-radius-2xl, unboxed content — a title, a field label, a row of footer buttons — steps in by --ui-space-sm beyond the panel's own padding, because text sitting flush crowds the corner arc. Boxed children (an info well, an input, anything with its own fill or border) stay flush: their edge already reads as an edge. Getting this backwards is what makes a generously-rounded card feel cramped at the corners and loose in the middle. Popover.Title and Popover.Description carry the inset for you.
  3. Optical over geometric alignment. Icons in buttons, play triangles and asymmetric glyphs need manual nudging when geometric centring looks wrong. Trust your eye, then encode the nudge in the component, not the call site.

Elevation

  1. Shadows for elevation, borders for structure. A border whose only job is depth should be a layered translucent shadow (--ui-shadow-*). Keep borders that communicate structure or state: dividers, separators, selection, focus.
  2. Image outlines. Give images a 1px translucent outline so they hold their edge on any surface — pure black in light scheme, pure white in dark, never a tinted neutral (a tinted outline picks up the surface underneath and reads as dirt on the image edge).

Motion

  1. Transitions for interaction, keyframes for one-shots. CSS transitions retarget mid-flight, so a toggle reversed halfway reverses smoothly; keyframes restart and feel broken. Keyframes are for staged sequences that run once.
  2. Press feedback is scale(var(--ui-press-scale)) — 0.96, exactly. Below 0.95 feels exaggerated; above 0.97 is imperceptible. Components take staticTap to opt out where even this is noise.
  3. Stagger only infrequent entrances. Staged entry (split into semantic chunks, --ui-stagger-step apart) is for first loads, success and empty states — never for row hovers, keystrokes or repeated tab switches. The attention cost of motion repeats on every trigger.
  4. Exits softer than enters. A small fixed translateY and a fade, not a full-height collapse. --ui-ease-out both ways.
  5. Icon state changes cross-fade (opacity + slight scale), both icons in the DOM — never a hard swap. Skip entrance animation on first render. IconSwap is this rule as a component: a subtle dip (×0.8) with a little blur reads as one glyph re-forming; a deep scale (×0.5) reads as a pop.
  6. Durations and easings come from tokens (--ui-motion-*, --ui-duration-*, --ui-ease-*). Never a hard-coded ms. Never transition: all — enumerate properties. The three motion levels are handled at the token layer (--ui-motion-travel and --ui-enter-scale for anything that enters or leaves); JS-driven animation asks motionLevel() explicitly. 11a. Seamless means front-loaded, short and single. One strong ease-out (--ui-ease-out, ADR 0030) for anything that settles; exits shorter than entries and never delayed; the fade shorter than the move; 4–12px of travel and never a scale from 0; a selection is one element travelling, not two fills cross-fading; new content enters from the side of what was chosen; a leaving row fades while its list closes, in one motion. A height animation folds the padding with it, or the element stalls at its padding and jumps shut.

Icons

  1. One SVG, recoloured per state. Icons use currentColor; hover, selected and disabled states come from CSS colour and opacity, never separate assets. Outline is the default; fill marks the active state.
  2. Match stroke to text weight. An icon beside text carries the text's optical weight. One stroke weight per surface — and in Diorama projects, griddy-icons only.

Control size

13a. Leave a Button at its default size (md) unless it sits inside something already dense. Size follows the control's role: md for every action in a composition (a card, a form, a dialog footer, a list's add button), lg for a page's primary action, sm only inside a dense part (table cell, icon toolbar, chip row). "Secondary" is a variant, not a size; a denser screen is data-ui-density="compact", not size="sm". Small buttons by instinct are the most common way a new composition looks cramped (ADR 0029).

Hit areas

  1. If it looks clickable, all of it is clickable. No dead zones — a checkbox and its label are one target. The conformance floor is --ui-hit-area-min (24px); primary controls aim for --ui-hit-area-touch (44px). The visible element may stay small — extend the hit area with a pseudo-element on the wrapping label or button (replaced elements don't render ::before/::after reliably).

Pointer and disabled states

  1. Set cursor: pointer on anything clickable — always, explicitly. No browser gives <button> a pointer cursor by default, and no reset in this stack adds one. It is the only signal a control is clickable before the click, so a missing pointer reads as "this isn't a button". Disabled controls get cursor: not-allowed.
  2. Disable with the attribute, not pointer-events: none. disabled already blocks activation and removes the control from the tab order. Killing pointer events on top of that only makes the control unhoverable, which silently removes the tooltip that would explain why it is unavailable. Gate hover/press styling behind enabled: instead.
  3. Don't expect a press animation on Enter. Pointer-press and Space-hold paint :active; Enter activates instantaneously, so the UA applies :active for at most a frame. That is browser behaviour, not a bug worth "fixing" with JS state — the focus ring is the static cue and the resulting action is the acknowledgement. Rule 8 already requires a non-motion channel.

Separation and state

  1. Never signal a state with a partial edge. No left bar, no bottom rule, no inset stripe — not for hover, not for current, not for active-focused, and least of all thick. A ruler inside a control reads as clutter and multiplies: every marked row adds another line to the page. The channels that work are a background step, a full thin outline or border, or elevation — each of which changes the whole surface rather than decorating one side of it.
  2. Group with space, not with lines. A separator earns its place only when space genuinely cannot do the job, and in this library it never has: Menu.Separator is 8px above and below with nothing painted, and it still announces as role="separator". Grouping is the DIFFERENCE between two gaps. Reach for a rule and you are usually solving a spacing problem with ink.
  3. Two states that must differ need two values. If hover and current would paint the same fill, the answer is a missing token, not a marker bolted on the side. The nav family had one fill and grew --ui-nav-hover-bg the day a 48px rail had no label left to change weight.
  4. Strokes are solid — never dashed or dotted. A codified decision (2026-11-02): no dash pattern on a border, outline, divider, underline or SVG stroke, in code or on a sheet. Dashes read as unfinished or as a placeholder; an empty slot is a fill, a drop target is a fill change. Numbered 24 rather than inserted so rule 23 keeps the number code cites. check:strokes fails the build on border-dashed, outline-dotted, a dashed borderStyle or any stroke-dasharray.

Colour

  1. Semantic tokens only. --ui-* roles, never raw values, never palette names. One colour, one meaning: if the link colour shows up as decoration, the decoration gets a neutral instead. Only the single primary action in a view gets a filled accent background.
  2. Contrast fixes move lightness. When a pair fails, adjust L and keep chroma and hue — that keeps the colour recognisably itself. (This is what the theme resolver's audit does; do the same in one-off fixes.)

Type rendering

  1. Text stays off the GPU at rest. A persistent transform, will-change or filter on a text-bearing element promotes it to a compositor layer, where the glyphs are rasterised once and resampled — permanently soft text. Transient motion is fine: press scale (rule 7) and icon cross-fades (rule 10) end, and the text repaints sharp. The trap is promotion that outlives the animation — a will-change left in place "for performance", a translateZ(0) hack, a decorative filter on a container that holds copy. Clear will-change when the animation ends and keep filters on sibling layers, not on the text's ancestor. Leave text-rendering at auto; smoothing itself is the app root's job (CONVENTIONS §6), never a component's.

    backdrop-filter is NOT in that list, and it used to be. The two read alike and do opposite things to type: filter filters the element, its own text included, while backdrop-filter filters only what is BEHIND it and composites the element's content on top untouched. Measured in Chromium on the affixed Header, whose backdrop-blur-sm sits on the <header> carrying the nav labels:

    on a text-bearing elementglyph pixels changed
    backdrop-filter: blur(4px)0 — pixel-identical
    filter: blur(0.4px)9.31%, peak delta 139/255

    So a translucent bar can have its blur and sharp labels both. Rule 23 banned a real technique on the strength of a plausible mechanism nobody had measured — which is the failure the rule itself is about, one layer up. Reach for backdrop-filter freely over a translucent ground; the thing to still avoid over text is filter.

Effects

  1. Effects are a layer, not a feature. Glass, grain, sheen, glow, shimmer, ink, the grounds and halo are a class on a component's root — className={fx("glass")} — never a prop, never a restyle of its parts. One glass surface and one lit action per view; emphasis everywhere is none. The full guide is the effects skill.

Common mistakes

MistakeFix
Equal nested radiiouter = inner + padding, from the --ui-radius-* scale
Border faking elevationLayered translucent --ui-shadow-*; keep structural borders
Keyframes on a toggleCSS transition, so it reverses mid-flight
scale(0.9) on pressvar(--ui-press-scale)
Stagger on every hoverInstant feedback, or ≤150ms opacity/colour
Hard-coded 200msvar(--ui-motion-standard)
Separate icon file per stateOne currentColor SVG, states via CSS
16px icon-button with a 16px hit areaPseudo-element hit area ≥ --ui-hit-area-min
Raw hex in a componentThe --ui-* role token that means it
Clickable element with the default arrow cursorcursor: pointer — never inherited, always explicit
pointer-events: none on a disabled controlThe disabled attribute + enabled: gated hover, so tooltips survive
Asserting interaction in jsdomA real browser — jsdom doesn't implement implicit activation
Translucent panel built by hand with bg-surface/70 + backdrop-blurfx("glass") — its tint is derived per brand so muted text still clears AA over anything behind it
A shimmer, sweep or glow on hoverHover gets the component's own instant state change; light marks moments and states
Text soft/blurry after (or during rest between) animationsLayer promotion outlived the motion — clear will-change, no resting transform/filter on text containers

Licence

The craft rules above are adapted from "skills" by Jakub Krehel (https://github.com/jakubkrehel/skills). Reproduced here rather than linked, because MIT requires the copyright notice and the permission notice to accompany substantial portions wherever they go — and this file is installed into other people's repositories.

MIT License

Copyright (c) 2026 Jakub Krehel

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.