shadcn-component-discovery by mattbx/shadcn-skills
npx skills add https://github.com/mattbx/shadcn-skills --skill shadcn-component-discovery别再重复造轮子了。在构建自定义组件之前,先搜索 1500+ 个现有的 shadcn 组件。
在构建之前,务必先搜索。 shadcn 生态系统几乎为所有需求都提供了组件。一次 5 秒钟的搜索可以节省数小时的开发时间。
在编写组件代码之前激活此技能,当:
当用户说出类似以下内容时激活:
/find-component、/discover、/search-shadcn在搜索之前,先明确:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
配置了 shadcn MCP 时(推荐):
1. mcp__shadcn__search_items_in_registries
- registries: ["@shadcn", "@animate-ui", "@diceui", "@blocks", "@reui"]
- query: [搜索词]
- limit: 10
2. 对于有希望的结果,获取详细信息:
mcp__shadcn__view_items_in_registries
- items: ["@registry/component-name"]
3. 获取代码示例:
mcp__shadcn__get_item_examples_from_registries
- query: "component-demo"
4. 获取安装命令:
mcp__shadcn__get_add_command_for_items
- items: ["@registry/component-name"]
没有 MCP 时:
根据上下文选择响应格式:
在构建前主动检查时使用。最小化干扰。
在构建自定义 [组件] 之前,我发现了以下现有选项:
1. **@registry/component-name** - [简要描述]
2. **@registry/other-option** - [简要描述]
→ 安装其中一个,还是构建自定义组件?
当用户明确要求查找组件时使用。
## 组件发现:"[搜索词]"
在 [N] 个注册表中找到 **[N] 个匹配项**。推荐如下:
### 1. @registry/component-name ⭐ 推荐
[描述其功能]
- **推荐理由:** [说明为何符合需求]
- **功能:** [关键能力]
```bash
npx shadcn@latest add @registry/component-name
[描述]
npx shadcn@latest add @registry/alternative
[描述]
npx shadcn@latest add @registry/another-option
选项: [1] 安装推荐 | [2-3] 安装备选 | [更多] 查看所有结果 | [自定义] 从头构建
#### 详细比较(复杂选择)
当存在多个良好选项且选择很重要时使用。
```markdown
## 组件发现:"[搜索词]"
| 组件 | 注册表 | 最适合 | 复杂度 |
|-----------|----------|----------|------------|
| **option-1** | @registry | [用例] | 低/中/高 |
| **option-2** | @registry | [用例] | 低/中/高 |
| **option-3** | @registry | [用例] | 低/中/高 |
### 推荐:@registry/option-1
[解释为何这是满足其特定需求的最佳选择]
**关键功能:**
- ✅ [功能 1]
- ✅ [功能 2]
- ✅ [功能 3]
**安装:**
```bash
npx shadcn@latest add @registry/option-1
决定前想先看看代码示例吗?
#### 无 MCP 回退方案
当未配置 shadcn MCP 时使用。
```markdown
## 组件发现:"[搜索词]"
⚡ **专业提示:** 配置 [shadcn MCP](https://github.com/nicholasoxford/shadcn-mcp) 即可在 1500+ 个组件中即时搜索,并附带代码示例和一键安装功能。
根据您的需求,请查看这些注册表:
| 注册表 | 原因 | 浏览地址 |
|----------|-----|--------|
| **@reui** | [包含相关组件] | [reui.dev](https://reui.dev) |
| **@animate-ui** | [包含相关组件] | [animate-ui.com](https://animate-ui.com) |
**启用完整发现功能:**
```bash
# 为您的 AI 编码工具安装 shadcn MCP
# 参见:https://github.com/nicholasoxford/shadcn-mcp
或者浏览所有注册表:registry.directory
我应该构建自定义组件,还是先检查这些注册表?
### 步骤 4:执行用户选择
根据用户的选择:
* **安装组件:** 运行添加命令,然后根据需要自定义
* **查看更多结果:** 显示带分页的更多匹配项
* **查看示例:** 获取并显示代码示例
* **构建自定义:** 继续自定义实现(仍可参考现有组件作为模式)
## 搜索策略
### 有效的搜索词
| 寻找... | 尝试搜索... |
|----------------|------------------|
| 数据展示 | `table`、`data-grid`、`list` |
| 用户输入 | `form`、`input`、`field`、`select` |
| 导航 | `sidebar`、`nav`、`menu`、`tabs` |
| 反馈 | `toast`、`alert`、`notification` |
| 覆盖层 | `modal`、`dialog`、`sheet`、`popover` |
| 媒体 | `carousel`、`gallery`、`image` |
| 动画 | `animate`、`motion`、`transition` |
| 布局 | `card`、`section`、`hero`、`grid` |
### 注册表专长
快速参考应优先检查哪些注册表:
| 需求 | 首先检查 |
|------|-------------|
| 基础 UI 原语 | @shadcn |
| 页面区块/块 | @blocks |
| 数据表格/网格 | @reui |
| 动画 | @animate-ui, Magic UI |
| AI/聊天界面 | AI Elements, assistant-ui |
| 无障碍 | @diceui, JollyUI |
完整目录请参见 [references/registries.md](references/registries.md)。
## 响应要求
每次发现响应**必须**包含:
1. **使用的搜索词** - 搜索了什么
2. **匹配数量** - 找到了多少结果
3. **前 3 条推荐** - 最佳匹配项,包含:
* 组件名称和注册表
* 简要描述
* 推荐理由
* 安装命令
4. **清晰的选项** - 用户接下来可以做什么
5. **推荐** - 使用哪一个(当存在明确优胜者时)
## 示例
### 示例 1:主动检查
**场景:** 用户要求"添加一个数据表格来显示用户账户"
**代理响应:**
```markdown
在构建自定义数据表格之前,我发现了这些现有选项:
1. **@reui/data-grid-table** - 功能齐全的网格,支持排序、过滤、分页
2. **@blocks/table-05** - 预定义样式的数据表格区块
3. **@shadcn/table** - 基础表格原语
→ @reui/data-grid-table 看起来非常适合用户账户。要安装它吗?
场景: 用户要求"给我找一个带动画的手风琴组件"
代理响应:
## 组件发现:"animated accordion"
在 5 个注册表中找到 **8 个匹配项**。推荐如下:
### 1. @animate-ui/components-base-accordion ⭐ 推荐
带有进入/退出过渡效果的平滑动画手风琴。
- **推荐理由:** 内置动画,无障碍,可自定义时序
- **功能:** 键盘导航,符合 ARIA 标准,Motion 驱动
```bash
npx shadcn@latest add @animate-ui/components-base-accordion
标准手风琴(无内置动画)。
npx shadcn@latest add @shadcn/accordion
选项: [1] 安装带动画的 | [2] 安装基础的并添加动画 | [自定义] 从头构建
### 示例 3:没有良好匹配
**场景:** 搜索没有返回相关结果
**代理响应:**
```markdown
## 组件发现:"quantum flux capacitor"
未找到满足此特定需求的现有组件。
**最接近的匹配:**
- @shadcn/card - 可作为容器进行适配
- @animate-ui/components-backgrounds-gradient - 用于视觉效果
由于这是一个独特的组件,我将进行自定义构建。
您希望我先检查任何特定的注册表,还是直接进行自定义构建?
每周安装数
76
仓库
GitHub 星标数
1
首次出现
2026年2月1日
安全审计
安装于
codex62
cursor61
gemini-cli60
github-copilot59
opencode58
amp56
Stop reinventing the wheel. Search 1,500+ existing shadcn components before building custom.
ALWAYS search before building. The shadcn ecosystem has components for almost everything. A 5-second search can save hours of development.
Activate this skill BEFORE writing component code when:
Activate when user says things like:
/find-component, /discover, /search-shadcnBefore searching, clarify:
With shadcn MCP configured (recommended):
1. mcp__shadcn__search_items_in_registries
- registries: ["@shadcn", "@animate-ui", "@diceui", "@blocks", "@reui"]
- query: [search term]
- limit: 10
2. For promising results, get details:
mcp__shadcn__view_items_in_registries
- items: ["@registry/component-name"]
3. For code examples:
mcp__shadcn__get_item_examples_from_registries
- query: "component-demo"
4. Get install command:
mcp__shadcn__get_add_command_for_items
- items: ["@registry/component-name"]
Without MCP:
Choose response format based on context:
Use when proactively checking before building. Minimal interruption.
Before building a custom [component], I found existing options:
1. **@registry/component-name** - [brief description]
2. **@registry/other-option** - [brief description]
→ Install one of these, or build custom?
Use when user explicitly asks to find components.
## Component Discovery: "[search term]"
Found **[N] matches** across [N] registries. Top recommendations:
### 1. @registry/component-name ⭐ Recommended
[Description of what it does]
- **Why it fits:** [reason this matches the need]
- **Features:** [key capabilities]
```bash
npx shadcn@latest add @registry/component-name
[Description]
Why it fits: [reason]
npx shadcn@latest add @registry/alternative
[Description]
npx shadcn@latest add @registry/another-option
Options: [1] Install recommended | [2-3] Install alternative | [More] See all results | [Custom] Build from scratch
#### Detailed Comparison (Complex Choices)
Use when multiple good options exist and choice matters.
```markdown
## Component Discovery: "[search term]"
| Component | Registry | Best For | Complexity |
|-----------|----------|----------|------------|
| **option-1** | @registry | [use case] | Low/Med/High |
| **option-2** | @registry | [use case] | Low/Med/High |
| **option-3** | @registry | [use case] | Low/Med/High |
### Recommendation: @registry/option-1
[Explain why this is the best fit for their specific needs]
**Key features:**
- ✅ [feature 1]
- ✅ [feature 2]
- ✅ [feature 3]
**Install:**
```bash
npx shadcn@latest add @registry/option-1
Want to see a code example before deciding?
#### No MCP Fallback
Use when shadcn MCP is not configured.
```markdown
## Component Discovery: "[search term]"
⚡ **Pro tip:** Configure the [shadcn MCP](https://github.com/nicholasoxford/shadcn-mcp) for instant search across 1,500+ components with code examples and one-click installs.
Based on your needs, check these registries:
| Registry | Why | Browse |
|----------|-----|--------|
| **@reui** | [has relevant components] | [reui.dev](https://reui.dev) |
| **@animate-ui** | [has relevant components] | [animate-ui.com](https://animate-ui.com) |
**To enable full discovery:**
```bash
# Install shadcn MCP for your AI coding tool
# See: https://github.com/nicholasoxford/shadcn-mcp
Or browse all registries: registry.directory
Should I build custom, or check these registries first?
### Step 4: Execute User Choice
Based on user selection:
- **Install component:** Run the add command, then customize as needed
- **See more results:** Show additional matches with pagination
- **View example:** Fetch and display code example
- **Build custom:** Proceed with custom implementation (still reference the existing component for patterns)
## Search Strategy
### Effective Search Terms
| Looking for... | Try searching... |
|----------------|------------------|
| Data display | `table`, `data-grid`, `list` |
| User input | `form`, `input`, `field`, `select` |
| Navigation | `sidebar`, `nav`, `menu`, `tabs` |
| Feedback | `toast`, `alert`, `notification` |
| Overlays | `modal`, `dialog`, `sheet`, `popover` |
| Media | `carousel`, `gallery`, `image` |
| Animation | `animate`, `motion`, `transition` |
| Layout | `card`, `section`, `hero`, `grid` |
### Registry Specialties
Quick reference for which registries to prioritize:
| Need | Check First |
|------|-------------|
| Basic UI primitives | @shadcn |
| Page sections/blocks | @blocks |
| Data tables/grids | @reui |
| Animations | @animate-ui, Magic UI |
| AI/Chat interfaces | AI Elements, assistant-ui |
| Accessibility | @diceui, JollyUI |
See [references/registries.md](references/registries.md) for complete catalog.
## Response Requirements
Every discovery response MUST include:
1. **Search term used** - What was searched
2. **Match count** - How many results found
3. **Top 3 recommendations** - Best matches with:
- Component name and registry
- Brief description
- Why it fits the need
- Install command
4. **Clear options** - What user can do next
5. **Recommendation** - Which one to use (when clear winner exists)
## Examples
### Example 1: Proactive Check
**Situation:** User asks "Add a data table to show user accounts"
**Agent response:**
```markdown
Before building a custom data table, I found these existing options:
1. **@reui/data-grid-table** - Full-featured grid with sorting, filtering, pagination
2. **@blocks/table-05** - Pre-styled data table block
3. **@shadcn/table** - Basic table primitives
→ The @reui/data-grid-table looks perfect for user accounts. Install it?
Situation: User asks "Find me an animated accordion"
Agent response:
## Component Discovery: "animated accordion"
Found **8 matches** across 5 registries. Top recommendations:
### 1. @animate-ui/components-base-accordion ⭐ Recommended
Smooth animated accordion with enter/exit transitions.
- **Why it fits:** Built-in animations, accessible, customizable timing
- **Features:** Keyboard nav, ARIA compliant, Motion powered
```bash
npx shadcn@latest add @animate-ui/components-base-accordion
Standard accordion (no built-in animation).
Why it fits: Simple, lightweight, easy to add custom animations
npx shadcn@latest add @shadcn/accordion
Options: [1] Install animated | [2] Install basic + add animations | [Custom] Build from scratch
### Example 3: No Good Match
**Situation:** Search returns no relevant results
**Agent response:**
```markdown
## Component Discovery: "quantum flux capacitor"
No existing components found for this specific need.
**Closest matches:**
- @shadcn/card - Could be adapted as a container
- @animate-ui/components-backgrounds-gradient - For visual effects
Since this is a unique component, I'll build it custom.
Want me to check any specific registries first, or proceed with custom build?
Weekly Installs
76
Repository
GitHub Stars
1
First Seen
Feb 1, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
codex62
cursor61
gemini-cli60
github-copilot59
opencode58
amp56
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装