shadcn-ui
它能做什么
这项技能告诉智能体使用应用内置的界面组件和主题,而不是凭外部示例进行猜测。适合在使用 shadcn 风格组件的应用中构建或修改界面的开发者。
适用场景
- ✓当你在应用界面中添加对话框、菜单、表单或按钮的时候。
- ✓当你修改组件外观,需要与主题保持一致的时候。
- ✓当你需要的界面组件,应用可能已经提供的时候。
技能链接
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/shadcn-ui/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在这个界面中添加一个带表单的确认对话框,使用应用已有的按钮和颜色。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体读取应用的组件设置,并使用其现有的变体和主题色。它通过应用的本地封装来引入控件,而不是为了一个界面去改动共享的外观。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
shadcn/ui and Local UI Adapters
Use the components already provided by the app. Read the app's design-system configuration, Toolkit provider, and local UI components before adding or changing a control. Their exports, variants, and props are the contract; do not guess from upstream examples.
Keep imports behind the local adapter
Product pages and domain components should import standard controls through the
app's configured local UI alias. In the Chat starter, that is
@/components/ui/*; its app/components/ui/button.tsx is a one-line
re-export of @agent-native/toolkit/ui/button. Follow an adjacent local shim
when the app needs another Toolkit primitive that is already exported there.
Use the app's configured design system and provider mapping for controls passed
to shared Toolkit surfaces. For shared Toolkit feature presentation, use the
semantic components exposed by @agent-native/toolkit/design-system; keep the
feature behavior in its existing controller and customize only its supported
presentation seam.
Compose existing controls
- Prefer a primitive's built-in variant and size. Put page layout on a parent instead of overriding shared component appearance for one screen.
- Use the app's semantic theme tokens for reusable UI, such as
bg-background,text-muted-foreground,border-border, andbg-primary. Keep theme values in the app's existing CSS theme file. - Use the control that matches the choice:
Switchfor a binary setting,Checkboxfor independent multi-select,RadioGroupfor one choice from a short set, andSelector the app's combobox for a longer predefined list. - Compose cards and form fields from the primitives already available. Avoid
adding explanatory copy that repeats a visible title or label; see
frontend-designfor the app's surface-density rules. - Put selectable items inside their menu or list group primitives. Keep tab triggers inside the tab list. Supply an accessible title to dialog, sheet, drawer, and alert-dialog content.
- Match the trigger API to the actual local component. Toolkit wrappers may
expose a different API from the upstream primitive; inspect its props before
using options such as
asChildorrender.
Keep controls operable
Use the app's existing field components and validation pattern. Associate errors with their inputs and expose invalid state to assistive technology. Icon-only actions need an accessible name and a usable focus target. Use the icon package already installed by the app.
Do not recreate menus, popovers, dialogs, or confirmations with absolute
positioning and custom click-outside handlers. Never use browser alert,
confirm, or prompt; use the app's dialog primitives. Keep overlay focus,
keyboard, dismissal, and stacking behavior from the existing primitive.
For small visual refinements, use layout classes and semantic tokens. Avoid raw
palette overrides, arbitrary one-off values, and manual overlay z-index unless
you are fixing a reproduced bug. Use gap-* for layout spacing and the app's
class-merging helper when it has one.
Related skill
- frontend-design — Product UX, density, visual direction, and responsive behavior.
常见问题
我应该为某个页面覆盖组件的样式吗?
不应该。技能要求把页面布局放在父级上,而不是改变共享的外观。
主题色应从哪里获取?
应从应用的主题标记中获取,例如 bg-background 或 text-muted-foreground。
如果上游示例的外观不同怎么办?
应用自己的导出、变体和属性才是参考依据。
详情
作者的原始描述
Using the app's local UI adapter and Toolkit or shadcn primitives. Use when choosing or composing standard controls, implementing dialogs, menus, or forms, or changing component variants and theme tokens.
repo: BuilderIO/agent-native
热度
- GitHub 星标
- 7.6k
- 排名
- #13183
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …