Write component jsdocs

From goorm-dev/vapor-ui · View interactive version

Write component jsdocs is an AI agent skill from the GitHub repository goorm-dev/vapor-ui. Guide for writing JSDoc comments on vapor-ui components and their props. Use when adding, reviewing, or fixing JSDoc on component tsx files or css.ts variant files. Covers where to place comments based on component pattern — standalone, compound root, compound sub-part, primitive vs combined part —

How to use this skill

Skill file

JSDoc Component Guide

JSDoc in vapor-ui is user-facing UI, not internal code comments. Write it for developers who encounter the component for the first time via documentation sites (Storybook Autodocs, etc.).

Core rules

Where to write

Placement depends on the component pattern. See references/guide.md for detailed patterns and examples.

| Target | File | Location |

| ----------------- | -------------------- | ----------------------------------------------------- |

| Component summary | {component}.tsx | Above export const X = forwardRef(...) |

| Individual props | {component}.tsx | Inside the interface or namespace Props |

| Variant groups | {component}.css.ts | On each variant key object inside componentRecipe() |

Do NOT write JSDoc on:

Pattern quick-reference

Component summary rules

  1. One single line — no line breaks inside the summary
  2. User perspective: what it is → when to use it
  3. No internal terms (memoized, wrapper, token-based, etc.)
  4. End with the rendered HTML element using backticks around the tag: "Renders a <button> element." or "Doesn't render its own HTML element.".
  5. Primitive vs combined part — a XxxPrimitive part describes the part itself. A part that assembles primitives (e.g. Tooltip.Popup over PortalPrimitive, PositionerPrimitive, PopupPrimitive) starts with "Combines A, B, and C into a single part.", then names the xxxElement props that replace each piece (if it has any), then the rendered element. See references/guide.md.

Prop description rules

  1. Don't repeat the prop name or its type
  2. Describe side effects and interactions with other props
  3. For numeric props: include unit and valid range
  4. For event handlers: specify the exact trigger condition, not just "handler"
  5. Put a default in code, not in JSDoc. The docs table reads defaultValue from code: the component's destructuring defaults, a literal written before the props spread, then the defaultVariants of the recipe that declares the variant. For a Base UI prop vapor-ui passes through untouched, it falls back to Base UI's own @default (see scripts/docs-extractor/README.md "Default values"). Never write inline Default: text; it stays in the description and repeats the table. Write an @default tag only when the extractor can't read the default from code, such as a prop forwarded to another vapor-ui component. A vapor-ui @default is dropped from the description and not read as a default, so it shows only in editor hover.
  6. children — say what goes in the slot, with an example ("Content shown inside the badge, such as a label or count."). For a function child, describe its arguments. Never write just "Children of the component" or restate ReactNode.
  7. Inherited Base UI props with no description (e.g. children, onClick) — re-declare the prop in the part's Props interface with the Base UI type (children?: BaseMenu.Trigger.Props['children']) and write the JSDoc there. The extractor prefers vapor-ui's own declaration. Turn export type Props = … into export interface Props extends … {} when needed.
  8. Repeated props (size, invalid, portalElement, …) — start from the shared phrase in references/guide.md and add only what differs for that component.

Review checklist

See the full checklist in references/guide.md.

Quick checklist:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.