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.mdCopy 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
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
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) andsrc/domains/(feature components). Check the exports and existing usage before building anything new. - Tokens: read the
@themeblocks underpackages/playground-ui/theme/(colors,status,data-viz,surfaces,typography,scale,motion), all imported bypackages/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:
- DS component or variant β the look you need probably already exists.
- Generated theme utility from
theme.css. - Dynamic v4 utility when the value maps to the spacing scale (
min-w-100,size-6,grid-cols-15). - Local CSS custom property consumed via shorthand, for runtime values scoped to one component (
bg-(--row-bg),text-(color:--agent-color-fg)). - Square-bracket arbitrary value only for a justified one-off (
max-h-[calc(100dvh-3rem)]).
Theme contract
theme.cssvariables are API: adding one generates utilities for every consumer. Never modifytheme.css, its layers inpackages/playground-ui/theme/, orpackages/playground-ui/src/ds/tokens/*.tswithout 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@themetoken. - When JavaScript needs a theme value, read the CSS variable (
var(--color-surface4),getComputedStyle) β neverresolveConfigor JS token imports for styling.
Wiring
packages/playground-ui/components.cssis the design system's stylesheet uncompiled:theme.css, the dark variant (@custom-variant dark (&:is(.dark *))), custom utilities, base styles and keyframes.src/index.cssis@import 'tailwindcss'plus that file, for the library build. An app with its own Tailwind build importscomponents.cssandsources.cssinto its sheet instead ofstyle.css.- The palette defaults to dark in
:root;html.lightflips the semantic variables. Theming is automatic through semantic tokens β never writedark:color overrides on semantic tokens; reservedark:for rare structural differences. - Build conditional or merged class strings with
cn()β exported from@mastra/playground-uifor consumers,src/lib/utils.tsinside the package. ItstwMergeis extended with the DS scales (src/lib/tw-merge-config.ts), so DS utilities liketext-body-smmerge correctly; importingtwMergefromtailwind-mergedirectly mis-merges them. - Code inside
packages/playground-uioutsideds/(for examplesrc/domains/) is itself a consumer of theds/
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
Comments
- β¦
More skills from this repository
debugging-difficult-bugs
29kHelps your agent debug a hard bug by logging what the real program does at runtime, instead of guessing from tests alone.
pr-explainer
29kHelps your agent turn a pull request into a clear, self-contained HTML page that explains the change to reviewers.
pr-splitter
29kHelps your agent break a large, messy pull request into smaller, reviewable pull requests while keeping the original work safe.
ralph-plan
29kHelps your agent plan a focused, structured task command through a short back-and-forth, so the work has clear steps and checks.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.