/polymorph:polymorph-screenfrom Polymorph
Builds or modifies screens, pages, forms, dialogs, and layouts using the Polymorph design system across React, Vue, Svelte, Solid, Angular, or HTML. Reads system cards, validates against red rules, and renders at multiple widths.
Ships in Polymorph. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Polymorph is a closed vocabulary of interface components, called members, and a set of lint rules, the red rules, that keep design decisions out of application code. The theme decides every colour, size, font and motion. A screen composes members, sets their props and binds content to them.
You reach the tools from a shell. Every command in this skill starts with the same words:
npx -y @metamorph-labs/[email protected] card --framework <framework>
If the session also has an MCP server named polymorph, its tools do the same jobs:
get_system_card for card, search_components for search, get_component for
component, validate, fix, emit_screen for emit and render_screen for render.
Pass the app's framework as framework to every one that takes it. --json on a verb prints the
tool's answer as JSON and nothing else, for a script that reads it. A server started for no
project, as a plugin's is, cannot read the framework from the project, and reads code as React's.
Read package.json and polymorph.json at the project root. A package may be listed under its
published name, @metamorph-labs/polymorph-<name>.
| The project has | The framework |
|---|---|
@polymorph/react-ui | react |
@polymorph/vue-ui | vue |
@polymorph/svelte-ui | svelte |
@polymorph/solid-ui | solid |
@polymorph/angular-ui | angular |
"framework": "elements" in polymorph.json | elements: <poly-*> custom elements in HTML pages with no build |
That is <framework> in every command below. A project that vendors members has their source under
the dir that polymorph.json names, usually src/polymorph/, and imports them from there.
Those files are the vocabulary: do not edit them to make a screen work.
Then look for screen specs: JSON files with "spec": "polymorph-screen/1", usually in
src/screens/, each beside the component emitted from it. If the app has them, write the new
screen as a spec (step 4). Otherwise write it in the framework's own code (step 5).
npx -y @metamorph-labs/[email protected] card --framework <framework>
The card lists every member with its props, the variants and tones each takes, its compound parts
(such as Table.Row), the icon roles, the token families, the red rules and the
exception ladder. polymorph/system-card.md holds the card as it was when the project was set up.
The command answers for the release it names. Read it once when the work starts. For one member
after that, component is shorter and has more.
A member or a prop that is not in the card does not exist. Do not invent one, and do not bring in components from another interface library.
npx -y @metamorph-labs/[email protected] search date picker --framework <framework>
npx -y @metamorph-labs/[email protected] component DatePicker --framework <framework>
search takes plain words and finds members by name, purpose, prop or variant. With no words it
lists every member. component prints one member: each prop with its type and default, the
lawful variant and tone pairs, its states, its parts and what it depends on. A wrong name is
answered with suggestions and exit code 1.
Stack, Inline and Grid and their spacing props
(gap, p, px and py), which take steps of the space scale, never lengths.ListPage, DetailPage or FormPage, or from PageHeader.
A collection of cards goes in a ListPage with body="bare",
because cards do not nest and the body's panel is a card's surface. The picture at the top of a
card or of a detail page is its media (DetailPage's
media).Icon, its name one of the card's icon roles.Text, whose tone and size take the
place of a colour or a font size, and a heading in Heading, whose
level sets its rank.Some screens have a procedure of their own. Read its file before you write the screen:
| The screen | Read |
|---|---|
| Is written in code, or is the container of an emitted spec | references/code.md |
| Needs the app around it: the root's providers, the router, the mode, a form, a toast, a dialog, navigation | references/app.md |
| Holds a conversation with a model | references/chat.md |
| Draws a chart | references/charts.md |
| Takes or shows formatted text, mentions or comments on words | references/rich-text.md |
Three jobs are another skill's: a screen a model writes while the product runs
(polymorph-runtime-screen), an agent on the page that reads and operates the members
(polymorph-agent-bridge), and a SwiftUI or Compose screen (polymorph-native).
The format is in references/screen-spec.md. Check the spec, then compile it into a component:
npx -y @metamorph-labs/[email protected] validate src/screens/inbox.json --framework <framework>
npx -y @metamorph-labs/[email protected] emit src/screens/inbox.json <out> --framework <framework>
validate lists each fault at its path, such as $.root.children[1], with suggestions for a
wrong name, and exits 0 when the spec is lawful. emit validates again, compiles the spec, checks
the output against the red rules, and writes nothing when either fails. <out> is the component
to write, with the framework's extension: .tsx for React and Solid, .vue, .svelte, and
.ts for an Angular standalone component.
The emitted component holds no state and no logic. A container you write renders it, owns the
state, and passes the data and the callbacks the spec declares as inputs.
references/code.md shows one. Never edit an emitted
file: change the spec and emit it again.
Import members from the framework's vocabulary package, or from the vendored directory in a project that vendors. references/code.md has the import line for each framework and a worked screen, and references/app.md what the app wires around it. Then check the file:
npx -y @metamorph-labs/[email protected] validate src/pages/Settings.tsx --framework <framework>
validate takes several files. For a whole directory, use check, which reads each file in its
own framework:
npx -y @metamorph-labs/[email protected] check src
The red rules do not read an HTML page. In an elements project, check a page by reading it
against the card.
Each violation is a line with the file, the position, the rule and its message. Under it are the lawful answers:
fix: a rewrite with exactly one lawful answer. The fix command below applies them.use: the members, props or tokens the message names. A colour, size or spacing becomes a prop
of a member, as component lists them. A clickable <div> becomes a Button. A
glyph from an icon set becomes Icon with a role as its name.climb: the rungs of the exception ladder that answer the rule. When no member, variant or prop
fits, follow the polymorph-rules skill.Apply every rewrite that has one answer, then work through what is left:
npx -y @metamorph-labs/[email protected] fix src/pages/Settings.tsx --framework <framework>
With --dry-run, fix prints the fixed code and writes nothing. Never add an eslint-disable
comment for a polymorph rule. Run validate again until it exits 0.
npx -y @metamorph-labs/[email protected] render src/screens/inbox.json --system plain
npx -y @metamorph-labs/[email protected] render src/screens/inbox.json --system plain --data src/screens/inbox.data.json
render draws a spec in a browser at a phone width (375 by 812) and a desktop width (1440 by
900), and lists the layout faults it measured in each. It writes the pictures into a directory
beside the spec, src/screens/inbox.render/, named for what it drew and the width:
| Drawn | Pictures |
|---|---|
| No data: each input sampled from its type, a list as empty | sampled-phone.png, sampled-desktop.png |
--data <file>: the file's value for each input | populated-phone.png, populated-desktop.png |
--empty <file>: its values laid over --data's, a second drawing | empty-phone.png, empty-desktop.png |
The --data file is sample data for the pictures, which the app never reads: a JSON object keyed
by input name, kept beside the spec (src/screens/inbox.data.json). A callback input takes no
value there, because the page stubs it.
render draws with the shipped themes only. --system names a shipped system, --palette a
shipped palette (the system's own when left out) and --mode light or dark (the system's
default when left out); axes lists them. It reads no theme document of the app's and not
vite.config. Name the shipped pair the app's theme started from: init copies them into
src/theme/ under their shipped names. A change the app made to its theme does not reach the
pictures.
Open the pictures and look at them, then read the faults:
| Fault | What to change |
|---|---|
sideways-scroll | Something is wider than the window. Let an Inline wrap (wrap), move actions into a menu, or use a member built to scroll. |
clipped-text | Text does not fit its box. Shorten it, or give its container room. |
small-target | Controls are too small or too close together. Use a larger size or more space between them. |
cut-off | Content lies where nothing scrolls to it. Change the composition. |
no-gap | Two members touch. Put them in a Stack or Inline with a gap. |
unseen-focus | A control's focus mark is hidden. Do not put the control in a box that clips it. |
Change the composition or a prop to fix a fault, never a style. The first render on a machine
may answer that its browser is missing, with the command that downloads it. Run that command once,
then render again.
render draws specs only. For a screen written in code, run the app and look at it in a browser
when the session can.
npx -y @metamorph-labs/[email protected] check src
check runs the red rules over the directory whatever the project's lint config holds, and exits 1
on any violation. A screen test in a browser reads the faults render lists:
measureLayout from @polymorph/engine/testing measures the
page the test rendered, and focusAfter returns where an
action left focus. check and validate read the red rules and not a prop's type: a value no
member takes, such as a tone it does not have, passes both and fails the typecheck. So run the
project's own lint and typecheck, as package.json names them. Its lint runs the red rules too
only when its ESLint config loads them: it imports @polymorph/rules or spreads the fragment
polymorph.eslint.js that init and add write.
<style> blocks, CSS-in-JS, or a stylesheet import other than a font package's.style, className or css prop, on a member or a plain element, and a class on either
in a framework that writes one. A declared zone lifts this for a plain element (the
polymorph-rules skill).#7c3aed, rgb(), oklch()) or a length (12px, 1.5rem) in a string.<button>, <input>, <select>, <textarea> or <option>, or a click, key or pointer
handler on a <div>, <span>, <li> or <a>.<svg>.--pm-* custom property declared by the app.eslint-disable comment for a polymorph rule.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub metamorph-labs/polymorph --plugin polymorph7 skills in this plugin
/polymorph-agent-bridgeLet an AI agent on a running page read and operate the polymorph members through the agent bridge, instead of scraping the DOM or clicking coordinates. Use when asked to let an in-app assistant or chatbot fill a form or operate a screen, make a page usable by an AI agent or a browser agent, expose a page’s actions as tools for a model, add WebMCP (document.modelContext) tools, keep a field such as a card number or an action such as placing an order from an agent (data-agent-key), ask the person before an agent acts, put data-agent on a page with no build, read the agent segment of the polymorph system card, or drive a page built with polymorph from an agent. Covers @polymorph/engine/agent (createAgentBridge, snapshot, query, act, confirm, the policy, secrets, agentTools, registerWebMCP), @polymorph/engine/webmcp (registerWebMCPOnCall, applyAgentSetting, AGENT_TOOL_DEFINITIONS), one bridge shared by an assistant and WebMCP and loaded on its first use, loadAgentBridge in polymorph.js, and testing a bridge./polymorph-nativeBuild or change a SwiftUI or Jetpack Compose screen with the polymorph design system's native members, or add them to a new or existing iOS or Android app. Use when Swift code imports PolymorphUI or PolymorphTokens, when Package.swift or an Xcode project names github.com/metamorph-labs/polymorph, when a Gradle build depends on com.github.metamorph-labs.polymorph (JitPack) or dev.polymorph and Kotlin imports dev.polymorph.ui, when pubspec.yaml names polymorph_tokens, or when asked to use polymorph on iOS, Android, SwiftUI, Compose or Flutter. Covers the Swift package and JitPack lines, the PM-prefixed names (PMButton, PMBadgeTone, PMDateRange) and where they are declared, the native screen contract (model, actions, a stateless view, four load states), emitting it from a spec, a list screen (ListPage, FilterBar, DataTable) with its store and navigation, installing a pairing with pmTheme or ProvidePMTheme and its fonts, the members and parts a platform adapts or lacks, and checking a screen no lint reads./polymorph-rulesResolve a polymorph red-rule violation, a lint error whose rule starts with polymorph/ such as polymorph/no-raw-styles, polymorph/no-raw-interactive or polymorph/no-app-css, or a design need the polymorph vocabulary does not seem to cover. Use when ESLint, Stylelint, polymorph validate or polymorph check reports a polymorph/ rule, before adding any eslint-disable comment, and when a screen needs a style, a control, an icon, a chart, motion or another library's component that no member provides. Walks the exception ladder rung by rung./polymorph-runtime-screenLet a product answer with real interface while it runs. A model writes a polymorph-screen/1 document, the server checks it with checkAnswer, the page draws it as it streams with ScreenView from @polymorph/react/screen or the <poly-screen> element from @polymorph/elements-ui/screen, and each press or submit becomes an action the product handles. Use when asked for generative UI, to render a model or agent response as components, to let an assistant show a form, a choice or a confirmation, or when code imports @polymorph/screen, runtimeCard, checkAnswer, parsePartial, ScreenView or loadScreen. Covers the members a model may use and refusing links and images, the card and the host’s rules in the system prompt, checking and asking again, drawing the prose and the screen while they stream, actions and values, confirming an action with consequences, and what a request costs./polymorph-setupAdd the polymorph design system to a project, or set up the files a coding agent reads to work with it. Use when asked to start a new app with polymorph, add polymorph to an existing React, Vue, Svelte, Solid or Angular app or to an HTML page, vendor polymorph components into a repository, move to a newer polymorph release, or write the AGENTS.md block, skills and MCP configuration for Claude Code, Codex, Cursor or another agent. It tells a new app, the packages route and the vendoring route apart./polymorph-themeChange how an app built with polymorph looks, its colours, type, density, shape, motion or overall feel, or how it offers light and dark mode. Use when asked to restyle or rebrand a polymorph app, to make it calmer, denser, warmer, darker or more editorial, to pick or adjust a theme, system or palette, to set an exact brand colour or turn a brand's hex colour into a palette's accentHue, to set a font or a type size, to add a dark mode toggle or a more-contrast palette, to edit a system or palette JSON document, when polymorph theme validate or the build reports a theme law, or when tempted to write a colour, font or length in application code. Proposes a theme from plain words, checks it against the theme laws and saves it.Other plugins' skills for the same job