Skip to content
/docsStable

Auto-generates API documentation, JSDoc/TSDoc comments, README sections, and architecture diagrams from source code.

DocumentationDeveloper ExperienceΒ· 2 min read

Quick import: Download the .md file and save it to .claude/commands/ (Claude Code), .cursorrules (Cursor), or paste as a system prompt in ChatGPT, Gemini, or any LLM API.

#What it does

The /docs skill generates accurate, up-to-date documentation directly from your source code. It reads function signatures, type definitions, API routes, and component props to produce JSDoc comments, API reference docs, README sections, and usage examples. It writes documentation that stays in sync with the code because it is derived from the code.

#How to use

bash
/docs src/api/
bash
/docs --type api-reference src/routes/
bash
/docs --type readme

#Modes

  • inline (default) -- Adds JSDoc/TSDoc comments to exported functions, types, and components
  • api-reference -- Generates OpenAPI-style endpoint documentation with request/response schemas
  • readme -- Creates or updates README with project overview, setup instructions, and usage examples
  • architecture -- Produces a text-based architecture overview showing modules, dependencies, and data flow

#Workflow

  1. Scan -- Read the target files and extract all exported symbols: functions, classes, types, interfaces, React components, API routes
  2. Analyze -- Infer purpose from naming, parameters, return types, and usage patterns in the codebase
  3. Generate -- Write documentation that describes what each symbol does, its parameters, return values, and edge cases
  4. Validate -- Verify that documented types match actual signatures. Flag any any types or missing parameter descriptions
  5. Insert -- Place documentation inline (JSDoc) or generate separate doc files, depending on the mode

#Example

bash
> /docs src/lib/pricing.ts
 
## Generated documentation for 3 exports
 
### calculateDiscount(price: number, tier: CustomerTier): number
/**
 * Calculates the discount amount in cents based on customer tier.
 *
 * @param price - Original price in cents (must be positive)
 * @param tier - Customer loyalty tier: "bronze" | "silver" | "gold"
 * @returns Discount amount in cents. Returns 0 for unknown tiers.
 *
 * @example
 * calculateDiscount(10000, "gold") // returns 2000 (20% off)
 */

#What it does NOT do

  • Does not generate marketing copy or user-facing help docs
  • Does not create documentation for code that should be refactored instead of documented
  • Flags overly complex functions with a suggestion to simplify rather than document complexity
Orel OhayonΒ·
View all skills