ui-development
UI component development standards for MetaMask clients: the strict design-system-first component hierarchy, availability checks before building custom components, styling with design tokens, and required imports. Use when building, restyling, or reviewing any UI component, or when choosing between a design-system, component-library, or custom component.
- License 许可
- MIT
- 所属仓库
- MetaMask/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 25
- Forks
- 11
01 前言 Front Matter
- base
- true
- name
- ui-development
- description
- UI component development standards for MetaMask clients: the strict design-system-first component hierarchy, availability checks before building custom components, styling with design tokens, and required imports. Use when building, restyling, or reviewing any UI component, or when choosing between a design-system, component-library, or custom component.
02 资源文件 3
- 参考文档references/reading-mmds-manifests.md4.6 KB
- 参考文档repos/metamask-extension.md6.0 KB
- 参考文档repos/metamask-mobile.md7.4 KB
03 SKILL.md 正文
MetaMask UI Development — MMDS Guidance
Strategy context: Agentic Design System Strategy
The MetaMask Design System (MMDS) is the default for MetaMask product UI. This base holds the rules shared by every client. The repository overlay below it adds platform paths, the styling surface, and platform-only rules.
When to use
Use this skill when you create, change, restyle, or review UI in a MetaMask client: components, screens, sheets, modals, stories, styles, tokens, themes, and UI behavior. Use it to decide between an MMDS component, a legacy component-library component, a feature component, and custom UI.
Copy and wording rules live in content-guidelines, and file layout and test
setup live in component-scaffold, where the repository has them.
Sources, in order
Work from them in this order. None of these needs an MCP server. The Design Brain step uses a Notion connector when one can reach the MetaMask workspace.
-
Installed package types (
node_modules). The installed version is the contract for the code you are changing. Read the export index and the component's.typesfile (with its JSDoc) undernode_modules/@metamask/<platform package>/dist/. Shared prop and enum types are declared innode_modules/@metamask/design-system-shared/dist/types/. Read them there, but import components and enums from the platform package. When the types disagree with anything else on this list, the types win. -
Hosted Storybook components manifest, for discovery and story snippets:
- React (Extension): https://metamask.github.io/metamask-design-system/manifests/components.json
- React Native (Mobile): https://metamask.github.io/metamask-design-system/react-native/manifests/components.json
The manifests are built from MMDS
main, so they can list components or props that are newer than the version the consumer repo installs. Confirm anything you find there against the installed types before you use it. Storyimportsnippets sometimes pull enums from@metamask/design-system-shared; in product code, import them from the platform package (@metamask/design-system-reactor@metamask/design-system-react-native). How to read a manifest: references/reading-mmds-manifests.md. -
Design Brain, when Notion is available. Query Design Brain — Lessons & Rules for the area you are changing. Apply Active rules (P0 must, P1 should). Treat Proposed rules as guidance only. Cite the rule you applied in the PR or review, and check the Brain for patterns too. Installed types still win on what exists in code. If you have no Notion access, write "Design Brain not checked" in the PR or review. Do not skip it silently.
-
Component README at the installed version's tag. READMEs are not in the npm tarball. Read the installed version from
node_modules/@metamask/<package>/package.json(or the lockfile), then open the README on GitHub at the per-package tag@metamask/<package>@<version>. The packageCHANGELOG.mdcompare links use the same tag names. Never hard-code a release in code comments or skills. -
Existing repository usage and stories. Search the consumer repo for the component or token. Treat examples as usage evidence, not as the contract.
-
Figma MCP and Code Connect, when connected. Use them to read the design and its component mapping. If they are not connected, carry on without them.
Workflow
Create: read the installed types (and README when behavior is unclear) for each building block, choose the component as below, style with preset classes and tokens, then run the review checklist on your own diff.
Review: list the changed UI, check each MMDS usage for deprecation (see Deprecated APIs), then report component choice, deprecated usage, tokens, typography, and accessibility findings with file, line, evidence, and a recommended fix. Say whether Design Brain was checked, or write "Design Brain not checked". Custom UI without a recorded reason is a finding, not an automatic failure.
Choosing a component
- Before building anything, look up the component by name in the manifest and the installed exports. For a pattern, use the first place that has it: Storybook or the manifest docs, then the Design Brain when Notion is available, then the component README at the installed tag, then existing repository usage. Never invent a component, a prop, or a variant, and never port an API from the other platform or another UI library.
- Choose in this order, and record the reason whenever you go past step 1:
- An MMDS component exported by the installed platform package.
- A non-deprecated legacy component-library component, only when MMDS does not cover the need.
- An existing feature component that already solves it.
- Custom UI composed from MMDS primitives and tokens, with the reason recorded in the PR or the repository's exception format.
- Do not invent button or control chrome that MMDS does not have. Keep single-select (checkmark) and multi-select (checkbox) patterns distinct.
- If an MMDS layout makes a primary data point read as secondary, compose a stronger treatment instead of forcing the wrong primitive.
Deprecated APIs
This rule applies to every client. Repository overlays and scaffolds defer to it.
- Do not add new usage of anything marked
@deprecated(a component, prop, or enum value). Use the replacement its JSDoc or README names when the installed platform package exports it, even if the repository still uses the deprecated one. If no replacement is exported, keep existing usage and record the gap. - To check, search the component's whole installed folder:
grep -rn @deprecated node_modules/@metamask/<platform package>/dist/components/<Name>/. The tag is often on the component declaration (<Name>.d.cts), and the.typesfile can omit it. A non-empty manifestjsDocTags.deprecated, or@deprecatedin the README at the installed tag, is the same signal. An emptyjsDocTagsis not evidence that it is current.
Foundations
- Use preset Tailwind classes first for color, type, shadows, motion, spacing,
and radius. Tailwind comes from the MMDS presets configured in the consumer
repo. Use only class names those presets generate, including the 4px spacing
scale (
p-4,gap-2) and the default radii (rounded-lg,rounded-xl,rounded-2xl,rounded-full). Do not use default Tailwind colors. - When Tailwind does not make sense or is not possible (a prop or style
object, a third-party component, a chart, an animation, or a place that
needs a CSS variable or theme value), use a semantic token from the
installed
@metamask/design-tokenspackage, in JS or CSS. No recorded reason is needed. The overlay says how this platform reads one. Read the package README at the installed tag@metamask/design-tokens@<version>. - Never use a raw palette value, a hex value, or an arbitrary value
(
bg-[#...],p-[15px],rounded-[16px],text-[14px],borderRadius: 16). - Meet WCAG AA contrast (normal text 4.5:1, large text and UI graphics 3:1) and check dark mode.
- Layouts must survive longer translated strings and future RTL without clipping or overlap. Avoid fixed-width text boxes.
Typography
- Set type with the design-system text component. Use the font family and variant options the installed types expose, and follow the hosted manifest and the component README at the installed tag for when each applies. Never hand-set font sizes, line heights, or arbitrary text classes.
- Amount inputs have no settled typography pattern yet. Use the font family and variant options the installed types expose, and do not invent a dedicated amount style.
Incremental migration: Legacy* aliases
When a file imports the same name from a legacy source and from the MMDS
platform package, alias the legacy import with a Legacy prefix and keep the
MMDS import on the plain name. Do the same for clashing enums. Leave legacy
imports that have no MMDS counterpart in the same file on their plain names
until that step migrates them. Do not alias legacy names that MMDS does not export, and never put the
prefix on the MMDS import. Finishing the migration is deleting the Legacy*
import and its usages. The overlay gives the platform's import paths and an
example.
Accessibility
A short floor of plain WCAG basics. Design Brain rules are not copied here; read them from the Design Brain source above.
- Every input has a persistent label. A placeholder is not a label. Meaningful icons and icon-only buttons have an accessible name, and decorative icons are hidden.
- Never show state with color alone, and expose that state to assistive tech. Do not nest interactive controls.
- Announce async status and errors. Overlays and sheets manage focus and keep close or back available.
- Respect reduced motion, and meet WCAG AA contrast.
MMDS agent docs
Read these in the MMDS repository instead of copying them into skills:
These track MMDS main. Where they disagree with the installed types, the
installed types win.
Review checklist
- [ ] Installed types were read.
- [ ] Every MMDS building block was checked for deprecation, and the Deprecated APIs rule holds.
- [ ] MMDS was used wherever it covers the need; any step past MMDS has a recorded reason.
- [ ] No invented components, props, or variants, and no cross-platform ports.
- [ ] Preset Tailwind classes first. Where Tailwind does not apply, a semantic token from the installed design-tokens package. No raw palette values, hex, or arbitrary values.
- [ ] Typography uses the design-system text component and the font family and variant options from the installed types.
- [ ] Clashing legacy imports are aliased
Legacy*; MMDS keeps plain names. - [ ] The accessibility floor above holds for the changed UI.
- [ ] Design Brain was checked for the area that changed, or the PR or review says "Design Brain not checked".
04 同仓库更多 Skills
recipe-plan-and-dispatch
Plan a ticket with the engineer before a recipe fix-bug or dev run. Agree the acceptance criteria and an implementation plan, write it as an approved plan file, and print the prompt that starts the run with any agent and model. Never edits product code or starts the run.
recipe-library-audit
Run every recipe of a team recipe library on one client with mm-harness, classify each result with the failing node and exact error, and review naming and composability. Produces a per-client table; changes nothing.
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
x402-payments
Build x402 payment flows using MetaMask Smart Accounts Kit, machine to machine payments over HTTP with ERC-7710 delegations and ERC-7715 Advanced Permissions
smart-accounts-kit
Build dApps with MetaMask Smart Accounts Kit — ERC-4337 smart accounts, delegations, and Advanced Permissions (ERC-7715)
oh-my-opencode
Multi-agent orchestration plugin for OpenCode. Use when the user wants to install, configure, or operate oh-my-opencode — including agent delegation, ultrawork mode, Prometheus planning, background tasks, category-based task routing, model resolution, tmux integration, or any oh-my-opencode feature. Covers installation, configuration, all agents (Sisyphus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus), all categories, slash commands, hooks, skills, MCPs, and troubleshooting.