mcpField
S
shadcn

shadcn

github.com/thongdn-it开发5117 次安装39 周前更新
代码仓库

关于 shadcn

shadcn 提供面向 shadcn/ui 应用的社区最佳实践指南,供开发者在编写、重构和审查组件时参考。指南包含按影响优先级组织的 42 条规则,覆盖架构、无障碍、表单、数据展示和状态管理等主题。

主要功能

  1. 01涵盖 8 个类别的 42 条规则
  2. 02按影响程度排列优先级
  3. 03提供组件架构和组合指导
  4. 04包含无障碍与主题样式建议
  5. 05涉及表单、数据展示和性能
  6. 06附有完整编译版指南

适用场景

  1. 01编写或组合 shadcn/ui 组件
  2. 02实施 React Hook Form 与 Zod 表单
  3. 03构建数据表或大型列表
  4. 04审查无障碍性与主题配置

安装

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

$npx skills add https://github.com/thongdn-it/react-agent-skills --skill shadcn

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

包含的文件

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

AGENTS.md
references/
ally-ensure-color-contrast.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
data-use-tanstack-table-for-complex-tables.md
data-virtualize-large-lists.md
form-handle-async-validation.md
form-reset-form-state-correctly.md
form-show-validation-errors-correctly.md
form-use-react-hook-form-integration.md
form-use-zod-for-schema-validation.md
perf-avoid-unnecessary-rerenders-in-forms.md
perf-debounce-search-inputs.md

详细介绍

shadcn/ui 社区最佳实践

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

适用场景

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

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

按优先级划分的规则类别

优先级类别影响前缀
1组件架构CRITICALarch-
2无障碍保留CRITICALally-
3样式与主题HIGHstyle-
4表单模式HIGHform-
5数据展示MEDIUM-HIGHdata-
6组件组合MEDIUMcomp-
7性能优化MEDIUMperf-
8状态管理LOW-MEDIUMstate-

快速参考

1. 组件架构(CRITICAL)
2. 无障碍保留(CRITICAL)
3. 样式与主题(HIGH)
4. 表单模式(高)
5. 数据展示(中高)
6. 组件组合(中)
7. 性能优化(中)
8. 状态管理(低至中)

使用方法

阅读各个参考文件,了解详细说明和代码示例:

完整汇编文档

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

参考文件

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

评论

支持 Markdown