mastra-frontend
Skill này làm gì
Skill này giải thích cách xây dựng giao diện người dùng bằng hệ thống thiết kế playground của Mastra. Nó hướng agent dùng các thành phần và công cụ bố cục có sẵn, thay vì tự đặt màu và kích thước.
Khi nào nên dùng
- ✓Khi bạn đang xây dựng một trang hoặc thành phần cho ứng dụng Mastra.
- ✓Khi bạn muốn giao diện nhất quán với hệ thống thiết kế Mastra.
- ✓Khi bạn đang thêm bố cục hoặc kiểu dáng vào một ứng dụng dùng các thành phần thiết kế Mastra.
Liên kết skill
https://github.com/mastra-ai/mastra/blob/main/.claude/skills/mastra-frontend/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xây dựng trang cài đặt cho ứng dụng Mastra của tôi bằng các thành phần hệ thống thiết kế hiện có.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent trước hết tìm các thành phần có sẵn phù hợp với công việc, rồi sắp xếp chúng bằng tiện ích bố cục. Nó tránh viết tay màu sắc và phông chữ, vì hệ thống thiết kế đã cung cấp diện mạo.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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/
Câu hỏi thường gặp
Tôi có thể đổi màu không?
Không trực tiếp trong một màn hình. Diện mạo đến từ hệ thống thiết kế, và thay đổi hệ thống là một công việc riêng.
Nếu không có thành phần nào phù hợp thì sao?
Skill khuyên yêu cầu một biến thể mới thay vì ghi đè diện mạo hiện có.
Nó có bao gồm kiểu dáng Tailwind không?
Có. Nó dùng các tiện ích Tailwind cho bố cục, như khoảng cách và kích thước trên các wrapper của riêng bạn.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 29k
- Vị trí xếp hạng
- #9361
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
debugging-difficult-bugs
29kGiúp agent của bạn gỡ một lỗi khó bằng cách ghi nhật ký những gì chương trình thật sự làm lúc chạy, thay vì đoán chỉ từ các bài kiểm thử.
pr-explainer
29kGiúp agent của bạn biến một pull request thành trang HTML độc lập, giải thích thay đổi cho người review một cách rõ ràng.
pr-splitter
29kGiúp agent của bạn chia một pull request lớn, lộn xộn thành nhiều pull request nhỏ dễ review, đồng thời giữ an toàn cho công việc gốc.
ralph-plan
29kGiúp agent của bạn lập kế hoạch một lệnh tác vụ có cấu trúc, rõ ràng qua một cuộc trao đổi ngắn, để công việc có các bước và kiểm tra rõ ràng.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.