home/roleplay/code-documentation

Code Documentation

GPTClaudeGemini··922 copies·updated 2026-07-14
code-documentation.prompt
---
title: Code Documentation Generator
category: development
tags: [documentation, code-docs, jsdoc, docstring, api-docs]
difficulty: intermediate
models: [claude, gpt-4, gemini, mistral]
---

# Code Documentation Generator

Generate comprehensive, standards-compliant documentation from source code
including function signatures, parameter descriptions, return types, and
usage examples.

## When to Use

- Documenting undocumented legacy codebases
- Generating API reference documentation from source
- Adding JSDoc, docstrings, or XML doc comments to existing functions
- Onboarding new developers who need to understand a module
- Preparing code for open-source release

## The Technique

Feed the model the raw code and specify the documentation standard. The model
infers intent from naming, types, and control flow, then produces documentation
that a human reviewer can verify and refine. The key is specifying audience and
doc style so the output matches your project conventions.

## Template

when to use it

Community prompt sourced from the open-source GitHub repo diShine-digital-agency/ai-prompt-library (MIT). A "Code Documentation" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

diShine-digital-agency/ai-prompt-library · MIT