跳到主要内容

artifact-design 精选

Design guidance and fundamentals for Artifacts.

在 GitHub 打开

安装方式

cp -r Anthropic/claude-code/skills/artifact-design ~/.claude/skills/artifact-design

把该 skill 目录放进客户端 skills 目录。不同客户端的目录可能不同,Claude Code 默认是 ~/.claude/skills/

整仓一次性获取:git clone --depth 1 https://github.com/asgeirtj/system_prompts_leaks.git

依赖与权限

  • 无需 API Key
  • 需要联网访问外部服务
  • 依赖外部命令:npm go make
  • 以上为按正文与 frontmatter 自动推断的信号,仅供参考;安装前建议先阅读原文。
触发场景
Load before writing any artifact, including a skill-instructed Markdown one - Markdown is never a shortcut past the design pass.

SKILL.md 正文

来源 asgeirtj/system_prompts_leaks@a09e0e7 · 许可 CC0-1.0 · 内容未修改

Page contract — read before your first publish

These are the Artifact tool's own rules for the file you publish; the design guidance below builds on them.

Format: Always author the page as .html. Publish a .md file only when a loaded skill explicitly instructs it. When the user shares a markdown document or asks to turn one into an artifact, author an HTML page based on its content — preserve its substance, and design the page as you would any other artifact rather than transcribing the markdown one-to-one.

Skeleton: The file is wrapped in a <!doctype html>…<head>…</head><body> skeleton at publish time, so write the page content directly — no <!DOCTYPE>, <html>, <head>, or <body> tags of your own. Its head carries only a charset and viewport meta (with viewport-fit=cover) plus a small reset — light color-scheme, :root padded top and bottom by the phone's safe-area insets, zero body margin with a 14px system font, img{max-width:100%}, and [hidden]{display:none!important} (toggle visibility with el.hidden, not style.display) — so put your own <title> and <style> at the top of the file. Keep the :root padding: a bar fixed to the top or bottom stays at 0 and adds env(safe-area-inset-top, 0px) or env(safe-area-inset-bottom, 0px) to its own padding, and a sticky page header uses top: env(safe-area-inset-top, 0px), not 0.

Title: Put a <title> at the top of the HTML; only the first 8KB of the file is scanned for it. It is the artifact's name in the browser tab and the gallery, so write a name, not a summary: a short noun phrase, typically two to four words, specific enough to pick this page out among many, the way an app or a document is named. When the user already has a specific name for the thing, use that name for the title rather than coining a new one. Never use a generic category label alone, and never append an explainer after a dash or colon. If you shorten a title that pairs the name with a generic word, keep the name, not the generic word. A multi-word title that already reads as one specific name is finished; do not shorten it further. The explanation goes in the one-sentence description parameter, which becomes the gallery card's subtitle. The title parameter fills in only when an HTML file has no <title> tag (Markdown pages keep their filename). Keep the title stable across redeploys.

External resources — CDN allowlist (CSP-enforced): external scripts load ONLY from https://cdnjs.cloudflare.com (preferred), https://cdn.jsdelivr.net/npm/, https://unpkg.com, https://cdn.tailwindcss.com (Tailwind's play-CDN script) and https://code.jquery.com; external stylesheets ONLY from https://fonts.googleapis.com, with the font files they pull from https://fonts.gstatic.com (give every face a real fallback stack). Everything else is blocked, with no visible error: every other host (esm.sh included) and, even on those CDNs, anything but a script — stylesheets, images, media, fetch/XHR/WebSocket, a library's runtime fetches. So inline all other CSS and JS and embed assets as data: URIs. How to load a library: <script src="https://cdnjs.cloudflare.com/ajax/libs/<lib>/<exact version>/<file>"> — pick the UMD build, which defines a global (e.g. react/18.3.1/umd/react.production.min.js, then react-dom) — placed BEFORE any inline <script> that uses it. Pin every library URL to an exact version ([email protected] on jsDelivr or unpkg, react/18.3.1/… on cdnjs, cdn.tailwindcss.com/3.4.17), never a bare name, a range or a tag (react, react@18, @latest). Choose a version at least two weeks old. Any version you knew before this conversation is old enough; if you look versions up, skip any published in the last two weeks. The viewer's sandbox also blocks any download the page starts itself — <a download> links (data:/blob: hrefs included) and script-driven saves are inert for viewers — so never offer a file through a plain link. Links to other websites (https://…) open in a new tab, but email, phone and app links (mailto:, tel:, sms:, other custom schemes) are unreliable inside an artifact: for many viewers (for example anyone outside the user's organization, or anyone viewing through a public link) following one, by link or by script, often does not work, and the page cannot tell whether it did. So show the address or number itself as selectable text (a copy button helps), treat such a link as a convenience that may do nothing, and never tell the viewer a message was sent or a call placed because the viewer tapped one. Artifacts render mermaid diagrams natively — markdown via ``mermaid fences, HTML via <pre class="mermaid"> blocks — no library needed, don't load one. The viewer never shows alert(), confirm() or prompt() dialogs — confirm() returns false and prompt()` returns null immediately — so build any confirmation step into the page itself.

What the viewer's frame allows: The page runs in a locked-down frame; what it refuses below, it refuses for every viewer (anonymous, signed-in, embedded, desktop and mobile apps), so build around these limits instead of detecting them. The page cannot open the print dialog — window.print() does nothing — so never offer a Print or "Save as PDF" button. Forms work as page UI (inputs, validation, submit events), but a real submission has nowhere to go: handle submit in script with preventDefault() and never point action at another site or a mailto: address. Copy buttons work when navigator.clipboard.writeText is called inside the click handler — catch its rejection (older desktop apps and some app views refuse it) and fall back to selecting the text; reading the clipboard never works, though the viewer's own Paste (the paste event) does. Camera, microphone, screen capture, location, motion, Web Share and similar device APIs are refused without a prompt — build on one only when this user has a runtime capability for that device (the artifact-capabilities skill lists them) and the page declares it; otherwise take photos, audio and data as uploaded files instead (file inputs, drag-and-drop of files and FileReader work in browsers). A screen wake lock may be granted while the page is visible: request it and tolerate rejection. Fullscreen and pointer lock work from a click in desktop browsers; treat both as optional (handle the rejection) since phones and some app views lack them. Sound plays only after the viewer interacts (muted autoplay is fine), so start audio from a button. Other sites cannot be embedded — no YouTube, map or form iframes, and no <object>/<embed>; link out instead: links open outside the artifact, normally in a new tab, while window.open works only for some signed-in viewers in the artifact's own organization and returns null for everyone else, so use real <a href> links. Web Workers work from your own files or blob: URLs; service workers and WebRTC do not. fetch() of files published alongside the page works with relative URLs; images from your own files, data: or blob: URLs draw to canvas and export cleanly. Only a plain #anchor (letters, digits, . _ ~ -) from the artifact's link reaches location.hash — never #key=value state and never the query string — so deep-link to a tab or section with a bare token and keep all other state in the page.

Browser storage: localStorage (also sessionStorage and IndexedDB) works, but each artifact has its own origin and the data lives only in that viewer's browser — it survives republishes to the same URL and never reaches other viewers, other devices, or Claude. It can come back empty or the accessor can throw (a private window, cleared or blocked site data, previews or thumbnail capture), so wrap every read and write in try/catch and render the page correctly without it. Use it only for per-viewer conveniences (a remembered tab or filter, a collapsed section, an unsent draft), never for state that must persist reliably, be shared between viewers, or be read back by Claude — state like that belongs in a runtime capability when this user has one: load the artifact-capabilities skill before writing the page.

Size: The rendered page must be 16MB or smaller, and embedded data: URIs count toward that.

Responsive: The page must also work at phone width (about 400px), and the page body must never scroll horizontally. Keep a side gutter of at least 16px at every width: set it once as side padding on body or one outer wrapper, and give that element its vertical padding with padding-block, never a padding shorthand that zeroes the sides. Use relative units. Let flex and grid rows wrap or stack to one column when narrow, and give any flex or grid child that holds running text, code or a table min-width: 0, so long content wraps or scrolls inside it instead of pushing the page wider. Put max-width: 100% on images and on any aspect-ratio box, and give nothing a min-width wider than the screen. Only tables, diagrams and code blocks may be wider, each inside its own overflow-x: auto container.

Theme-aware: The page renders in the viewer's theme, which has three states: an explicit choice sets data-theme="dark" or data-theme="light" on the root element, and the default "system" setting sets nothing, so for most viewers only prefers-color-scheme tells light from dark. Define every color as a token, in this shape (token names and count are the design's own):

:root { --bg: …; --fg: …; --accent: … }  /* every token, light values */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: …; --fg: …; --accent: …; color-scheme: dark } }
:root[data-theme="dark"] { --bg: …; --fg: …; --accent: …; color-scheme: dark }  /* same dark values, so the toggle wins both ways */
body { background: var(--bg); color: var(--fg) }

Every token gets its first definition on bare :root; the two dark blocks only redefine tokens, and their color-scheme: dark makes form controls and scrollbars follow. No color has its only definition inside a media or [data-theme] block, and no component rule uses a literal color that reads in one theme only. body keeps that explicit token background: the viewer paints its own ground behind the page, so a transparent body shows the host's theme instead. A dark-first design mirrors the whole shape, selectors included: dark values and color-scheme: dark on bare :root (the skeleton pins light there), light values and color-scheme: light under (prefers-color-scheme: light) guarded :root:not([data-theme="dark"]) and again under :root[data-theme="light"]. A design that deliberately commits to a single look may drop the two dark blocks but still sets the background and every color explicitly, plus color-scheme: dark on :root if that look is dark.

Icon (on every first publish): Pass one short generic word as icon (e.g. "chart", "calendar", "recipe") for the artifact's browser-tab icon — a plain signifier for what the page is, never a product or brand name, and never an emoji or markup. It stays the same for the life of an artifact, so on a redeploy (the same file path this session, or url) omit icon and the artifact keeps the one it has; pass a different one only when the user asks.

Work the way the design lead at a small, versatile studio would: give each client a visual identity at the level of treatment the task calls for. Make deliberate choices about palette, typography, and layout that are specific to this subject, and avoid templated designs.

Read the request first

Decide the treatment; designing is a given. A doc gets the same craft as a landing page; only the treatment differs. Format is a separate matter: author HTML, and publish Markdown only when a loaded skill explicitly instructs it. A Markdown publish keeps its filename as its title, uses almost none of the craft below, and is never a way to save time.

Many requests call for a more utilitarian treatment: a plan, a memo, a demo. Make it polished, with real typographic hierarchy, considered spacing, and a proper palette, but avoid over-designing. Most pages don't need a flashy, gigantic hero. Keep flourishes tasteful and limited.

Some requests call for an editorial treatment: a landing page, a game, an app or tool they'll keep or share.

If unsure: a well-composed page is always acceptable; an over-designed visual identity sometimes isn't.

Fundamentals below apply to everything. Follow the editorial process after them only when that reading calls for it.

Fundamentals for every artifact

Respect what already exists. Look for an existing design system first: CLAUDE.md, a tokens or theme file, existing component styles. When one exists, apply it; everything below fills gaps and never overrides. Precedence is always the user's own words, then the project's existing system, then your choices.

Ground it in the subject. If the subject isn't already clear, define it: one concrete subject, its audience, and the page's single job. Distinctive choices come from the subject's own world: its materials, instruments, and vernacular. Whatever the treatment, include at least one detail only this subject would have (its real units and scales, its document conventions, its terms of art) as content rather than ornament; it costs nothing even on a plain page. Use real content throughout and never lorem ipsum.

Pair typefaces. Typography determines how the page reads even when the page isn't about typography. Google Fonts is the only font host the Artifact CSP allows; link it directly (<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=...&display=swap">). A face from anywhere else must be inlined as a @font-face data URI, or the browser silently uses a fallback. In both cases, declare a real fallback stack. Keep running text near 65 characters wide. Set a type scale and keep to it. Give headings text-wrap: balance, give body text comfortable spacing, and give uppercase labels a little letter-spacing.

Load libraries instead of inlining them. When the page really needs a library (React, a charting or highlighting package), load its UMD build from cdnjs with one <script src="https://cdnjs.cloudflare.com/ajax/libs/...">, pinned to an exact version at least two weeks old and placed before the inline script that uses its global; don't inline the library's source or hand-write a substitute. Only the script loads this way; a library's stylesheet still has to be inlined, and the page contract above lists the few other script hosts the CSP admits. The page's own CSS and JS, its images, and its data ship with the page. Most pages don't need any library; use one only when it does substantial work for the page.

Choose neutrals deliberately. A pure mid-grey looks unconsidered; a grey with a slight hue bias toward the page's accent looks intentional. Pure white and near-black are fine backgrounds when they suit the subject, as long as you chose the neutral deliberately instead of inheriting a default.

Design both themes. The page renders in the viewer's theme, and the viewer has three states: an explicit choice sets data-theme="dark" or data-theme="light" on the root element, and the default "system" setting sets nothing. Most viewers see the document with no data-theme attribute, where only prefers-color-scheme distinguishes light from dark. Structure the CSS at the token level for all three. The bare :root block defines the complete light palette (for a deliberately dark-first design, swap light and dark consistently through this whole pattern); @media (prefers-color-scheme: dark) redefines only the tokens, guarded as :root:not([data-theme="light"]) so an explicit light choice overrides a dark OS setting; :root[data-theme="dark"] redefines them again so the toggle also overrides in the other direction; wherever the dark palette applies - both dark blocks, or bare :root in a dark-first or single-dark design - also set color-scheme: dark (the skeleton pins light on :root), so native form controls and scrollbars follow the palette. Style components through the tokens, never directly inside a media or [data-theme] block: a color defined only inside [data-theme] never applies when no data-theme attribute is set, and the page then shows one theme's text on the other theme's background. Two more rules keep each theme consistent. First, the artifact is composited over a background the viewer paints in its own theme, so body must set an explicit background from a token; a transparent body shows the host's background with no warning. Second, every element that sets a color takes it from the same token set as the surface behind it, never from a literal that works in only one theme. Declare every token in the bare :root block before any media or [data-theme] block redefines it; a color that exists only inside one of those blocks is the classic unreadable-artifact bug. Give the second theme the same care as the first: don't simply invert it; keep contrast legible and keep the accent working on both backgrounds. A design that deliberately commits to one visual world (a neon arcade screen, a letterpress invitation) may stay single-theme: then omit the media query and [data-theme] blocks entirely but still set the background and every color explicitly, so the page looks right on either host background; do this by choice, never by omission.

Use layout for spacing. Lay out sibling groups with flex or grid and gap instead of per-element margins, which collapse or double without warning. Keep a side gutter of at least 16px at every width: set it once as side padding on body or one outer wrapper, whose vertical padding uses padding-block and never a padding shorthand that zeroes the sides. Let rows wrap or stack to one column at phone width (about 400px). Give images and any aspect-ratio box max-width: 100%, and don't give anything a min-width wider than the screen. Only wide tables, code, and diagrams may exceed it; give each overflow-x: auto on its own container so the page body never scrolls sideways. The publish skeleton pads :root top and bottom by the phone's safe-area insets (zero everywhere except a phone app) so the page runs edge to edge while its content stays clear of the system bars; keep that padding. A bar fixed to the top or bottom stays at 0 and adds env(safe-area-inset-top, 0px) or env(safe-area-inset-bottom, 0px) to its own padding. A sticky page header uses top: env(safe-area-inset-top, 0px) and never 0. Size a one-screen app with height: 100% on html and body instead of 100vh, so it fits inside that padding. A page that includes its own viewport meta gets this padding only when that meta declares viewport-fit=cover. Use font-variant-numeric: tabular-nums wherever digits line up in columns.

Make repeated elements consistent. For cards in a row, label/value pairs down a list, or badges on sibling items, use the same edges, baselines, and inner padding on each, and put any recurring element in the same place on each. Let content set a container's height and pick a column count the items fill, so nothing stretches over empty space or sits alone in a row. Make text that can outgrow its track wrap or scroll in its own container; clipped text is a bug.

Use card styling selectively. Border, fill, radius, and shadow each mark an element as a separate object. Apply them by role, to set off the one element that needs it; applying the same radius and shadow to every block flattens the hierarchy. Open with big-number tiles only when those figures are the point of the page.

Draw charts to scale. Place marks, ticks, and labels with one scale, and make every label name a value the chart actually reaches. Color chart text from the theme tokens so it is readable in both themes. Keep marks, labels, and edges clear of one another and inside the drawing's bounds; in SVG, leave room in the viewBox for the outermost labels and give every drawn shape an explicit fill.

Make the page complete at rest. Everything meant to be read is visible once the page has loaded, with no scrolling to trigger it; that first still frame is what a thumbnail, a shared link, and a skimming reader all see. A section may animate in, but from a visible resting state, never left at opacity: 0 waiting for an observer. Size a hero to its content instead of to the viewport; a 100vh opener pushes the rest of the page out of that first frame. A tool or app opens in a realistic working state: the user's real data where it exists, otherwise example rows, a loaded sample, or a plausibly filled form, clearly marked as examples and never presented as the user's own figures. The first view shows what the tool does; an empty shell waiting for input shows nothing. When those records live in the db capability, keep them out of the page source. Its first frame renders before the store answers, so make that frame a designed empty state that names what will appear and how to add the first entry, then fill it from the store. Seed the store through the ArtifactData tool (what type instructions call write_db) after the first publish: the user's real data, or marked examples for a tool only the user will use. For a store other people will fill with their own entries, seed only what the user gave you or asked for, never invented people or records.

Avoid AI-generated design. AI-generated design currently clusters around a few looks: warm cream (#F4F1EA) with a serif display and terracotta accent; near-black with a lone acid-green or vermilion pop; broadsheet hairline rules with dense columns; a purple-to-blue gradient hero on white; Inter or Space Grotesk as the "safe" face; emoji as section markers; everything centered; rounded-lg everywhere; accent bar/rail on rounded cards. When the user specifies a visual direction, follow it exactly; their words always win, including when they ask for one of these looks. When nothing is specified, don't use that freedom on one of these defaults.

Build cleanly. Watch for overlapping elements, cascade collisions, and silent font fallbacks. Close every non-void element, double-quote attributes, give keyboard focus a visible state, and respect prefers-reduced-motion. Give every form control a stable id (the platform preserves form values, focus, and scroll position across a republish). For generative or decorative graphics, use Canvas or WebGL instead of hand-writing long SVG path data.

CSS rules. When writing the CSS, watch your selector specificity. It is easy to generate classes that cancel each other out, e.g. a type-based selector like .section and an element-based one like .cta both setting padding and margins between sections. Structure the cascade so it doesn't undo your spacing unnoticed.

Writing the copy. Treat words as design material and never as decoration. Write from the user's side of the screen: name things by what people recognize instead of how the system is built (a person manages notifications; they don't manage webhook config). Use active voice; a control states exactly what happens ("Publish", then a toast that says "Published"). Errors explain what went wrong and how to fix it, without apologies or vagueness. Prefer specific to clever. Write plainly, the way a knowledgeable person would talk. Avoid mannered devices: asides set off by em-dashes, "not X, but Y" framing, colon-then-reveal sentences, scare quotes around invented labels, and stock phrases such as "worth noting" or "honest caveat". Prefer short, direct senten

质量与来源

所属仓库
asgeirtj/system_prompts_leaks
仓库星标
6.9 万
最近更新
今天
采集时间
今天
commit
a09e0e708710
内容指纹
sha256:e8cb621cc691289
文件路径
Anthropic/claude-code/skills/artifact-design/SKILL.md

同仓库其它 Skill

查看全部 48 个
dashboard
Use this for a dashboard, metrics page, KPI tracker, scorecard, data visualization or recurring report: a page or scroll story of charts, numbers and tables of data, whatever the data and wherever it comes from. Read it when creating, filling, refreshing or revising one. You write datasets (a live query on a connector, or an attached CSV/TSV/JSON file), then the page as plain HTML, in the dashboard's own store.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
design-system
How to create and revise a design system made from the Design System appifact type: its files under project/, the exact shapes and size caps, the order to write in, how to change one later, and the checklist.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
design
How to fill and revise a canvas made from the Design (canvas) appifact type.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
pages
The shared Claude Docs viewer — an artifact TYPE. An artifact made from it is a doc: a live document that people and Claude read and edit together (people may also call it a page). The doc's content does not live in this artifact's files at all — it lives in the Claude Docs service and is read and written ONLY through the Claude Docs connector (its create, batch, read and update tools). Read this before touching such an artifact: it says what the files are, that an instance owns none of its own, how to change what the doc says (the connector, never a publish), and where a comment on the doc — including one sent to you from it — is read and answered (the connector's comment verbs; never these files, never the artifact's comment relay).
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
slides
How to fill and revise a deck made from the Slides appifact type.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor
deep-research
Use this skill when the user's prompt requires (1) researching a topic across multiple sources, comparing options or alternatives, analyzing trends or history, understanding markets or industries, or reviewing literature or studies and (2) synthesizing that research into a comprehensive, narrative report. If you're planning to search the web or internal knowledge bases, consider using this skill. This skill coordinates research subagents, so use it only when you have a tool for spawning subagents (the Agent or Task tool); otherwise, research the question directly.
精选 asgeirtj/system_prompts_leaks 6.9 万 原文
Claude CodeCodex CLICursor

相似 Skill

更多「编码」
access
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how do I set this up" or "who can reach me," or wants to check channel status.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
access
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the iMessage channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Check iMessage channel setup and review access policy. Use when the user asks to configure iMessage, asks "how do I set this up" or "who can reach me," or wants to know why texts aren't reaching the assistant.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
access
Manage Telegram channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Telegram channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Set up the Telegram channel — save the bot token and review access policy. Use when the user pastes a Telegram bot token, asks to configure Telegram, asks "how do I set this up" or "who can reach me," or wants to check channel status.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端