workday/canvas-kit/sana-canvas-kit-contribute-component
Claude Code and agent skill by workday/canvas-kit
- community
Checking that the SKILL.md file is still in the repository.
Maintainer workflow for adding a new component to the canvas-kit repo itself (modules/react, modules/preview-react, modules/labs-react) from a GitHub issue and Figma spec: research sibling components, propose a plan, scaffold the package, build with collection models and Sana-aligned stencils, add stories/tests/SSR/Cypress, validate, and write the PR summary. Use when the user asks to implement a Canvas Kit GitHub issue, create a new Canvas Kit component, or contribute a component to the library. Not for consumer apps — use /sana-canvas-kit-builder there.
Install
npx vskill@latest install workday/canvas-kit/sana-canvas-kit-contribute-componentSKILL.md
Contribute a Component to Canvas Kit
Maintainer-only. This covers building a component inside the canvas-kit repo, where AGENTS.md and STYLE.md apply (system.legacy.* in lib/, cornerShapeStencil, Chromatic class twins, public API impact). For components in a consumer app, use /sana-canvas-kit-builder instead.
Factory patterns → /sana-canvas-kit-builder. Token roles → /sana-canvas-kit-tokens. A11y patterns → /sana-canvas-kit-accessibility. This skill adds the repo-specific workflow on top.
When to apply
- "Implement GitHub issue #NNNN" for a new Canvas Kit component
- "Create a
<Name>component in Canvas Kit" / "add<Name>to modules/react" - Iterating on a new component's visuals to match the current Sana design
Workflow
Copy this checklist and track progress:
1. Gather the spec
Figma (via the Figma MCP):
- Call
get_metadataon the spec page node from the issue link. Page/canvas-level nodes often fail
with get_design_context; metadata gives you the child instance IDs and usually a Documentation text node with anatomy, states, and a11y guidance — read it in full.
- Call
get_design_context(withdisableCodeConnect: true) on one instance per state
(unselected, selected, disabled, error…). The output is Tailwind reference code: translate the var(--cnvs-sys-…) names to tokens; never copy Tailwind or raw px.
Labels like needs-design / needs-a11y don't block work, but every decision you make in those areas becomes a TODO in the PR summary, not a silent guess in code.
2. Branch and tier
- New additive component →
prerelease/minor. Breaking changes →prerelease/majoronly. Check
git branch --show-current and flag a mismatch rather than assuming.
- Main (
modules/react) vs Preview (modules/preview-react) vs Labs: if the API is likely to
change after design/a11y review, ask whether Preview or Labs is the better home.
3. Study siblings
Read the closest existing components end to end (lib, hooks, stories, specs, Cypress) before writing anything. Pick siblings by behavior, not by name:
| Behavior | Read | |
|---|---|---|
| Compound component over a list with selection | modules/react/segmented-control, modules/react/tabs | |
| Selection model, roving focus, keyboard | modules/react/collection (useListModel, useSelectionListModel, useListItem*) | |
| Error / caution group ring, form wiring | modules/preview-react/radio (RadioGroup), modules/react/checkbox | |
| Sana selected / hover / focus item styling | modules/react/menu/lib/MenuItem.tsx | |
| Multi-selection examples | modules/react/collection/stories/mdx/examples/MultiSelection.tsx |
Before adding any utility (SSR-safe layout effect, focus helper, id helper), grep the repo for an existing one. If none exists, keep the local version private to the file that needs it.
4. Propose a plan — then stop
Present: public API (<Name>, <Name>.List, <Name>.Item, use<Name>Model), model config with defaults, ARIA roles per mode, keyboard behavior, styling approach, file list, and the open design/a11y questions. Wait for the user before editing.
5–7. Build
Use the file layout and model/hook rules in references.md. Key rules:
- Collection decision: if the component is a list, grid, or set of items with selection,
roving focus, or arrow-key navigation (SegmentedControl, Tabs, Menu), extend collection models — see references.md. Skip collection for a single control with no item set (button, banner, text field); use createModelHook alone.
- When using collection: extend
useListModel(oruseGridModel/useOverflowListModel); pick
singleSelectionManager / multiSelectionManager via config. createModelHook already provides should<Event> / on<Event> — don't reimplement them.
composeHooksruns right-to-left;useListItemRegistergoes last (except when a later
hook must override a prop register sets — see useSegmentedControlItem). Compose useListItemRovingFocus / useListItemSelect directly — never call them inside another createElemPropsHook body.
- Add
index.tsexports andexport * from './<name>'inmodules/react/index.ts.
8. Style for Sana
v16 Sana parity is where first drafts most often miss. Follow the checklist in references.md — it lists the token substitutions and patterns that typecheck and design review caught on SelectionGroup.
9–10. Stories and tests
See references.md for the required story set, MDX structure, and test conventions.
11. Validate
Compare every state in Storybook (with the Sana theme) side by side with the Figma instances from step 1. Typecheck passing does not mean it looks right.
12. PR summary
Use the template in references.md. Title format: feat(<scope>): Add <Name> component. Don't stage .cursor/ or .claude/ artifacts.
Anti-patterns
- ❌ Editing files before the user approves the plan
- ❌ Copying Tailwind / px values from Figma output instead of mapping to tokens
- ❌ Non-legacy
system.*tokens inlib/when asystem.legacy.*path exists - ❌ Inventing ARIA when a sibling component or APG pattern already covers it
- ❌ Shared helpers across example files (each example must be copy-pasteable)
- ❌ Inline JSX in the CSF file, DOM snapshot tests, or ad hoc markup in Cypress
- ❌ Touching tsconfig / build / CI config or unrelated MCP/generated files
- ❌ Using
yarn create-componentoutput as-is — its templates useBox, which new code must not
Additional resources
- references.md — file layout, Sana styling checklist, known gotchas, test
conventions, PR template
modules/docs/mdx/CREATING_COMPOUND_COMPONENTS.mdx,API_PATTERN_GUIDELINES.mdx,
DOCUMENTATION_GUIDELINES.mdx
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sana-canvas-kit-contribute-component/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/workday/canvas-kit/sana-canvas-kit-contribute-component)