| name | tweaks | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Wrap any HTML artifact with a side panel of live, parameterized controls โ accent color, type scale, density, motion, theme โ that rewrite CSS custom properties in real time and persist to localStorage. Lets the user explore variants of a design without re-prompting the agent. Use when the brief asks for "variants", "side-by-side options", "tweak this", "let me adjust", "live knobs", or "ๅฎๆถ่ฐๅ". | |||||||||||||||||||
| triggers |
|
|||||||||||||||||||
| od |
|
Wrap any HTML artifact with a side panel of live controls that rewrite
CSS custom properties in real time and persist to localStorage.
Inspired by the huashu-design tweak pattern.
A single self-contained HTML file with two layers:
- Stage โ the original artifact (landing page / deck / dashboard)
re-keyed so all visual decisions read from CSS custom properties:
--accent,--scale,--density,--mode,--motion. - Panel โ a fixed sidebar (or drawer on small viewports) with
form controls bound to those custom properties via a tiny
vanilla-JS bridge. Persists every change to
localStoragekeyed by the artifact identifier.
The user can:
- Open the artifact and see the stage rendered with their saved preferences (or sensible defaults).
- Adjust accent / scale / density / mode / motion in the panel and watch the stage update instantly โ no rerender.
- Press T to hide / reveal the panel; R to reset to defaults.
- Refresh the page โ every choice is persisted.
- The user generated something they like 80% of, and wants to dial in the last 20% themselves.
- You're presenting a design system / brand and want the audience to feel the variants live (instead of you re-running the agent).
- You're shipping a stand-alone demo (e.g. a portfolio piece) and want viewers to play.
- One-shot artifacts that won't be iterated on (e.g. a runbook โ parameters don't help).
- When the artifact's value is in fixed ratios (e.g. an infographic with carefully balanced data viz โ knobs would degrade it).
Pick a subset that suits the artifact. Don't ship all 5 if only 2 matter โ clutter is a regression.
A select with 5โ8 curated swatches (don't ship a free color picker โ the user will pick a bad color and blame you).
const ACCENT_PRESETS = [
{ id: 'rust', val: '#c96442', label: 'Rust' },
{ id: 'cobalt', val: '#2c4d8e', label: 'Cobalt' },
{ id: 'sage', val: '#4a7a3f', label: 'Sage' },
{ id: 'plum', val: '#7a3f6a', label: 'Plum' },
{ id: 'graphite',val: '#3a3a3a', label: 'Graphite' },
];The artifact uses var(--accent) everywhere it had a hard-coded
accent before. Border / link / pull-quote rule / CTA all flip
together.
Three settings: Compact (0.85), Normal (1.0), Generous (1.15).
All font-size declarations multiply by var(--scale) via
calc(... * var(--scale)).
Don't go beyond ยฑ15% โ beyond that the layout breaks (column flow, breakpoints, line counts).
Three settings that swap the spacing scale: Tight (0.75) /
Normal (1.0) / Roomy (1.4). All padding / gap / margin
declarations multiply by var(--density).
This is the highest-impact knob โ it's also the most fragile, so every layout-critical container must declare its base spacing in custom properties before you wrap.
A 2-state toggle. Sets data-mode="light" vs "dark" on the
<html> element and the artifact's :root selector responds with
two color sets.
If the artifact already has a media-query-based dark mode, replace it with the data-attr version โ the user's choice should win over their OS.
Three settings. Maps to a CSS variable --motion-mult that scales
all transition-duration / animation-duration declarations:
- Off โ
0s(also disables WebGL canvases / decorative animation). - Subtle โ
1.0(the artifact's authored timing). - Lively โ
1.6(slower transitions, more visible motion).
Respect prefers-reduced-motion: default to Off if the user has
that set, regardless of stored preference.
Read assets/wrap.html โ it ships the panel + bridge as an
inert template. Your job is to:
- Take the user's existing artifact HTML.
- Lift its accent / mode / spacing / scale into custom properties
(search for hard-coded
#hex/Npx/Nremand convert). - Paste the contents into the marked region of
wrap.html. - Edit
assets/wrap.html'sKNOBSarray to keep only the knobs you decided are relevant to this artifact. Don't ship 5 if 2 matter. - Patch the
STORAGE_KEYto a unique slug (tweaks-<artifact-slug>).
The bridge in wrap.html:
- Loads
localStorage[STORAGE_KEY]JSON on first paint. - Applies values as
document.documentElement.style.setProperty('--accent', ...). - Listens to every form control's
changeevent and writes back. - Exposes T (toggle panel) and R (reset).
Same options as the critique skill:
- Project file (
index.htmlin the project folder). - Pasted HTML in the chat.
- Generated by you in this turn.
Read the artifact's CSS first. For each knob, decide yes / no:
--accentโ yes if the artifact has 1 accent color used โฅ 3 times.--scaleโ yes if the artifact is type-driven (article, deck, pricing page).--densityโ yes if the artifact has consistent gap / padding rhythm (deck, dashboard, landing). No for runbooks (already dense).--modeโ yes if the artifact has authored dark mode tokens, or you're willing to derive them.--motionโ yes if the artifact has any transition / animation worth scaling. No for static reports / critique reports.
Default: 3 knobs is the sweet spot. Five is too busy, one is not worth a panel.
Open assets/wrap.html's <style> block โ copy its custom-property
naming scheme (--accent, --scale, etc.). In the user's artifact,
find every place those concerns live and rewrite:
color: #c96442โcolor: var(--accent)font-size: 18pxโfont-size: calc(18px * var(--scale))padding: 24px 32pxโpadding: calc(24px * var(--density)) calc(32px * var(--density))transition: opacity 200msโtransition: opacity calc(200ms * var(--motion-mult))
If the artifact uses clamp() or vw already, multiply the
outer value by the custom property โ don't tear apart clamp(...).
Copy the artifact's <style> and <body> into the marked regions
of wrap.html. Keep the panel + bridge intact.
Open the result, click each knob at least once, refresh the page, confirm the choice persists. If a knob breaks the layout โ remove it, don't ship it.
<artifact identifier="tweaks-<artifact-slug>" type="text/html" title="<Artifact Title> ยท Tweaks">
<!doctype html>
<html>...</html>
</artifact>
One sentence before the artifact ("Wrapped X with a 3-knob tweak
panel โ accent / scale / mode."). Stop after </artifact>.
- Don't ship a free color picker โ only curated swatches. Users pick bad colors when given freedom; saving them from that is the whole point.
- Persist by artifact identifier โ
tweaks-<slug>, not a global key. Two artifacts open in two tabs must not share state. - Respect
prefers-reduced-motionโ default to Off for motion if the user has that set, override only on explicit click. - Single-file โ no external CSS / JS / fonts beyond the artifact's existing imports. Inline the panel + bridge.
- Panel hidden by default on viewports < 720px โ slide-in drawer via a "T" button at top-right.
- Don't ship more than 5 knobs. Three is the sweet spot.