mcpField
S
shadcn

shadcn

github.com/pproenca设计与 UI220729 次安装11 周前更新
代码仓库

关于 shadcn

由社区维护的 shadcn/ui 最佳实践指南,面向使用该组件库的开发者。优先级规则涵盖项目设置、组件组合、无障碍、表单、样式和数据展示。

主要功能

  1. 01十类共 58 条优先级规则
  2. 02项目设置与组件架构建议
  3. 03无障碍、样式和主题指导
  4. 04表单与数据展示模式

适用场景

  1. 01在项目中配置 shadcn/ui
  2. 02构建无障碍组件与表单
  3. 03定制主题和深色模式
  4. 04展示表格与大型数据集

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/pproenca/dot-skills --skill shadcn

安装后在 Claude Code 中输入/shadcn确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

AGENTS.md
metadata.json
README.md
assets/templates/
_template.md
references/
_sections.md
ally-aria-invalid-errors.md
ally-checkbox-label-association.md
ally-dialog-title-required.md
ally-ensure-color-contrast.md
ally-focus-visible-styles.md
ally-form-field-labels.md
ally-maintain-focus-management.md
ally-preserve-aria-attributes.md
ally-preserve-keyboard-navigation.md
ally-provide-sr-only-labels.md
arch-extend-variants-with-cva.md
arch-forward-refs-for-composable-components.md
arch-isolate-component-variants.md
arch-preserve-radix-primitive-structure.md
arch-use-asChild-for-custom-triggers.md
arch-use-cn-for-class-merging.md
comp-combine-command-with-popover.md
comp-compose-with-compound-components.md
comp-create-reusable-form-fields.md
comp-nest-dialogs-correctly.md
comp-use-drawer-for-mobile-modals.md
comp-use-slot-pattern-for-flexibility.md
data-empty-states-with-guidance.md
data-paginate-server-side.md
data-use-skeleton-loading-states.md

详细介绍

shadcn/ui 社区最佳实践

由 shadcn/ui 社区维护的 shadcn/ui 应用综合最佳实践指南。包含 10 个类别中的 58 条规则,并按影响程度排序,用于指导自动重构和代码生成。

适用场景

在以下情况下参考这些指南:

  • 在项目中安装和配置 shadcn/ui
  • 编写新的 shadcn/ui 组件或组合原语
  • 使用 React Hook Form 和 Zod 验证实现表单
  • 构建数据表格或处理大型数据集的显示
  • 自定义主题或添加深色模式支持
  • 检查代码是否符合无障碍要求

按优先级划分的规则类别

优先级类别影响前缀
1CLI 与项目设置严重setup-
2组件架构严重arch-
3无障碍性保障严重ally-
4样式与主题高style-
5表单模式高form-
6数据展示中高data-
7布局与导航中layout-
8组件组合中comp-
9性能优化中perf-
10状态管理低中state-

快速参考

1. CLI 与项目设置(严重)
2. 组件架构(严重)
3. 无障碍功能保留(关键)
4. 样式与主题(高)
5. 表单模式(高)
6. 数据展示(中高)
7. 布局与导航(中)
8. 组件组合(中)
9. 性能优化(中)
10. 状态管理(低-中)

使用方法

阅读单独的参考文件,了解详细说明和代码示例:

完整汇编文档

如需包含所有规则的单文件参考,请参阅 AGENTS.md。

参考文件

文件描述
AGENTS.md包含所有规则的完整汇编指南
references/_sections.md分类定义和排序
assets/templates/_template.md新规则模板
metadata.json版本和参考信息

评论

支持 Markdown