SkillAgentSearch skills...

styling

The design system for MetaMask products

Install / Use

npx skills add MetaMask/metamask-design-system

Installs into whichever agent you are using.

About this skill
📐

Cursor Rules

Cursor IDE rules (v2)

Quality Score

72/100

Category

Design

Supported Platforms

Cursor

Our assessment of styling

styling scores 72/100 on our quality scale, 235th of 257 Design skills we index.

Its Cursor Rules is 9.5 KB long, well organised into 14 sections with 17 code examples: a thorough specification that gives an agent plenty to work with.

It has no GitHub stars yet, so there is no community track record; judge it on its content.

Substance
29/30
Structure
20/20
Description
8/15
Adoption
0/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated 3 days ago, so styling is actively maintained.
  • No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
  • Its trust signals score 80/100, with 2 cautions from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.

Automated pattern scan on 2026-10-26. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.

styling compared with similar skills

All 4 of these similar skills score higher than styling; compare them before choosing.

SkillScoreStarsUpdatedFormat
styling (this skill)by MetaMask7203d agoCursor Rules
taste-skillby Leonxlnx100102.9ktodayCLAUDE.md
designby nextlevelbuilder100137.2k11d agoSKILL.md
ui-ux-pro-maxby nextlevelbuilder100137.2k11d agoSKILL.md
design-isby thedotmack100101.6k8d agoSKILL.md

Frequently asked questions

How do I install styling?
Run npx skills add MetaMask/metamask-design-system. The install tabs above show the steps for each supported agent.
Which AI agents does styling work with?
It is written for Cursor, as a Cursor Rules file. Other agents that read the same format can often use it too.
Is styling safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It declares no license and scores 80/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is styling still maintained?
The repository was last updated 3 days ago, so styling is actively maintained.

Styling

Component styling using design tokens, Tailwind CSS (web), and TWRNC (React Native).

Critical Rules

Component-First Approach

  • ALWAYS use design system components (Box, Text, Button) over raw JSX elements
  • ALWAYS prefer component props over className/twClassName when available
  • ONLY use className/twClassName when no equivalent prop exists

React Web:

// ❌ Wrong
<div className="rounded-lg bg-alternative flex-1 p-4">
  <span className="text-default text-s-body-md">Content</span>
</div>

// ✅ Correct
<Box
  borderRadius={BoxBorderRadius.Lg}
  backgroundColor={BoxBackgroundColor.BackgroundAlternative}
  p={4}
  className="flex-1" // No flex-1 prop exists, so className is fine
>
  <Text variant={TextVariant.BodyMd}>Content</Text>
</Box>

React Native:

// ❌ Wrong
<View style={{ borderRadius: 8, backgroundColor: '#F2F4F6', padding: 16 }}>
  <Text style={{ color: '#24272A', fontSize: 16 }}>Content</Text>
</View>

// ✅ Correct
<Box
  borderRadius={BoxBorderRadius.Lg}
  backgroundColor={BoxBackgroundColor.BackgroundAlternative}
  p={4}
  twClassName="flex-1" // No flex-1 prop exists, so twClassName is fine
>
  <Text variant={TextVariant.BodyMd}>Content</Text>
</Box>

Design Tokens Only

  • ALWAYS use design token generated classes (bg-default, text-error-default)
  • NEVER use default Tailwind colors (bg-blue-500, text-gray-700)
  • NEVER use arbitrary values (bg-[#4459ff], p-[16px]) unless critical
  • ALWAYS use Text component for typography, never Tailwind text classes

React Web:

// ❌ Wrong - Default Tailwind colors and arbitrary values
<div className="bg-[#4459ff] text-white">
  <p className="text-gray-900 text-lg font-medium">Title</p>
</div>

// ✅ Correct - Design tokens and Text component
<Box backgroundColor={BoxBackgroundColor.BackgroundDefault}>
  <Text
    variant={TextVariant.HeadingSm}
    color={TextColor.TextDefault}
  >
    Title
  </Text>
</Box>

React Native:

// ❌ Wrong - Hardcoded values in StyleSheet
<View style={{ backgroundColor: '#4459ff', padding: 16 }}>
  <Text style={{ color: '#ffffff', fontSize: 14 }}>Title</Text>
</View>

// ✅ Correct - Design tokens and Text component
<Box backgroundColor={BoxBackgroundColor.BackgroundDefault}>
  <Text
    variant={TextVariant.HeadingSm}
    color={TextColor.TextDefault}
  >
    Title
  </Text>
</Box>

Platform-Specific Props

  • React Web: Use className for Tailwind utilities
  • React Native: Use twClassName for TWRNC utilities OR useTailwind() hook
  • NEVER mix inline styles with Tailwind classes
  • NEVER import twrnc directly (use design system preset)

React Web:

// ❌ Wrong - Mixing inline styles with className
<div style={{ padding: '16px' }} className="bg-default">
  Content
</div>

// ✅ Correct - Component props + className when needed
<Box
  backgroundColor={BoxBackgroundColor.BackgroundDefault}
  padding={4}
  className="hover:bg-hover active:bg-pressed"
>
  <Text>Content</Text>
</Box>

React Native:

// ❌ Wrong - Mixing StyleSheet with twClassName
<View
  style={[{ padding: 16 }, tw`bg-default`]}
>
  <Text>Content</Text>
</View>

// ✅ Correct - Component props + twClassName when needed
<Box
  backgroundColor={BoxBackgroundColor.BackgroundDefault}
  padding={4}
  twClassName="flex-1"
>
  <Text>Content</Text>
</Box>

Platform Patterns

React Web

Interactive states (hover/active):

<Box width={BoxWidth.Full} className="hover:bg-hover active:bg-pressed" asChild>
  <button onClick={handleOnClick}>
    Clickable content
  <button>
</Box>

className for unsupported props:

<Text
  variant={TextVariant.BodyMd}
  color={TextColor.TextDefault}
  className="mt-4" // margin-top not available as prop
>
  Content with margin
</Text>

CVA Integration (Coming Soon):

Class Variance Authority for managing component variants. See Issue #282

React Native

useTailwind hook from preset:

import { useTailwind } from '@metamask/design-system-twrnc-preset';

const MyComponent = () => {
  const tw = useTailwind(); // Handles theme switching automatically

  return (
    <View style={tw`bg-default p-4`}>
      <Text style={tw`mt-4`}>Content</Text>
    </View>
  );
};

twClassName for Box components:

<Box
  flexDirection={BoxFlexDirection.Row}
  twClassName="px-4 py-4 border-b border-muted"
>
  <Text>Content</Text>
</Box>

Interactive states with Pressable:

<Pressable
  style={({ pressed }) =>
    tw.style(
      'w-full flex-row items-center justify-between px-4 py-2',
      pressed && 'bg-pressed',
    )
  }
>
  <Text>Interactive content</Text>
</Pressable>

NEVER store classes in variables:

// ❌ Wrong - Breaks VSCode Tailwind IntelliSense and linting
const twContainerClassNames = 'flex-1 bg-default p-4';
<View style={tw`${twContainerClassNames}`} />

// ✅ Correct - Use tw.style() for conditionals/props
<View
  style={tw.style(
    'flex-1 bg-default p-4',
    isActive && 'bg-pressed',
  )}
/>

Merging tw.style() with style prop (Array Pattern):

When a component needs to apply Tailwind classes AND accept a custom style prop, use the array pattern for the component's own styles and forward twClassName as a prop:

// ❌ Wrong - Passing style directly to tw.style() causes type errors
style={tw.style('border-l-4 border-primary-default', style)}

// ❌ Wrong - Merging twClassName into style instead of forwarding as prop
style={[
  tw.style('border-l-4 border-primary-default', twClassName),
  style,
]}

// ✅ Correct - Own classes in style, twClassName forwarded as prop
<Component
  style={[tw.style('border-l-4 border-primary-default'), style]}
  twClassName={twClassName}
/>

// ✅ Also correct - twClassName forwarded via props spread
<Component
  style={[tw.style('border-l-4 border-primary-default'), style]}
  {...props} // twClassName passed through to child component
/>

Why this pattern:

  • ✅ Type safety (tw.style only receives the component's own classes)
  • ✅ Clear separation (component styles in style, consumer overrides in twClassName prop)
  • ✅ Consistency with Box foundational pattern
  • ✅ Native-optimized style merging (React Native handles arrays)
  • ✅ twClassName forwarded as a prop is handled by Box internally

Example from BannerAlert:

export const BannerAlert = ({ severity, style, ...props }) => {
  const tw = useTailwind();
  const borderColorClass = MAP_SEVERITY_BORDER[severity];

  return (
    <BannerBase
      style={[tw.style(`border-l-4 ${borderColorClass}`), style]}
      {...props} // twClassName forwarded as prop to BannerBase → Box
    />
  );
};

NEVER import twrnc directly:

// ❌ Wrong
import tw from 'twrnc';

// ✅ Correct
import { useTailwind } from '@metamask/design-system-twrnc-preset';

Commands

# Validate Tailwind classes
yarn lint

# Auto-fix class ordering
yarn lint:fix

Golden Path Examples

Complete examples demonstrating best practices:

  • @apps/storybook-react/stories/WalletHome.stories.tsx (React Web)
  • @apps/storybook-react-native/stories/WalletHome.stories.tsx (React Native)

These examples show:

  • Component-first approach (Box props over className/twClassName)
  • Design token enum usage (BoxBackgroundColor, BoxBorderColor, etc.)
  • className/twClassName only for unsupported features (media queries, hover, flex-1)
  • React Native tw.style() with conditionals (Pressable pressed state)
  • Text component for all typography

Design token reference:

  • @packages/design-system-tailwind-preset/ (React Web token classes)
  • @packages/design-system-twrnc-preset/ (React Native token classes)

Tailwind Preset Content Scanning

Token-identity constants (e.g. TextColor, BoxBackgroundColor) live in @metamask/design-system-shared and their values are used directly as class strings. Tailwind's JIT must scan the compiled output of design-system-shared to generate these utility classes.

Tailwind CSS v3 does not merge content arrays from presets — the consumer's content always wins. This means the preset cannot handle this automatically. Consumers must add @metamask/design-system-shared to their own content glob:

// tailwind.config.js (consumer)
module.exports = {
  presets: [require('@metamask/design-system-tailwind-preset')],
  content: [
    './src/**/*.{js,jsx,ts,tsx}',
    './node_modules/@metamask/design-system-react/dist/**/*.{mjs,cjs}',
    './node_modules/@metamask/design-system-shared/dist/**/*.{mjs,cjs}', // required
  ],
};

Consequences for contributors:

  • ✅ Adding a new token-identity constant to shared → automatically picked up by any consumer already scanning the shared dist
  • ❌ Do NOT rely on the preset's content array to cover design-system-shared — Tailwind v3 ignores preset content
  • ❌ Do NOT add a manual safelist as a workaround — content scanning is the correct approach

Verification

After styling changes, verify:

  • [ ] No raw HTML/JSX elements (div, span, p) with Tailwind classes
  • [ ] Component props used where available
  • [ ] className/twClassName only when no equivalent prop exists
  • [ ] No default Tailwind colors (bg-blue-500, text-gray-700)
  • [ ] No arbitrary values (unless documented as necessary)
  • [ ] No inline styles mixed with Tailwind classes
  • [ ] Platform-specific prop used (className for web, twClassName for native)
  • [ ] Text component used for all typography, not Tailwind classes
  • [ ] React Native: useTailwind from preset, not direct twrnc import
  • [ ] ESLint passes: yarn lint

Related Skills

View on GitHub
GitHub Stars0
CategoryDesign
Updated3d ago
Forks0

Trust signals

80/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

1 medium1 low