Token导航 LogoToken导航

Agent Skill · 前端设计

canvas-component-composability(画布组件的可组合性)

canvas-component-composability 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

canvas-component-composability 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 3,056。

总安装 1,622周安装 65GitHub Stars 1下载 525核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:canvas-component-composability(画布组件的可组合性)
来源仓库:https://github.com/drupal-canvas/skills
仓库路径:skills/canvas-component-composability
安装命令:
npx skills add https://github.com/drupal-canvas/skills --skill canvas-component-composability
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/drupal-canvas/skills --skill canvas-component-composability

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

canvas-component-composability 倡导小而专注的组件拆分,反对过度依赖props传递。推荐父布局+子项的重复内容模式,提升复用性与维护性。适用于Drupal Canvas体系,规范命名与目录结构增强工程化程度。需平衡灵活性与复杂度,高频变更场景建议预留插槽机制。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/canvas-component-composability

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/drupal-canvas/skills --skill canvas-component-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

canvas-component-composability 怎么安装?

在终端执行 npx skills add https://github.com/drupal-canvas/skills --skill canvas-component-composabil…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

canvas-component-composability 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

canvas-component-composability 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/drupal-canvas/skills --skill canvas-component-composability 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

canvas-component-composability 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

canvas-component-composability 用的人多吗?

公开数据是累计安装 1,622 次,近一周安装 65 次,下载 525 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

canvas-component-composability 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
canvas-component-composability

画布组件的可组合性 · 本页

1,6221执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Prefer small, focused components over monolithic ones with many props. When a component starts accumulating many unrelated props, decompose it into smaller, composable pieces.

For repeatable card/list/grid UI, default to two Canvas components: a parent layout component with a slot for the repeated children, and a child component for one item. Do not flatten repeated items into numbered prop groups such as car1Name, car2Name, feature1Title, or card3Image.

Ownership

This skill owns the reusable modeling rules for:

  • props vs slots
  • variants vs granular props
  • repeatable-content patterns
  • granularity checks (split, merge, slot extraction)

For the canonical reuse-first policy, follow canvas-component-definition. For exact component.yml grammar and slot schema, follow canvas-component-metadata.

Reuse with existing components

When the task names existing components or clearly implies composition, start with the reuse check in canvas-component-definition before creating a new component. This skill focuses on how components compose once that boundary is clear.

Reference map

Load references only as needed:

  • Repeatable lists/grids and array-to-slot conversion: references/repeatable-content.md
  • Slot interactivity in empty flex/grid containers: references/repeatable-content.md ("Slot container minimum size" section)

Props vs slots

Slots are the primary mechanism for composability. Instead of passing complex data through props, use slots to let parent components accept child components. This matches how Canvas users build pages by placing components inside other components. This is the design-time rubric to use before writing component.yml.

When to use slots vs props

Use slots forUse props for
Variable number of child componentsSingle, required values (text, URL)
Content that users should composeConfiguration options (size, color)
Complex nested structuresSimple data (strings, booleans)
Content that varies between instancesContent consistent across instances

Treat a single image as one prop, not as a slot and not as multiple URL/alt props. If a component needs one image, use a semantic image prop such as image or backgroundImage with the Canvas image schema ref.

For repeatable cards/items, the parent usually owns layout props such as heading, intro text, alignment, or column count, while each child owns item content props such as title, image, price, label, CTA, or metadata.

Repeatable rich items should use the parent-slot-plus-child-component pattern, not array-of-object props. See references/repeatable-content.md.

Apply the rubric to blocks this way: presets and simple copy stay in props; grids of cards, tab panels, footer columns, or swappable regions belong in slots or nested child components with their own slots. Do not encode large composed regions as string props or JSON blobs.

Variants vs granular props

Use one primary modeling style per component. Sometimes a hybrid is valid: one variant plus one or two orthogonal toggles.

Variants are the default:

  • A primary variant enum selects named presets whose values imply a bundle of styles and structure rules.
  • Use a primary variant enum when the design has named presets or when many arbitrary combinations would be invalid.
  • Keep variant as the prop ID for the main preset field instead of synonyms like appearance or layoutVariant.
  • Add orthogonal enums such as size or density only when those axes are independently meaningful.
  • Variants usually produce fewer invalid combinations, simpler Canvas forms, and easier alignment with design-system or Figma variants.
  • Map enum values to CVA or equivalent implementation branches and theme tokens.

Granular props are appropriate when:

  • the user explicitly wants separate controls per axis
  • the axes are independently valid in many combinations
  • product rules or analytics require individual toggles

Hybrid modeling is acceptable, but avoid a large pile of independent knobs when the design really describes a small set of named presets.

Choosing

SituationFavor
Mutually exclusive layouts (A or B, not mix-and-match)Variants
Design uses named presets or Figma variantsVariants
Many combinations would be invalid or untestedVariants
Product needs arbitrary mixing of orthogonal togglesGranular (or hybrid)
User asks for separate controls per axisGranular

Document the choice in the decomposition handoff so implementation and component.yml stay aligned.

Prop order in handoffs and metadata

Match the decomposition handoff and component.yml order so Canvas editors see a sensible form flow.

  • If there is one primary preset enum, name it variant and list it first.
  • Then list content props (copy, links, media).
  • Then list remaining configuration props (secondary toggles, style helpers).

When there is no primary variant, list content props first and configuration after.

If there is no single variant but the model is otherwise preset-oriented, still put the dominant preset enum first when it exists.

Canvas-specific constraints

  • No array-of-object props for repeatable rich items. Use a parent slot plus child component instead.
  • Props are editor-facing. Do not expose implementation-only values.
  • Required props should not rely on silent JSX defaults. Metadata and the editor should supply those values explicitly.
  • Keep prop IDs camelCase-aligned with their labels and finalize exact shape in canvas-component-metadata.

When a prop pretends to be a slot

  • JSON-in-a-string or serialized blocks in a prop
  • arrays of objects for child UI

Replace these with slot-plus-child-component composition.

When a slot pretends to be a prop

  • A slot that always holds one component type with fixed props

In those cases, consider whether the parent should own that markup or use a narrow prop instead.

Declare slots in component.yml

Declare slots in component.yml and render them as named props in JSX.

For exact slot schema and constraints (map vs [], slot keys, children handling), follow canvas-component-metadata as the source of truth.

Granularity checks

Use these heuristics when auditing whether a component boundary is too coarse or too fine. Use them after an initial tree and prop/slot sketch exist. The goal is that editors can reason about each component and instances can reuse without copy-paste props.

Signs a component should be decomposed

Consider breaking up a component when it has:

  • Many granular toggles that really describe a small set of named presets instead of independent choices. Prefer variants unless the user wants granular control.
  • One machineName owning unrelated concerns
  • More than 6-8 props that serve distinct purposes
  • Props for elements that make sense as standalone components (breadcrumbs, titles, metadata, navigation)
  • A growing prop list where each prop maps to a visually separate block
  • Built-in layout assumptions that limit where the component can be used
  • Multiple distinct visual sections that could be reused independently
  • Repeated prop groups that differ only by an index or prefix/suffix (item1Title, item2Title, item3Title)
  • Layout plus multiple independent content columns that could change order
  • A parent that mixes layout shell with multiple independent content blocks
  • showX/showY chains that encode which children exist instead of letting authors place children directly

Common decomposition patterns

Page-level elements should be separate components

Elements that appear on many pages but are not always needed together should be separate components.

Extract repeated patterns into small components

When the same combination of elements is repeated, extract it:

  • Date + category/tag -> article-meta
  • Cover image + download button -> resource-cover
  • Label + value pairs -> metadata-item
  • Icon + text link -> icon-link
  • Grid/list wrapper + repeated card -> card-grid + card
  • Featured cars wrapper + repeated car card -> featured-cars-grid + car-card

Use layout components instead of built-in layouts

Do not bake two-column or grid layouts into content components. Use layout components and compose content into them.

When to extract a child component

Extract a child component, or add a slot, when any of these are true:

  • The block appears twice or more with the same role
  • The block has a clear name and could appear elsewhere on the site
  • Authors might reorder, omit, or swap that block independently
  • The block mixes interaction with static siblings in a way that muddies the parent story

Typical extractions: Meta, Actions, Media, Nav, and item components for lists or grids.

Canvas editing lens

  • If authors must drop arbitrary blocks into an area, use a slot rather than a prop that encodes component type lists.
  • If copy is fixed marketing text with no composition need, string props are appropriate.
  • If the only composition is one optional rich block that never varies in type, consider keeping it internal or using a single slot rather than many micro-slots.

When not to decompose

Keep components together when:

  • They always appear together in every design variant and never make sense separately
  • They share significant internal state that would be awkward to lift up
  • The visual design tightly couples them (for example, overlapping elements, shared backgrounds, masking)
  • Decomposition would create components with only 1-2 props that are not useful elsewhere

Fine signals (merge or convert)

  • Components that only wrap a single heading or static paragraph with no second instance planned
  • Slots that always receive one specific child type and never vary. Merge into the parent or replace with props if the structure is fixed.
  • Wrapper components whose sole job is CSS on one element. Prefer parent layout or utility classes unless reuse clearly demands that wrapper.

Anti-patterns

  • Slot per div: every flex child becomes a slot without giving authors real control. Group by meaningful composition boundaries.
  • Prop drilling toggles: many booleans for independent blocks that should be separate children or slots
  • God layout: one component hard-codes the whole page grid. Prefer layout components and nested regions instead of one monolithic page shell.

Rework loop

  1. Mark each failing node as coarse, fine, or an authoring mismatch.
  2. For coarse nodes, split responsibility, introduce slots for variable regions, or extract repeated items.
  3. For fine nodes, merge nodes, collapse slots, or move fixed structure inside the parent implementation.
  4. Re-sketch props and slots only for the nodes whose boundary changed.
  5. Re-audit until pass or document exceptions, including why the usual rule does not apply.

Vocabulary (optional)

Terms like atom, molecule, and organism can describe scale, not a mandate. Prefer reuse, editor control, and Canvas constraints over strict atomic-design tiers.

平台分布

Codex

37.42%
按下载量换算196

Claude

28.44%
按下载量换算149

Cursor

18.42%
按下载量换算97

Gemini CLI

10.55%
按下载量换算55

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/drupal-canvas/skills --skill canvas-component-composability 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills