跳到正文
Skillpedia
界面(UI/UX)7.6k · #13183

shadcn-ui

它能做什么

这项技能告诉智能体使用应用内置的界面组件和主题,而不是凭外部示例进行猜测。适合在使用 shadcn 风格组件的应用中构建或修改界面的开发者。

适用场景

  • ✓当你在应用界面中添加对话框、菜单、表单或按钮的时候。
  • ✓当你修改组件外观,需要与主题保持一致的时候。
  • ✓当你需要的界面组件,应用可能已经提供的时候。

技能链接

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/shadcn-ui/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/shadcn-ui/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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, and bg-primary. Keep theme values in the app's existing CSS theme file.
  • Use the control that matches the choice: Switch for a binary setting, Checkbox for independent multi-select, RadioGroup for one choice from a short set, and Select or 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-design for 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 asChild or render.

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能