‹ 首页

code-documenter

@jeffallan · 收录于 1 周前 · 上游提交 1 个月前

Generates, formats, and validates technical documentation — including docstrings, OpenAPI/Swagger specs, JSDoc annotations, doc portals, and user guides. Use when adding docstrings to functions or classes, creating API documentation, building documentation sites, or writing tutorials and user guides. Invoke for OpenAPI/Swagger specs, JSDoc, doc portals, getting started guides.

适合你,如果经常需要为代码编写或更新文档

/ 下载安装
code-documenter.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add jeffallan/claude-skills/code-documenter
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- jeffallan/claude-skills/code-documenter
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify jeffallan/claude-skills/code-documenter
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
10501GitHub stars
~1.1K最小装载
~9.7K含声明引用
~9.7K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 e8be415 · 表述以原文为准
它做什么

安装后,Claude 能自动为代码生成文档注释(如 Python 的 docstring、TypeScript 的 JSDoc),创建 OpenAPI/Swagger 接口规范,搭建文档站点,以及编写用户指南和教程。

什么时候触发

当你要求为函数或类添加文档注释、创建 API 文档、搭建文档站点,或编写入门指南和教程时触发。

装好后可以这样说
Claude 会为所有公共方法和属性添加 JSDoc。
技能原文 SKILL.md作者撰写 · MIT · e8be415

Code Documenter

Documentation specialist for inline documentation, API specs, documentation sites, and developer guides.

When to Use This Skill

Applies to any task involving code documentation, API specs, or developer-facing guides. See the reference table below for specific sub-topics.

Core Workflow
  1. Discover - Ask for format preference and exclusions
  2. Detect - Identify language and framework
  3. Analyze - Find undocumented code
  4. Document - Apply consistent format
  5. Validate - Test all code examples compile/run:
  6. Python: python -m doctest file.py for doctest blocks; pytest --doctest-modules for module-wide checks
  7. TypeScript/JavaScript: tsc --noEmit to confirm typed examples compile
  8. OpenAPI: validate spec with npx @redocly/cli lint openapi.yaml
  9. If validation fails: fix examples and re-validate before proceeding to the Report step
  10. Report - Generate coverage summary
Quick-Reference Examples
Google-style Docstring (Python)
def fetch_user(user_id: int, active_only: bool = True) -> dict:
    """Fetch a single user record by ID.

    Args:
        user_id: Unique identifier for the user.
        active_only: When True, raise an error for inactive users.

    Returns:
        A dict containing user fields (id, name, email, created_at).

    Raises:
        ValueError: If user_id is not a positive integer.
        UserNotFoundError: If no matching user exists.
    """
NumPy-style Docstring (Python)
def compute_similarity(vec_a: np.ndarray, vec_b: np.ndarray) -> float:
    """Compute cosine similarity between two vectors.

    Parameters
    ----------
    vec_a : np.ndarray
        First input vector, shape (n,).
    vec_b : np.ndarray
        Second input vector, shape (n,).

    Returns
    -------
    float
        Cosine similarity in the range [-1, 1].

    Raises
    ------
    ValueError
        If vectors have different lengths.
    """
JSDoc (TypeScript)
/**
 * Fetches a paginated list of products from the catalog.
 *
 * @param {string} categoryId - The category to filter by.
 * @param {number} [page=1] - Page number (1-indexed).
 * @param {number} [limit=20] - Maximum items per page.
 * @returns {Promise<ProductPage>} Resolves to a page of product records.
 * @throws {NotFoundError} If the category does not exist.
 *
 * @example
 * const page = await fetchProducts('electronics', 2, 10);
 * console.log(page.items);
 */
async function fetchProducts(
  categoryId: string,
  page = 1,
  limit = 20
): Promise<ProductPage> { ... }
Reference Guide

Load detailed guidance based on context:

| Topic | Reference | Load When | |-------|-----------|-----------| | Python Docstrings | references/python-docstrings.md | Google, NumPy, Sphinx styles | | TypeScript JSDoc | references/typescript-jsdoc.md | JSDoc patterns, TypeScript | | FastAPI/Django API | references/api-docs-fastapi-django.md | Python API documentation | | NestJS/Express API | references/api-docs-nestjs-express.md | Node.js API documentation | | Coverage Reports | references/coverage-reports.md | Generating documentation reports | | Documentation Systems | references/documentation-systems.md | Doc sites, static generators, search, testing | | Interactive API Docs | references/interactive-api-docs.md | OpenAPI 3.1, portals, GraphQL, WebSocket, gRPC, SDKs | | User Guides & Tutorials | references/user-guides-tutorials.md | Getting started, tutorials, troubleshooting, FAQs |

Constraints
MUST DO
  • Ask for format preference before starting
  • Detect framework for correct API doc strategy
  • Document all public functions/classes
  • Include parameter types and descriptions
  • Document exceptions/errors
  • Test code examples in documentation
  • Generate coverage report
MUST NOT DO
  • Assume docstring format without asking
  • Apply wrong API doc strategy for framework
  • Write inaccurate or untested documentation
  • Skip error documentation
  • Document obvious getters/setters verbosely
  • Create documentation that's hard to maintain
Output Formats

Depending on the task, provide:

  1. Code Documentation: Documented files + coverage report
  2. API Docs: OpenAPI specs + portal configuration
  3. Doc Sites: Site configuration + content structure + build instructions
  4. Guides/Tutorials: Structured markdown with examples + diagrams
Knowledge Reference

Google/NumPy/Sphinx docstrings, JSDoc, OpenAPI 3.0/3.1, AsyncAPI, gRPC/protobuf, FastAPI, Django, NestJS, Express, GraphQL, Docusaurus, MkDocs, VitePress, Swagger UI, Redoc, Stoplight

Documentation

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。