agentleFS
mkusakamkusaka/ccskills/skills/artifact-design-page-contract/SKILL.md

artifact-design-page-contract

Skill9 starsChanged 6 days agoMITView on GitHub

Defines the Artifact page contract that opens the artifact-design skill: publishing skeleton, allowed script and font sources, sandboxed browser APIs, responsive layout, theming and the single-check authoring workflow

The file

Files
SKILL.md

Page contract

Author HTML (a .md file only when a loaded skill says so). The file is wrapped in a doctype/html/head/body skeleton when published (charset, viewport-fit=cover, color-scheme light, zero body margin, 14px system font, safe-area padding on :root, img{max-width:100%}, [hidden]{display:none!important}, so toggle with el.hidden, not style.display), so write only the content: <title>, <meta name="claude:viewport-fit-sides" content="cover">, font links, <style>, markup, <script>. Under 16MB. Put any dataset over about 100KB beside the page as a .csv file, or a .json file of one array with a record per line, and fetch() it by relative URL, since whoever changes the page next usually reads all its HTML. The title is a two-to-four-word name for this page, specific enough to find among many, with no explainer after a dash or colon; use the person's own name for it if they gave one, and keep it across republishes. The one-sentence explanation goes in description; on first publish pass one generic word as icon, never a brand or emoji.

Loading: scripts only from cdnjs.cloudflare.com (preferred), cdn.jsdelivr.net/npm/, unpkg.com, cdn.tailwindcss.com, code.jquery.com, as UMD builds pinned to an exact version at least two weeks old (any you already knew is old enough), placed before the script that uses them; stylesheets only from fonts.googleapis.com (give each face a fallback). Everything else is silently blocked: remote images, fetch to other hosts, iframes, maps, a library's own CSS. Inline it or use data: URIs. <pre class="mermaid"> renders natively.

The sandbox ignores alert/confirm/prompt, print, downloads, clipboard reads, camera, microphone, location, motion, Web Share, service workers and WebRTC; don't offer them (file inputs and drag-and-drop work). Build confirmations into the page. Handle form submit in script with preventDefault(). Link out with plain <a href>, not window.open. tel:, sms: and mailto: may do nothing, so show the number or address as text too, and never say a message was sent. Clipboard writes, audio, fullscreen and pointer lock need a click; catch failures. localStorage is one viewer's, may throw or be empty: try/catch, render without it, conveniences only. Only a plain #name survives in the URL; route on it only for views worth linking (letters, digits, hyphens; never settings, sidebar, customize, upgrade, downloads or comment-*), on load and hashchange, and keep keys and private values out. Give form controls stable ids. If viewers have state to lose (a game, a long form), register window.claude?.hot?.snapshot(()=>state) with plain JSON state and boot with window.claude?.hot?.ready?window.claude.hot.ready(start):start(window.claude?.hot?.data??{}).

It must work at 400px wide, and beside a chat at about 700px, with no sideways page scroll: side gutter of at least 16px written padding-left:max(5vw,16px,env(safe-area-inset-left,0px)) and the same on the right, on body or each band's inner wrapper (the meta tag above promises both; vertical padding via padding-block); min-width:0 on grid and flex children holding text; every table, code block and wide diagram sits in its own overflow-x:auto wrapper. Anything fixed to an edge adds that edge's env(safe-area-inset-*) to its padding; a sticky header uses top:env(safe-area-inset-top,0px) with a fixed body::before of that height painting the band above it. One-screen apps use height:100% on html and body, not 100vh.

The viewer's theme is data-theme="dark" or "light" on the root, or nothing (then prefers-color-scheme decides); the page must read well in all three, with an explicit body background. Everything meant to be read is there at load, with nothing waiting for a scroll to reveal it; a tool opens in a realistic working state with the person's data or marked examples.

If the page must take input others see, keep data, show live data, use a device or call Claude, load the artifact-capabilities skill first; records kept in db stay out of the source, the first frame is a designed empty state instead of a working one, and you seed only what the person gave or asked for. If the person or project has a design system, use it. Write, look at most once with ArtifactCheck or the preview action where offered (take the look for real charts or declared capabilities; one run of a pure function if logic is the point; one read-back of stored data after publishing), fix once, publish; no loops. Say at most one plain sentence about the design.

An edit of an existing page keeps its look and its theme code, and adds the viewport-fit-sides tag only together with both paddings; the plan and the cards below are for a new page or a restyle the person asked for. A Markdown publish, or content filled into an Artifact type, follows its own skill or type and uses little of what follows.

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.