mastra-frontend
Fungsinya
Skill ini menjelaskan cara membangun antarmuka pengguna dengan sistem desain playground Mastra. Skill ini memandu agent untuk memakai komponen dan alat tata letak yang sudah ada, alih-alih warna dan ukuran buatan sendiri.
Kapan dipakai
- βSaat Anda membangun halaman atau komponen untuk aplikasi Mastra.
- βSaat Anda ingin tampilan yang konsisten dan sesuai dengan sistem desain Mastra.
- βSaat Anda menambahkan tata letak atau gaya ke aplikasi yang memakai komponen desain Mastra.
Link skill
https://github.com/mastra-ai/mastra/blob/main/.claude/skills/mastra-frontend/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBangun halaman pengaturan untuk aplikasi Mastra saya dengan memakai komponen sistem desain yang sudah ada.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent pertama-tama mencari komponen yang sudah ada dan sesuai dengan tugasnya, lalu menyusunnya dengan utilitas tata letak. Agent menghindari warna dan font yang ditulis sendiri, karena tampilannya sudah disediakan oleh sistem desain.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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/
Pertanyaan umum
Bisakah saya mengubah warnanya?
Tidak langsung di dalam layar. Tampilan berasal dari sistem desain, dan perubahan padanya adalah tugas terpisah.
Bagaimana jika tidak ada komponen yang cocok?
Skill ini menyarankan meminta varian baru, alih-alih menimpa tampilan yang sudah ada.
Apakah mencakup gaya Tailwind?
Ya. Skill ini memakai utilitas Tailwind untuk tata letak, seperti jarak dan ukuran pada pembungkus Anda sendiri.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 29k
- Peringkat
- #9361
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
debugging-difficult-bugs
29kMembantu agent Anda menelusuri bug yang sulit dengan mencatat apa yang dilakukan program sebenarnya saat berjalan, bukan hanya menebak dari pengujian.
pr-explainer
29kMembantu agent Anda mengubah pull request menjadi halaman HTML yang jelas dan mandiri, yang menjelaskan perubahan kepada peninjau.
pr-splitter
29kMembantu agent Anda memecah pull request besar dan berantakan menjadi pull request kecil yang mudah ditinjau, sambil menjaga pekerjaan asli tetap aman.
ralph-plan
29kMembantu agent Anda merencanakan perintah tugas terstruktur dan terfokus lewat percakapan singkat, dengan langkah dan pemeriksaan yang jelas.
Skill serupa
angular-developer
280kMembantu agent Anda membuat kode Angular dan memberi saran struktur proyek. Berguna saat memulai proyek baru, membuat komponen, atau meningkatkan performa.
frontend-a11y
280kMembantu agent Anda membuat antarmuka web dapat diakses semua orang. Memastikan website dan aplikasi berfungsi baik dengan screen reader dan navigasi keyboard.
frontend-patterns
280kMembuat agent Anda menerapkan pola modern dalam frontend. Mengoptimalkan performa, mengelola state, dan mengikuti praktik terbaik React dan Next.js.