jpskill.com
✍️ ライティング コミュニティ

code-documenter

未整備なコードに対して、詳細なドキュメントやREADMEファイル、API仕様書などを自動生成し、コードの理解を助けることで、開発効率や保守性を向上させるSkill。

📜 元の英語説明(参考)

Generate comprehensive documentation for undocumented or poorly documented codebases. Use when a user asks to document code, add JSDoc/docstrings, create README files, generate architecture docs, explain what a codebase does, produce onboarding guides, or document internal APIs. Works with any language.

🇯🇵 日本人クリエイター向け解説

一言でいうと

未整備なコードに対して、詳細なドキュメントやREADMEファイル、API仕様書などを自動生成し、コードの理解を助けることで、開発効率や保守性を向上させるSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o code-documenter.zip https://jpskill.com/download/14763.zip && unzip -o code-documenter.zip && rm code-documenter.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14763.zip -OutFile "$d\code-documenter.zip"; Expand-Archive "$d\code-documenter.zip" -DestinationPath $d -Force; ri "$d\code-documenter.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して code-documenter.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → code-documenter フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

コードドキュメンター

概要

ソースコードを解析し、複数のレベルで正確でコンテキストを意識したドキュメントを生成します。具体的には、複雑なロジックに対するインラインコメント、関数/クラスのドキュメンテーション文字列、モジュールレベルの概要、アーキテクチャドキュメント、およびオンボーディングガイドです。制御フロー、データ変換、副作用、およびモジュール間の依存関係を理解します。

指示

コードのドキュメント化を依頼された場合:

  1. 必要なドキュメントのレベルを決定します:

    • インライン: 関数/メソッドのドキュメンテーション文字列、JSDoc、Python のドキュメンテーション文字列、Go のドキュメントコメント
    • モジュール: モジュールの目的とエクスポートを説明する README またはヘッダーコメント
    • アーキテクチャ: モジュール間の相互作用、データフロー、主要な設計上の決定を示す高レベルのドキュメント
    • オンボーディング: 新しいチームメンバー向けの入門ガイド
  2. 関数/メソッドのドキュメントの場合、以下を抽出します:

    • 目的: この関数は何をしますか? (一文で)
    • パラメータ: 名前、型、説明、デフォルト値、制約
    • 戻り値: 型、説明、可能な値
    • 副作用: データベースへの書き込み、API 呼び出し、ファイル I/O、状態の変更、キャッシュの無効化
    • 例外/エラー: 何がいつうまくいかなくなる可能性があるか、およびどのようなエラー型か
    • 使用例: 現実的なデータを使用した現実的な呼び出し
  3. 複雑なロジックについては、以下の説明をインラインコメントとして追加します:

    • WHY (なぜ) であり、WHAT (何) ではない — 明らかな操作ではなく、理由を説明します
    • 条件文に埋め込まれたビジネスルール
    • パフォーマンスが重要なセクションと、それらが特定の方法で記述されている理由
    • 利用可能な場合は、git の履歴にある issue/bug へのリンクを含む回避策
    • 自明ではないアルゴリズムの選択
  4. アーキテクチャドキュメントの場合:

    • モジュールの依存関係をマッピングします (imports/requires グラフ)
    • エントリーポイントを特定します (API ハンドラー、CLI コマンド、イベントリスナー)
    • システムを介した主要なデータフローをトレースします (例: "ユーザーサインアップ" フロー)
    • 構成と環境変数をドキュメント化します
    • 外部サービスへの依存関係をリストします (データベース、API、キュー)
    • 使用されているデザインパターンを記述します (repository pattern、event sourcing、CQRS など)
  5. 言語固有の形式:

    • TypeScript/JavaScript: @param, @returns, @throws, @example を使用した JSDoc
    • Python: Args, Returns, Raises セクションを含む Google スタイルのドキュメンテーション文字列
    • Go: Go の規約に従ったパッケージレベルおよびエクスポートされた関数のドキュメントコメント
    • Java: @param, @return, @throws を使用した Javadoc
    • Rust: # Examples セクションを含む /// ドキュメントコメント
  6. 品質ルール:

    • 明らかなことを決して記述しないでください ("カウンターを 1 ずつインクリメントする")
    • 実装ではなく、コントラクトをドキュメント化します (どのようにではなく、何を — ただし、どのようにが驚くべき場合は除く)
    • foo, bar, test123 ではなく、現実的な値の例を含めます
    • 複雑すぎる関数にフラグを立て、ドキュメント化する前にリファクタリングを提案します
    • ドキュメントが起こりうるバグを明らかにする場合 (例: 未処理の null ケース) は、その旨を記述します

例 1: Python 関数のドキュメント化

入力:

def process_payment(user_id, amount, currency, idempotency_key=None):
    user = db.users.find(user_id)
    if not user:
        raise ValueError("User not found")
    if user.balance < amount and not user.credit_enabled:
        return {"status": "declined", "reason": "insufficient_funds"}
    charge = stripe.charges.create(
        amount=int(amount * 100),
        currency=currency,
        customer=user.stripe_id,
        idempotency_key=idempotency_key
    )
    db.transactions.insert({
        "user_id": user_id, "amount": amount,
        "stripe_charge_id": charge.id, "created_at": datetime.utcnow()
    })
    if user.balance < amount:
        user.balance = user.balance - amount
        db.users.update(user)
    return {"status": "success", "charge_id": charge.id}

出力:

def process_payment(user_id, amount, currency, idempotency_key=None):
    """ユーザーの Stripe アカウントに請求して支払い処理を行います。

    ユーザーの残高を検証し (クレジットが有効になっていない場合)、Stripe の
    チャージを作成し、トランザクションを記録し、該当する場合はユーザーの内部残高から
    差し引きます。

    Args:
        user_id: 内部ユーザー識別子 (例: "usr_8f2k3j")。
        amount: 主要通貨単位での請求金額 (例: 49.99)。
        currency: ISO 4217 通貨コード (例: "usd", "eur")。
        idempotency_key: 再試行時に重複した請求を防ぐためのオプションのキー。
            すべての本番環境での呼び出しに推奨されます。

    Returns:
        dict: 成功した場合は {"status": "success", "charge_id": "ch_..."}、
              残高が低すぎてクレジットが有効になっていない場合は
              {"status": "declined", "reason": "insufficient_funds"}。

    Raises:
        ValueError: user_id がデータベース内のどのユーザーとも一致しない場合。
        stripe.error.CardError: カードが Stripe によって拒否された場合。
        stripe.error.InvalidRequestError: Stripe パラメータが無効な場合。

    Side Effects:
        - Stripe チャージを作成します (外部 API 呼び出し)
        - トランザクションテーブルに行を挿入します
        - ユーザーの残高を更新する場合があります

    Example:
        >>> result = process_payment("usr_8f2k3j", 49.99, "usd", idempotency_key="pay_retry_001")
        >>> result
        {"status": "success", "charge_id": "ch_3Kx9mPqR2s"}

    Note:
        ⚠ 潜在的なバグ: 残高の差し引きは balance < amount の場合にのみ発生しますが、
        チャージは常に実行されます。 balance >= amount の場合、ユーザーは Stripe 経由で
        請求されますが、内部残高は差し引かれません。
    """

例 2: アーキテクチャ概要の生成

入力:

src/services/notifications/ にある通知サービスのアーキテクチャをドキュメント化します

出力:

# 通知サービス — アーキテクチャ

## 目的
メール、プッシュ、およびアプリ内チャネル全体でユーザー通知を配信します。
テンプレートのレンダリング、配信スケジューリング、設定の確認、
および配信ステータスの追跡を処理します。

## モジュールマップ
  notifications/
  ├── router.ts          — 通知設定と履歴のための HTTP エンドポイント
  ├── service.ts         — コアオーケストレーション: チャネルを解決し、テンプレートをレンダリングし、

(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Code Documenter

Overview

Analyzes source code to generate accurate, context-aware documentation at multiple levels: inline comments for complex logic, function/class docstrings, module-level overviews, architecture documents, and onboarding guides. Understands control flow, data transformations, side effects, and cross-module dependencies.

Instructions

When asked to document code:

  1. Determine the documentation level needed:

    • Inline: Function/method docstrings, JSDoc, Python docstrings, Go doc comments
    • Module: README or header comment explaining the module's purpose and exports
    • Architecture: High-level document showing how modules interact, data flows, key design decisions
    • Onboarding: Getting-started guide for new team members
  2. For function/method documentation, extract:

    • Purpose: What does this function do? (one sentence)
    • Parameters: name, type, description, default values, constraints
    • Return value: type, description, possible values
    • Side effects: database writes, API calls, file I/O, state mutations, cache invalidation
    • Exceptions/errors: what can go wrong, when, and what error types
    • Example usage: realistic call with realistic data
  3. For complex logic, add inline comments explaining:

    • WHY, not WHAT — explain the reasoning, not the obvious operation
    • Business rules embedded in conditionals
    • Performance-critical sections and why they're written a certain way
    • Workarounds with links to issues/bugs if available in git history
    • Non-obvious algorithm choices
  4. For architecture documentation:

    • Map module dependencies (imports/requires graph)
    • Identify entry points (API handlers, CLI commands, event listeners)
    • Trace key data flows through the system (e.g., "user signup" flow)
    • Document configuration and environment variables
    • List external service dependencies (databases, APIs, queues)
    • Note design patterns used (repository pattern, event sourcing, CQRS, etc.)
  5. Language-specific format:

    • TypeScript/JavaScript: JSDoc with @param, @returns, @throws, @example
    • Python: Google-style docstrings with Args, Returns, Raises sections
    • Go: Package-level and exported function doc comments per Go conventions
    • Java: Javadoc with @param, @return, @throws
    • Rust: /// doc comments with # Examples sections
  6. Quality rules:

    • Never state the obvious ("Increments counter by 1")
    • Document the contract, not the implementation (what, not how — unless the how is surprising)
    • Include realistic example values, not foo, bar, test123
    • Flag functions that are too complex and suggest refactoring before documenting
    • Note when documentation reveals a likely bug (e.g., unhandled null case)

Examples

Example 1: Document a Python function

Input:

def process_payment(user_id, amount, currency, idempotency_key=None):
    user = db.users.find(user_id)
    if not user:
        raise ValueError("User not found")
    if user.balance < amount and not user.credit_enabled:
        return {"status": "declined", "reason": "insufficient_funds"}
    charge = stripe.charges.create(
        amount=int(amount * 100),
        currency=currency,
        customer=user.stripe_id,
        idempotency_key=idempotency_key
    )
    db.transactions.insert({
        "user_id": user_id, "amount": amount,
        "stripe_charge_id": charge.id, "created_at": datetime.utcnow()
    })
    if user.balance < amount:
        user.balance = user.balance - amount
        db.users.update(user)
    return {"status": "success", "charge_id": charge.id}

Output:

def process_payment(user_id, amount, currency, idempotency_key=None):
    """Process a payment by charging the user's Stripe account.

    Validates the user's balance (unless credit is enabled), creates a Stripe
    charge, records the transaction, and deducts from the user's internal balance
    if applicable.

    Args:
        user_id: Internal user identifier (e.g., "usr_8f2k3j").
        amount: Charge amount in major currency units (e.g., 49.99).
        currency: ISO 4217 currency code (e.g., "usd", "eur").
        idempotency_key: Optional key to prevent duplicate charges on retry.
            Recommended for all production calls.

    Returns:
        dict: {"status": "success", "charge_id": "ch_..."} on success,
              {"status": "declined", "reason": "insufficient_funds"} if balance
              is too low and credit is not enabled.

    Raises:
        ValueError: If user_id does not match any user in the database.
        stripe.error.CardError: If the card is declined by Stripe.
        stripe.error.InvalidRequestError: If Stripe parameters are invalid.

    Side Effects:
        - Creates a Stripe charge (external API call)
        - Inserts a row into the transactions table
        - May update the user's balance

    Example:
        >>> result = process_payment("usr_8f2k3j", 49.99, "usd", idempotency_key="pay_retry_001")
        >>> result
        {"status": "success", "charge_id": "ch_3Kx9mPqR2s"}

    Note:
        ⚠ Potential bug: balance deduction only happens when balance < amount,
        but the charge always goes through. If balance >= amount, the user is
        charged via Stripe but their internal balance is not deducted.
    """

Example 2: Generate architecture overview

Input:

Document the architecture of our notification service in src/services/notifications/

Output:

# Notification Service — Architecture

## Purpose
Delivers user notifications across email, push, and in-app channels.
Handles template rendering, delivery scheduling, preference checking,
and delivery status tracking.

## Module Map
  notifications/
  ├── router.ts          — HTTP endpoints for notification preferences and history
  ├── service.ts         — Core orchestration: resolves channel, renders template, dispatches
  ├── channels/
  │   ├── email.ts       — SendGrid integration (SMTP fallback)
  │   ├── push.ts        — Firebase Cloud Messaging
  │   └── in-app.ts      — WebSocket broadcast + database persistence
  ├── templates/
  │   ├── renderer.ts    — Handlebars template engine with i18n support
  │   └── templates/     — .hbs files organized by notification type
  ├── preferences.ts     — User channel preferences (opt-in/opt-out per type)
  └── queue.ts           — Bull queue consumer for async delivery

## Key Data Flow: Sending a Notification
  1. API call or internal event → service.send(userId, type, data)
  2. service.ts checks user preferences → skips opted-out channels
  3. renderer.ts renders template with user's locale
  4. Dispatch queued via Bull (Redis-backed) for reliability
  5. Channel adapter delivers and records status in notifications table

## External Dependencies
  - SendGrid API (email delivery)
  - Firebase Cloud Messaging (push notifications)
  - Redis (Bull queue backing store)
  - PostgreSQL (notification history, preferences, templates metadata)

## Environment Variables
  SENDGRID_API_KEY, FCM_SERVER_KEY, REDIS_URL, NOTIFICATION_FROM_EMAIL

Guidelines

  • Read the code before documenting — understand the actual behavior, not just function names.
  • When you spot bugs or inconsistencies during documentation, flag them explicitly.
  • Architecture docs should be useful to a new engineer on day 1 — no assumed context.
  • Keep docstrings focused on the contract. Move implementation details to inline comments.
  • For modules with no tests, note it: "⚠ No test coverage — documented behavior is inferred from code."
  • Update documentation when the code changes — stale docs are worse than no docs.