Skip to main content

Automated JSDoc & Markdown Documentation Generator (Autodoc)

1.1. Use Case Name

Automated JSDoc & Markdown Documentation Generator (Autodoc)

1.2. Tags

Autodoc

1.3. Introduction

This use case enables developers to automatically generate standardized JSDoc comments and comprehensive Markdown documentation for JavaScript functions. By analyzing the function's logic, parameters, and return types, the AI ensures consistent, high-quality documentation that improves code maintainability and team collaboration.

1.4. Outcome

  • Standardized JSDoc: Correctly tagged comments (@param, @returns, @example) inserted directly above the source code.
  • Technical Documentation: A clean Markdown file containing the function name, purpose, detailed logic flow, and usage examples.

1.5. Starter Prompt

# Environment
Language: JavaScript
Documentation Standards: JSDoc & Markdown

# Context
I have finished writing a function and need to document it for the team. [Paste your function code here, e.g., const addAuditFields = ...]

# Action
Analyze the logic of the provided function.
Generate a complete JSDoc block.
Create a technical guide in Markdown format.

# Output Format
JSDoc: Follow standard JavaScript tagging.
Markdown: Include Function Name, Description, Parameter List, Core Logic, and a Usage Example.

1.6. Inputs Required

  • Source Code: The specific JavaScript function or block of code to be documented.
  • Project Context (Optional): Brief info on where the function fits (e.g., "Utility for audit logs").

1.7. Prerequisites

  • Functional source code with basic logic implemented.
  • CodeVista extension installed and active in your IDE.

1.8. How to Use

  1. Copy the function code you want to document.
  2. Use the Starter Prompt template above and paste your code into the # Context section.
  3. Run the prompt in your AI assistant.
  4. Review the output, then copy the JSDoc into your source file and save the Markdown content to your project's documentation folder.