Shadcn Component Boundaries

C3SC0-V4113/Scaffold/skills/shadcn-component-boundaries

作者 C3SC0-V4113ba1fac59145ed48f727247299ebb09289b87f27bApache-2.03 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫3 天前更新

Trigger: components/ui, shadcn, component placement, common components, feature components, atomic design. Enforce registry and product component boundaries.

AI 產生的概覽

為 shadcn 專案強制執行登錄表原語、共用 common 元件與功能資料夾之間的元件放置邊界。

功能
此技能提供規則與決策表,用於在使用 shadcn 的專案中分類與放置 UI 元件。它會從 components.json 解析 components 與 ui 目錄,將 ui 目錄保留給登錄表管理的原語,並把可重用的產品元件放到 common/、功能元件放到功能資料夾。它也強制單向相依性(feature 到 common 到 ui),並回報每個建立或移動元件的歸屬分類與最終路徑。
適用情境
在採用 shadcn 的專案中建立、移動、包裝或審查 UI 元件時使用。它用於判斷元件應放在何處,以及產品行為是否滲入登錄表原語。
執行需求
需要一個使用 shadcn 且包含 components.json 檔案的專案;可選用已安裝的 shadcn 技能的專案情境指令,以及在設定時使用 @shadcn/lint。它不附帶指令碼,只有說明與一份參考文件。

shadcn Component Boundaries

Activation Contract

Load this skill when creating, moving, wrapping, or reviewing UI components in a project that uses shadcn.

Hard Rules

  1. Resolve paths from components.json (its aliases for components and ui) or the installed shadcn skill's project-context command. Never assume components/ versus src/components/.
  2. Reserve the resolved ui directory for registry-managed primitives installed from shadcn or compatible registries.
  3. Never place product-owned wrappers, composites, sections, domain components, or feature behavior in the ui directory.
  4. Put reusable product-owned components under common/ in the resolved components directory.
  5. Put feature-owned components in a named feature folder or colocate them with that feature.
  6. Compose: wrap a registry primitive from common/ or a feature folder instead of adding product behavior to the primitive.
  7. Keep dependencies one-way: feature → common → ui. The ui directory never imports from common or feature folders.
  8. Use semantic tokens from the global stylesheet. Treat tokens as quarks and registry primitives as atoms; do not force molecule or organism names into paths.
  9. When @shadcn/lint is configured, shadcn/no-restyle enforces the ui boundary: call sites may pass layout classes through className, but look comes from variants and sizes. Add a variant to the primitive instead of restyling at the call site.

Decision Gates

Component ownershipDestination
shadcn or compatible registry primitiveresolved ui directory
reusable product-owned component<components>/common/
feature-specific component<components>/<feature>/ or feature colocation
route or page compositionframework route/page directory
theme tokenglobal stylesheet variables

Execution Steps

  1. Read components.json and resolve the components and ui aliases to directories.
  2. Search installed primitives before creating custom markup.
  3. Classify ownership and reuse scope with the table above.
  4. Place the component; see references/placement-examples.md [blocked] for edge cases.
  5. Verify no product-owned file entered ui and no reverse import was introduced.

Output Contract

State the ownership classification and final path for every component created or moved, and confirm the dependency direction holds.

References

  • references/placement-examples.md [blocked] — worked placement decisions.

來源與署名

來源:C3SC0-V4113/Scaffold位於skills/shadcn-component-boundaries提交ba1fac5

授權條款: Apache-2.0

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架