skills/canvas-design-decomposition/SKILL.md
Plans structure for a component library with props/slots and right-sized component granularity. Run before building or adding Canvas components (new `src/components/` folders, component.yml, React), or for plan-only / breakdown-only work, whenever UI must map to a coherent tree. Mandatory for every new Figma frame or greenfield screen—repository drafts do not replace phases A–G.
npx skillsauth add drupal-canvas/skills canvas-design-decompositionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Load and follow this skill before proposing component structure for a component library, writing implementation plans, or implementing React—including when the user only asks for a plan or breakdown—whenever you are modeling how UI should split into Canvas components (a component library, section, or full page). The same applies when you are about to build, add, or scaffold components (see below). Treat any of the following as a trigger:
src/components/, authoring component.yml and index.jsx (or .tsx),
scaffolding a component from a ticket or spec, coding a section from a
design, or implementing a named block (hero, footer, card, and so on).
Decompose before writing schema or React so names, slots, variants, and
reuse stay aligned—unless the task is a trivial one-line tweak inside an
existing, stable API.figma.com/design, figma.com/make, or
branch URLs) or explicit node-id / frame language tied to Figma.nebula-scrape-url when a live URL needs
capture).pages/*.json,
partial components under src/components/, or scraped assets may be helpful
starting points, but they do not replace reading this skill and
completing phases A–G for the current artifact. Reconcile draft code
with the breakdown; do not assume prior work already did decomposition.Automated tool output (for example Figma MCP reference JSX, HTML export, or generated code) is input to this workflow—not a substitute for completing phases A–G.
Turn a design artifact into a stable component model: regions, tree, prop vs slot decisions, and granularity checks. A breakdown is incomplete without sketching props and slots for each node—Canvas authors interact with the tree through that API, so plan it with structure, not after implementation.
During planning, step past the single frame or ticket: ask where else each
piece could appear and what would differ (copy, children, variant). Prefer
reusable machineNames, slots for variable regions, and presets via
variant over one-off names or props that hard-code one campaign’s content.
Do not implement pixels or write component.yml inside this workflow—finish
the structure and prop/slot sketch first, then hand off.
canvas-component-composability
— shared props/slots rules, repeatable content, and granularity checks.canvas-component-metadata — exact
component.yml schema.canvas-component-definition —
folder contract, mocks, naming authority.implement-design — pixel-level fidelity
when the source is Figma and after the tree is locked (requires Figma MCP
when used). For non-Figma sources, implement from the locked tree and tokens
without this step unless the user points back to a Figma file.For repeatable lists/grids in Canvas, see
canvas-component-composability/references/repeatable-content.md.
Classify the source in Phase A. Typical categories:
| Kind | Examples | | --------------------- | --------------------------------------------------------------- | | Design tool | Figma file, frame export, FigJam | | Live reference | Existing production or staging site, competitor URL | | Captured media | Screenshots, PDFs, brand decks | | Structured scrape | HTML/CSS snapshot via tooling | | Prompt / prose | User brief, AI-generated layout description, markdown wireframe |
Optional helpers:
nebula-scrape-url (not for
Figma or docs).implement-design.Complete phases A → G in order. Each phase has an exit criterion. If Phase F fails, fix the tree and re-run Phase E for affected nodes only.
Exit: Input type stated; unknowns listed with risk (workflow continues even if some answers are missing).
chrome
(shell), navigation, or content.Exit: Ordered region list with purpose and class for each.
machineName values (kebab-case folder names per
canvas-component-definition).Exit: Table: candidate machineName, responsibility, reuse count, parent
region.
Exit: Tree covers every inventory row; layout vs content roles are explicit.
Required: Every decomposition includes this phase. Props and slots are not a late add-on—they define how editors use the tree. For each tree node, sketch:
string, boolean, enum, image/reference)—not final YAML. Follow
canvas-component-composability
for the actual props-vs-slots rubric, variants-vs-granular guidance, and prop
ordering. This phase records the decision; it does not redefine that rubric.variants (default) or granular props with
a one-line rationale in the handoff. For the Phase E write-up convention, see
references/props-vs-slots-rubric.md.Exit: Every node has a prop/slot sketch, implementation style is stated, and repeatable rich children are not modeled as object arrays in props.
Run the shared granularity checklist in
canvas-component-composability.
In this phase, audit the candidate tree against that shared rule set and record
the result; do not create a second split/merge rubric here. For the Phase F
audit note, see references/granularity.md.
Exit: All nodes pass or failures are documented with explicit rationale.
Deliver one Markdown artifact using the template below. Point next steps to:
canvas-component-metadatacanvas-component-composabilitycanvas-component-definitionimplement-design
(when applicable)Exit: Filled template ready to paste into an issue or MR.
Out of scope here: page JSON
(canvas-page-definition), validation
runs (nebula-component-validation).
Copy and fill:
## Summary
- **Design source:** (e.g. Figma URL | live URL | screenshots | prompt/spec
text)
- **Scope:** (single component | section | full page)
- **Version / date:**
## Assumptions and open questions
- ...
## Region map
| Region | Purpose | Class |
| ------ | ------- | ----- |
| ... | ... | ... |
## Component inventory
| machineName (candidate) | Responsibility | Reuse | Parent region | Notes |
| ----------------------- | -------------- | ----- | ------------- | ----- |
| ... | ... | ... | ... | ... |
## Component tree
(Nested list or Mermaid)
## API sketch (per component)
### `machine-name`
**Implementation style:** variants (default) | granular props — one-line
rationale
**Props** (table rows in editor order: **variant first** when there is a single
primary variation enum; **content first** otherwise—then configuration)
| Name (camelCase intent) | Purpose | Required? | Kind (string / bool / enum / …) |
| ----------------------- | ------- | --------- | ------------------------------- |
| ... | ... | ... | ... |
**Slots**
| Slot key | Purpose | Empty behavior |
| -------- | ------- | -------------- |
| ... | ... | ... |
## Granularity audit
| Component / node | Pass/Fail | Notes / fix |
| ---------------- | --------- | ----------- |
| ... | ... | ... |
## Next steps
- [ ] `canvas-component-composability` — edge cases for props/slots,
repeatability, or granularity
- [ ] `canvas-component-metadata` — draft `component.yml`
- [ ] `canvas-component-definition` — folder, `index.jsx`, mocks
- [ ] `implement-design` — Figma fidelity pass (only when matching a Figma file)
canvas-component-composabilitycomponent.yml grammar—use
canvas-component-metadata.canvas-component-composability.testing
Use for any task touching site chrome — header, footer, sidebar, or global navigation that repeats across pages — and for any region-spec work (create, modify, review, validate region JSON, or the project-level layout component). Also load when a task creates or edits multiple pages that share chrome, or asks for a "site" or "navigation between pages"; shared chrome belongs in regions, never inlined into page JSON.
content-media
Create and modify content templates that map Drupal content entities to Canvas component layouts. Use when asked to (1) Create a new content template, (2) Modify an existing content template, (3) Add or change entity field mappings in a template, (4) Compose components in a content template via slots. Content templates live in the configured `contentTemplatesDir` (default `content-templates/`) and define how Drupal entity types, bundles, and view modes render as Canvas component trees.
tools
Plans and builds Drupal Canvas navigation UI (main nav, footer links, sidebar nav, mobile drawers, breadcrumbs) using design decomposition for structure and props/slots, then JSON:API menu or page-context patterns from canvas-data-fetching. Use when the user asks for navigation, header or footer links, menus, menu_items, mobile nav, or breadcrumb trails. Run after canvas-design-decomposition for layout and API sketches; follow canvas-data-fetching for SWR, JsonApiClient, sortMenu, and menu fallbacks.
development
Use when work must be verified in local Canvas Workbench, or when the user asks to run, open, check, or author component mocks or page previews in Workbench. Verifies that Canvas Workbench is available through the project's package runner, starts the local Workbench dev server, and keeps Workbench verification as part of the implementation workflow.