mcpField
C
code-documentation

code-documentation

github.com/aj-geddesDevelopment375496 installsUpdated 35w ago
Repository

About code-documentation

A skill for writing code documentation with language-specific conventions, aimed at developers documenting APIs, functions, classes, and types. It emphasizes examples, accurate details, and maintainable comments.

Key features

  1. 01JSDoc, docstrings, and JavaDoc guidance
  2. 02Function and class documentation
  3. 03API and type documentation
  4. 04Examples, parameters, and return values

Use cases

  1. 01Documenting public functions and classes
  2. 02Creating API documentation from code
  3. 03Adding usage examples and error details

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill code-documentation

After installing, type/code-documentationin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
class-documentation-2.md
class-documentation.md
function-documentation-2.md
function-documentation.md
module-documentation.md
type-definitions.md
templates/
doc-template.md

Details

From the project README

Code Documentation

Table of Contents

Overview

Create clear, comprehensive code documentation using language-specific standards like JSDoc, Python docstrings, JavaDoc, and inline comments.

When to Use

  • Function and class documentation
  • JSDoc for JavaScript/TypeScript
  • Python docstrings
  • JavaDoc for Java
  • Inline code comments
  • API documentation from code
  • Type definitions
  • Usage examples in code

Quick Start

Minimal working example:

/**
 * Calculates the total price including tax and discount.
 *
 * @param {number} basePrice - The base price before tax and discount
 * @param {number} taxRate - Tax rate as a decimal (e.g., 0.08 for 8%)
 * @param {number} [discount=0] - Optional discount amount
 * @returns {number} The final price after tax and discount
 * @throws {Error} If basePrice or taxRate is negative
 *
 * @example
 * const price = calculateTotalPrice(100, 0.08, 10);
 * console.log(price); // 98
 *
 * @example
 * // Without discount
 * const price = calculateTotalPrice(100, 0.08);
 * console.log(price); // 108
 */
function calculateTotalPrice(basePrice, taxRate, discount = 0) {
  if (basePrice < 0 || taxRate < 0) {
    throw new Error("Price and tax rate must be non-negative");
  }
  return basePrice * (1 + taxRate) - discount;
}

// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Function DocumentationFunction Documentation
Class DocumentationClass Documentation
Type DefinitionsType Definitions
Function DocumentationFunction Documentation
Class DocumentationClass Documentation
Module DocumentationModule Documentation

Best Practices

✅ DO
  • Document public APIs thoroughly
  • Include usage examples
  • Document parameters and return values
  • Specify thrown exceptions/errors
  • Use language-specific standards (JSDoc, docstrings, etc.)
  • Keep comments up-to-date
  • Document "why" not "what"
  • Include edge cases and gotchas
  • Add links to related functions
  • Document type definitions
  • Use consistent formatting
❌ DON'T
  • State the obvious in comments
  • Leave commented-out code
  • Write misleading comments
  • Skip examples for complex functions
  • Use vague parameter descriptions
  • Forget to update docs when code changes
  • Over-comment simple code

Comments

Markdown supported