writing-tsdocs

Adds TypeDoc comments to TypeScript source files across the Medusa codebase.

36.1k|5.2k|Updated Jan 18, 2020
One-click install
npx skills add https://github.com/medusajs/medusa --skill writing-tsdocs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-tsdocs
Source: https://github.com/medusajs/medusa/tree/main/.claude/skills/writing-tsdocs
Command: npx skills add https://github.com/medusajs/medusa --skill writing-tsdocs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing consistent, convention-compliant TSDoc comments across a large TypeScript monorepo is tedious and error-prone. This Skill applies Medusa's documentation standards to HTTP types, API routes, UI components, data models, service interfaces, JS SDK methods, providers, workflows, steps, and events without altering any code logic.

Core Features & Use Cases

  • File-type-aware documentation: Loads a dedicated reference guide for each of the 11 supported file categories, applying the correct tag set and depth for each.
  • Medusa custom tag support: Correctly uses custom tags like @featureFlag, @expandable, @since, @eventPayload, and @customNamespace defined in the project's tsdoc.json.
  • Strict safety constraints: Never documents unexported items, test files, or fabricates version numbers, and never modifies existing comments or code logic.
  • Use Case: After adding a new workflow in packages/core/core-flows/src, ask the assistant to document it, and it will load the workflows-steps reference and produce a compliant TSDoc block with @summary, hooks, and @example.

Quick Start

Add TSDoc comments to the exported workflow in packages/core/core-flows/src/cart/workflows/add-to-cart.ts following the Medusa documentation conventions.

Frequently Asked Questions about writing-tsdocs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add TSDoc comments to Medusa TypeScript files?

Identify the file's path pattern, load the matching reference guide, then add TSDoc blocks only to exported items. Each file type has its own depth rules, from minimal tags on API routes to full @param, @returns, and @example blocks on service methods.

What custom TSDoc tags does Medusa support?

Medusa defines custom tags in its tsdoc.json including @featureFlag, @expandable, @since, @apiIgnore, @schema, @tags, @version, @keep, @customNamespace, and @namespaceMember. Standard TypeDoc tags like @param, @returns, and @example are always allowed.

Should I document API route handlers with full JSDoc?

No. API route handlers in packages/medusa/src/api receive only minimal documentation: @featureFlag when the handler checks a feature flag, and @since when the route is new. Handlers with neither condition get no TSDoc at all.

When should I use the @since tag in TSDoc comments?

Use @since only when a version number is explicitly provided in the prompt and the export is new in the current commit diff. Never fabricate version numbers, and never add @since to pre-existing exports.

Can TSDoc comments be added to test files or private functions?

No. The conventions explicitly prohibit documenting test files such as *.spec.ts and __tests__ directories, as well as unexported or private items. Only exported interfaces, types, functions, and classes receive documentation.