.agents/skills/canvas-component-definition/SKILL.md
Start here for any React component task to enforce the canonical Canvas component contract. Use for create, modify, refactor, review, migrate, or validate work. Establishes the canonical Canvas component contract, assuming repository components are Canvas targets, and guides either (1) transforming existing components to meet Canvas requirements or (2) creating new Canvas-ready components.
npx skillsauth add balintbrews/canvas-starter canvas-component-definitionInstall 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.
A Canvas component is a package of:
index.jsx)component.yml)machineName, folder path, Workbench
mock path)The first four parts are required for the component to be usable in Drupal
Canvas. Workbench mocks are the supported way to author named preview states
beyond Workbench's built-in Default tab.
Every Canvas component MUST satisfy all checks below:
<components-root>/<machine-name>/ (use the
repository's configured components root, which may be defined in .env)<components-root>/<machine-name>/index.jsx<components-root>/<machine-name>/component.ymlcomponent.yml includes required top-level keys (name, machineName,
status, required, props, slots)machineName in component.yml (kebab-case)If any item is missing, the component is incomplete for Canvas usage.
For local authoring and review, add a matching Workbench mock file beside the component source and metadata:
mocks.json beside index.jsx and component.ymlDefault tab, which renders the component using the first
example value for each prop from component.ymlUse references/naming.md for naming rules and examples.
Use references/workbench-mocks.md for mock naming, placement, format
selection, and validation.
Evaluate using companion skills in this order.
canvas-component-metadata
component.yml, props/slots, enums, or fixing
prop validation errors.canvas-component-composability
canvas-styling-conventions
canvas-component-utils
FormattedText and
Image.canvas-data-fetching
canvas-component-push
development
Use when work must be verified in local Canvas Workbench, or when the user asks to run, open, or check a component 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.
tools
Style Canvas components with Tailwind CSS 4 theme tokens and approved utility patterns. Use when (1) Creating a new component, (2) Adding colors or styling to components, (3) Working with Tailwind theme tokens, (4) Adding or updating design tokens in global.css, (5) Creating color/style props, (6) Any change where component props are added/removed/renamed/retyped and can affect rendered styles. Covers @theme variables, CVA variants, and cn() utility.
tools
Fetch and render Drupal content in Canvas components with JSON:API and SWR patterns. Use when building content lists, integrating with SWR, or querying related entities. Covers JsonApiClient, DrupalJsonApiParams, relationship handling, and filter patterns.
tools
Use utility components to render formatted text and media correctly. Use when (1) Rendering HTML text content from props, (2) Displaying images, (3) Working with formatted text or media. Covers FormattedText and Image utilities.