360 Secure SkillHub
360 安全技能中心

shadcn

面向 shadcn/ui(Radix 或 Base UI)项目的规则参考集,按组件架构、可访问性、样式主题、表单、数据展示、组合、性能与状态八类组织 46 条规范,每条给出适用场景与正误代码示例,供编写和审查组件时对照使用。

分类:开发
PyModel
热度 0.00
最近更新 2026-11-10 05:27:22

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add pymodel/react-frontend-skills/shadcn
兼容性
通用兼容
联网要求
联网要求未确认
数据出网
数据不出本机
Metadata
name
shadcn
description
shadcn/ui components on Radix or Base UI.

shadcn/ui Community Best Practices

Current best-practices guide for shadcn/ui applications. Before applying primitive-specific guidance, inspect whether the checked-in components use Radix UI or Base UI; current shadcn supports both (Base UI is the default for new projects) and their composition APIs differ. Component installs go through the CLI (v4), which resolves namespaced registries.

When to Apply

Reference these guidelines when:

  • Writing new shadcn/ui components or composing primitives
  • Implementing forms with React Hook Form and Zod validation
  • Building data tables or handling large dataset displays
  • Customizing themes or adding dark mode support
  • Reviewing code for accessibility compliance

Rule Categories by Priority

Priority Category Impact Prefix
1 Component Architecture CRITICAL arch-
2 Accessibility Preservation CRITICAL ally-
3 Styling & Theming HIGH style-
4 Form Patterns HIGH form-
5 Data Display MEDIUM-HIGH data-
6 Component Composition MEDIUM comp-
7 Performance Optimization MEDIUM perf-
8 State Management LOW-MEDIUM state-

Quick Reference

1. Component Architecture (CRITICAL)

2. Accessibility Preservation (CRITICAL)

3. Styling & Theming (HIGH)

4. Form Patterns (HIGH)

5. Data Display (MEDIUM-HIGH)

6. Component Composition (MEDIUM)

7. Performance Optimization (MEDIUM)

8. State Management (LOW-MEDIUM)

How to Use

Run in the project root first:

npx -y @pymodel/react-frontend-skills detect  # installed vs. targeted versions

Read references/<rule-id>.md for each rule above that matches the task: why it matters, then incorrect vs. correct code.