Instructions for agents (and subagents) working in the beautiful-ui-svelte repo (previously scrutiny-design-system)
Svelte 5 component library, a port of beautiful-ui (MIT).
If a syntax, API, error, or structure isn't landing from memory, or a fix you apply doesn't behave as expected, the answer is very likely not prominent in training data. Before guessing or hacking around it, do a targeted web search:
- Search the specific symptom / error message verbatim (
site:github.com, Stack Overflow, the framework changelog). Someone has usually hit the same error and documented the exact cause. - Search for the specific API / syntax (
svelte 5 $effect cleanup), not a vague paraphrase. - Search for similar problems to learn the real pattern instead of inferring one.
- Prefer primary sources: official docs, the framework's GitHub issues/PRs, the actual package source.
Guessing at obscure framework behavior wastes more time than the search costs, and breeds subtle bugs that only show up at render time.
style:height={viewportH}does NOT appendpxin Svelte — pass a pre-built string (\${viewportH}px``) or the style is rejected and the layout breaks (ApprovalCard showed all questions stacked).- Svelte 5 preserves whitespace inside
<pre>(unlike React JSX, which collapses inter-tag whitespace). Inside a<pre>, hug the tags with no indentation between them or literal newlines/indents leak into the code. - Svelte STRIPS leading/trailing whitespace inside an element's text content
at compile time (the opposite foot-gun of the
<pre>one). A trailing space written as{x}inside a tag is REMOVED — words join. React's{x}{" "}idiom becomes Svelte's{x}{' '}; the{' '}expression forces the space into the emitted text node. (Proven at compiler level:<span>{x} </span>→...${x}</span>;<span>{x}{' '}</span>→...${x} </span>.) StreamingText showed "Pistachioisyourfastest…" until fixed. GlideHighlight.sveltemustbind:this={container}on its root div — without it the hover-glide NEVER renders for any consumer.- Svelte-5 runes only (see
.agents/skills/svelte-5-runes/SKILL.md). No Svelte-4export let/$:/<slot>/createEventDispatcher. - No
$libalias is configured — use relative imports (../../lib/...). - Storybook needs
src/app.css— it's imported in.storybook/preview.ts; keep that import or stories render unstyled. - Icons are
@tabler/icons-svelte(the original's paid set is substituted with closest Tabler equivalents perguidelines.md). - Browser-only APIs (ResizeObserver, rAF, window/document listeners, timers)
MUST run inside
$effectwith cleanup — never component top level — for SSR safety. - Bare-statement
$effectdeps compile away —visible; expanded; stage;inside an$effectoptimizes to a no-op and the effect never re-fires. Read reactive deps into locals (or into a realif) so Svelte registers them. (ThinkingState's connecting line stayedheight: 0pxuntil fixed.) - Large components exceed a single write — assemble via a subagent that
writes chunked parts and NEVER truncates; then run
svelte-checkyourself.
- Fix source, then prove it: render the component in the running Storybook
(
http://localhost:6006) and inspect the DOM / computed styles with thebrowsertool, ornode ssr-test.mjs <ComponentName>for a fast render-throw check. - The SSR/compile check catches ReferenceErrors and render throws; visual fidelity is confirmed against the live story.