Skip to content
Skillpedia
Websites & UI (frontend)29k Β· #9361

mastra-frontend

What it does

This skill explains how to build user interfaces with the Mastra playground design system. It guides the agent to use existing components and layout tools instead of custom colors and sizes.

When to use it

  • βœ“When you are building a page or component for a Mastra application.
  • βœ“When you want a consistent look that matches the Mastra design system.
  • βœ“When you are adding layout or styling to an app that uses the Mastra design components.

Skill link

https://github.com/mastra-ai/mastra/blob/main/.claude/skills/mastra-frontend/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/mastra-ai/mastra/blob/main/.claude/skills/mastra-frontend/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œBuild a settings page for my Mastra app using the existing design system components.”

5 new skills a week. 1 minute to read.

How it works

The agent first looks for existing components that fit the job, then arranges them with layout utilities. It avoids hand-written colors and fonts, because the design system provides the look.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Building Frontend Interfaces

Every Mastra application UI is assembled from the @mastra/playground-ui design system. Building a screen is composition work: pick existing components, arrange them with layout utilities, and let the design system provide the look. Writing colors, font sizes, shadows, or radii by hand means you have left the happy path. Changing the design system itself (tokens, ds/ components, variants) is a separate, explicitly-approved task. For Tailwind v4 mechanics (renames, dynamic utilities, CSS-first APIs), read the tailwind-v4 skill.

The boundary: look vs layout

  • Look β€” colors, typography, radius, shadows, borders, internal padding β€” belongs to the design system. Consumers never restyle it.
  • Layout β€” positioning, flex/grid placement, gap-*, margins, size constraints (w-*, max-w-*, min-h-*, shrink-0) β€” belongs to the consumer, through Tailwind utilities on your own wrappers and, when needed, directly on DS components.

className on a DS component is fine for layout (<DialogContent size="xl" className="h-[80vh]">, where size picks the width and the class only pins the height) and forbidden for look (<Button className="bg-red-500 text-xs">). If a component's look doesn't fit, use its variants and props; if none fit, escalate for a new variant instead of overriding.

Find what exists β€” never guess, never rebuild

  • Components: browse packages/playground-ui/src/ds/components/ (primitives) and src/domains/ (feature components). Check the exports and existing usage before building anything new.
  • Tokens: read the @theme blocks under packages/playground-ui/theme/ (colors, status, data-viz, surfaces, typography, scale, motion), all imported by packages/playground-ui/theme.css, which holds the semantic aliases. The namespace tells you the generated utility: --color-x β†’ bg-x/text-x/border-x, --spacing-x β†’ p-x/gap-x/h-x, --text-x β†’ text-x, --shadow-x β†’ shadow-x, --radius-x β†’ rounded-x. Token names drift β€” confirm them in the file, never use them from memory.

Choosing a class value

Pick the highest rung that fits; each step down needs a reason:

  1. DS component or variant β€” the look you need probably already exists.
  2. Generated theme utility from theme.css.
  3. Dynamic v4 utility when the value maps to the spacing scale (min-w-100, size-6, grid-cols-15).
  4. Local CSS custom property consumed via shorthand, for runtime values scoped to one component (bg-(--row-bg), text-(color:--agent-color-fg)).
  5. Square-bracket arbitrary value only for a justified one-off (max-h-[calc(100dvh-3rem)]).

Theme contract

  • theme.css variables are API: adding one generates utilities for every consumer. Never modify theme.css, its layers in packages/playground-ui/theme/, or packages/playground-ui/src/ds/tokens/*.ts without explicit approval. To request a token: document the use case, explain why a local CSS custom property is not enough, and wait for the design team.
  • Runtime-only or single-component values get a plain CSS custom property (which generates no utility) consumed via bg-(--var) β€” not a new @theme token.
  • When JavaScript needs a theme value, read the CSS variable (var(--color-surface4), getComputedStyle) β€” never resolveConfig or JS token imports for styling.

Wiring

  • packages/playground-ui/components.css is the design system's stylesheet uncompiled: theme.css, the dark variant (@custom-variant dark (&:is(.dark *))), custom utilities, base styles and keyframes. src/index.css is @import 'tailwindcss' plus that file, for the library build. An app with its own Tailwind build imports components.css and sources.css into its sheet instead of style.css.
  • The palette defaults to dark in :root; html.light flips the semantic variables. Theming is automatic through semantic tokens β€” never write dark: color overrides on semantic tokens; reserve dark: for rare structural differences.
  • Build conditional or merged class strings with cn() β€” exported from @mastra/playground-ui for consumers, src/lib/utils.ts inside the package. Its twMerge is extended with the DS scales (src/lib/tw-merge-config.ts), so DS utilities like text-body-sm merge correctly; importing twMerge from tailwind-merge directly mis-merges them.
  • Code inside packages/playground-ui outside ds/ (for example src/domains/) is itself a consumer of the ds/
FAQ

Can I change the colors?

Not directly in a screen. Look and feel comes from the design system, and changes to it are a separate task.

What if no component fits?

The skill recommends asking for a new variant rather than overriding the existing look.

Does it cover Tailwind styling?

Yes. It uses Tailwind utilities for layout, such as spacing and sizing on your own wrappers.

Details

Original description by the author

How to build Mastra frontend interfaces with the @mastra/playground-ui design system. This skill should be used when creating or modifying any application UI β€” pages, components, styling, or tokens β€” in this repo or in an external consumer of the design system. The docs site has its own styling and is out of scope.

repo: mastra-ai/mastra

Popularity

GitHub stars
29k
Ranking position
#9361
License
β€”
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills