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

codebase-documenter

コードのドキュメント作成を支援し、READMEファイルやAPIドキュメント、コードコメントなどを、テンプレートやベストプラクティスを用いて分かりやすく作成することで、新規開発者がプロジェクトに参入しやすくするSkill。

📜 元の英語説明(参考)

This skill should be used when writing documentation for codebases, including README files, architecture documentation, code comments, and API documentation. Use this skill when users request help documenting their code, creating getting-started guides, explaining project structure, or making codebases more accessible to new developers. The skill provides templates, best practices, and structured approaches for creating clear, beginner-friendly documentation.

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

一言でいうと

コードのドキュメント作成を支援し、READMEファイルやAPIドキュメント、コードコメントなどを、テンプレートやベストプラクティスを用いて分かりやすく作成することで、新規開発者がプロジェクトに参入しやすくするSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して codebase-documenter.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → codebase-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
同梱ファイル
7

📖 Skill本文(日本語訳)

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

コードベースドキュメンター

概要

このスキルは、コードベース向けの包括的で初心者にもわかりやすいドキュメントの作成を可能にします。これは、新しいユーザーがプロジェクトを迅速に理解し、貢献するのに役立つ、構造化されたテンプレートと、README、アーキテクチャガイド、コードコメント、および API ドキュメントを作成するためのベストプラクティスを提供します。

初心者にもわかりやすいドキュメントのためのコア原則

新しいユーザー向けにコードをドキュメント化する場合は、次の基本原則に従ってください。

  1. 「なぜ」から始める - 実装の詳細に入る前に目的を説明する
  2. 段階的開示を使用する - 情報を単純なものから複雑なものへと段階的に提示する
  3. コンテキストを提供する - コードが何をするかだけでなく、なぜそれが存在するのかを説明する
  4. 例を含める - すべての概念について具体的な使用例を示す
  5. 事前の知識がないことを前提とする - 用語を定義し、可能な限り専門用語を避ける
  6. 視覚的な補助 - 図、フローチャート、およびファイルツリー構造を使用する
  7. クイックウィン - ユーザーが5分以内に何かを実行できるように支援する

ドキュメントの種類と使用するタイミング

1. README ドキュメント

作成するタイミング: プロジェクトのルートディレクトリ、主要な機能モジュール、またはスタンドアロンコンポーネントの場合。

従うべき構造:

# プロジェクト名

## これは何をするのか
[1〜2文のわかりやすい説明]

## クイックスタート
[ユーザーが5分以内にプロジェクトを実行できるようにする]

## プロジェクト構造
[説明付きの視覚的なファイルツリー]

## 主要な概念
[ユーザーが理解する必要があるコアコンセプト]

## 一般的なタスク
[頻繁な操作のためのステップバイステップガイド]

## トラブルシューティング
[一般的な問題と解決策]

ベストプラクティス:

  • プロジェクトの価値提案から始める
  • 実際に機能するセットアップ手順を含める(テストする!)
  • プロジェクト構造の視覚的な概要を提供する
  • 高度なトピックについては、より詳細なドキュメントへのリンクを貼る
  • ルートの README は、開始することに焦点を当てる

2. アーキテクチャドキュメント

作成するタイミング: 複数のモジュール、複雑なデータフロー、または自明ではない設計上の決定があるプロジェクトの場合。

従うべき構造:

# アーキテクチャの概要

## システム設計
[高レベルの図と説明]

## ディレクトリ構造
[各ディレクトリの目的の詳細な内訳]

## データフロー
[データがシステムをどのように移動するか]

## 主要な設計上の決定
[特定のアーキテクチャの選択が行われた理由]

## モジュール依存関係
[さまざまな部分がどのように相互作用するか]

## 拡張ポイント
[新しい機能を追加する場所と方法]

ベストプラクティス:

  • 図を使用して、システムコンポーネントと関係を示す
  • アーキテクチャ上の決定の背後にある「なぜ」を説明する
  • ハッピーパスとエラー処理の両方をドキュメント化する
  • モジュール間の境界を識別する
  • 注釈付きの視覚的なファイルツリー構造を含める

3. コードコメント

作成するタイミング: 複雑なロジック、自明ではないアルゴリズム、またはコンテキストが必要なコードの場合。

注釈パターン:

関数/メソッドのドキュメント:

/**
 * 部分的な請求期間の按分されたサブスクリプション費用を計算します。
 *
 * これが存在する理由: ユーザーは月の途中でサブスクライブできるため、
 * 現在の請求サイクルで残りの日数に対してのみ課金する必要があります。
 *
 * @param {number} fullPrice - 通常の月額サブスクリプション価格
 * @param {Date} startDate - ユーザーのサブスクリプションが開始される日時
 * @param {Date} periodEnd - 現在の請求期間の終了日
 * @returns {number} 請求する按分された金額
 *
 * @example
 * // ユーザーは1月15日にサブスクライブし、期間は1月31日に終了します
 * calculateProratedCost(30, new Date('2024-01-15'), new Date('2024-01-31'))
 * // 戻り値: 16.13 (31日中17日)
 */

複雑なロジックのドキュメント:

# このチェックが存在する理由: API は削除されたユーザーに対して null を返しますが、
# 名前を設定したことがないユーザーに対しては空の文字列を返します。監査ログのために、
# これらのケースを区別する必要があります。
if user_name is None:
    # ユーザーが削除されました - これをセキュリティイベントとしてログに記録します
    log_deletion_event(user_id)
elif user_name == "":
    # ユーザーはオンボーディングを完了していません - スキップしても安全です
    continue

ベストプラクティス:

  • 「何」ではなく「なぜ」を説明する - コードは何をするかを示している
  • エッジケースとビジネスロジックをドキュメント化する
  • 複雑な関数の例を追加する
  • 自明ではないパラメータを説明する
  • 注意点または直感的でない動作をメモする

4. API ドキュメント

作成するタイミング: HTTP エンドポイント、SDK メソッド、またはパブリックインターフェイスの場合。

従うべき構造:

## エンドポイント名

### 何をするのか
[エンドポイントの目的のわかりやすい説明]

### エンドポイント
`POST /api/v1/resource`

### 認証
[必要な認証とその提供方法]

### リクエスト形式
[JSON スキーマまたはリクエストの例]

### レスポンス形式
[JSON スキーマまたはレスポンスの例]

### 使用例
[curl/コードを使用した具体的な例]

### 一般的なエラー
[エラーコードとその意味]

### 関連エンドポイント
[関連する操作へのリンク]

ベストプラクティス:

  • 動作する curl の例を提供する
  • 成功とエラーの両方のレスポンスを示す
  • 認証を明確に説明する
  • レート制限と制約をドキュメント化する
  • 一般的な問題のトラブルシューティングを含める

ドキュメントワークフロー

ステップ 1: コードベースの分析

ドキュメントを作成する前に:

  1. エントリポイントを特定する - メインファイル、インデックスファイル、アプリの初期化
  2. 依存関係をマッピングする - モジュールが互いにどのように関連しているか
  3. コアコンセプトを見つける - ユーザーが理解する必要がある主要な抽象化
  4. 構成を見つける - 環境設定、構成ファイル
  5. 既存のドキュメントを確認する - そこにあるものを基に構築し、重複させない

ステップ 2: ドキュメントの種類を選択する

ユーザーのリクエストとコードベースの分析に基づいて:

  • 新しいプロジェクトまたは README がない → README ドキュメントから始める
  • 複雑なアーキテクチャまたは複数のモジュール → アーキテクチャドキュメントを作成する
  • 紛らわしいコードセクション → インラインコードコメントを追加する
  • HTTP/API エンドポイント → API ドキュメントを作成する
  • 複数の種類が必要 → 順番に対処する: README → アーキテクチャ → API → コメント

ステップ 3: ドキュメントを生成する

テンプレートを使用する fr

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Codebase Documenter

Overview

This skill enables creating comprehensive, beginner-friendly documentation for codebases. It provides structured templates and best practices for writing READMEs, architecture guides, code comments, and API documentation that help new users quickly understand and contribute to projects.

Core Principles for Beginner-Friendly Documentation

When documenting code for new users, follow these fundamental principles:

  1. Start with the "Why" - Explain the purpose before diving into implementation details
  2. Use Progressive Disclosure - Present information in layers from simple to complex
  3. Provide Context - Explain not just what the code does, but why it exists
  4. Include Examples - Show concrete usage examples for every concept
  5. Assume No Prior Knowledge - Define terms and avoid jargon when possible
  6. Visual Aids - Use diagrams, flowcharts, and file tree structures
  7. Quick Wins - Help users get something running within 5 minutes

Documentation Types and When to Use Them

1. README Documentation

When to create: For project root directories, major feature modules, or standalone components.

Structure to follow:

# Project Name

## What This Does
[1-2 sentence plain-English explanation]

## Quick Start
[Get users running the project in < 5 minutes]

## Project Structure
[Visual file tree with explanations]

## Key Concepts
[Core concepts users need to understand]

## Common Tasks
[Step-by-step guides for frequent operations]

## Troubleshooting
[Common issues and solutions]

Best practices:

  • Lead with the project's value proposition
  • Include setup instructions that actually work (test them!)
  • Provide a visual overview of the project structure
  • Link to deeper documentation for advanced topics
  • Keep the root README focused on getting started

2. Architecture Documentation

When to create: For projects with multiple modules, complex data flows, or non-obvious design decisions.

Structure to follow:

# Architecture Overview

## System Design
[High-level diagram and explanation]

## Directory Structure
[Detailed breakdown with purpose of each directory]

## Data Flow
[How data moves through the system]

## Key Design Decisions
[Why certain architectural choices were made]

## Module Dependencies
[How different parts interact]

## Extension Points
[Where and how to add new features]

Best practices:

  • Use diagrams to show system components and relationships
  • Explain the "why" behind architectural decisions
  • Document both the happy path and error handling
  • Identify boundaries between modules
  • Include visual file tree structures with annotations

3. Code Comments

When to create: For complex logic, non-obvious algorithms, or code that requires context.

Annotation patterns:

Function/Method Documentation:

/**
 * Calculates the prorated subscription cost for a partial billing period.
 *
 * Why this exists: Users can subscribe mid-month, so we need to charge
 * them only for the days remaining in the current billing cycle.
 *
 * @param {number} fullPrice - The normal monthly subscription price
 * @param {Date} startDate - When the user's subscription begins
 * @param {Date} periodEnd - End of the current billing period
 * @returns {number} The prorated amount to charge
 *
 * @example
 * // User subscribes on Jan 15, period ends Jan 31
 * calculateProratedCost(30, new Date('2024-01-15'), new Date('2024-01-31'))
 * // Returns: 16.13 (17 days out of 31 days)
 */

Complex Logic Documentation:

# Why this check exists: The API returns null for deleted users,
# but empty string for users who never set a name. We need to
# distinguish between these cases for the audit log.
if user_name is None:
    # User was deleted - log this as a security event
    log_deletion_event(user_id)
elif user_name == "":
    # User never completed onboarding - safe to skip
    continue

Best practices:

  • Explain "why" not "what" - the code shows what it does
  • Document edge cases and business logic
  • Add examples for complex functions
  • Explain parameters that aren't self-explanatory
  • Note any gotchas or counterintuitive behavior

4. API Documentation

When to create: For any HTTP endpoints, SDK methods, or public interfaces.

Structure to follow:

## Endpoint Name

### What It Does
[Plain-English explanation of the endpoint's purpose]

### Endpoint
`POST /api/v1/resource`

### Authentication
[What auth is required and how to provide it]

### Request Format
[JSON schema or example request]

### Response Format
[JSON schema or example response]

### Example Usage
[Concrete example with curl/code]

### Common Errors
[Error codes and what they mean]

### Related Endpoints
[Links to related operations]

Best practices:

  • Provide working curl examples
  • Show both success and error responses
  • Explain authentication clearly
  • Document rate limits and constraints
  • Include troubleshooting for common issues

Documentation Workflow

Step 1: Analyze the Codebase

Before writing documentation:

  1. Identify entry points - Main files, index files, app initialization
  2. Map dependencies - How modules relate to each other
  3. Find core concepts - Key abstractions users need to understand
  4. Locate configuration - Environment setup, config files
  5. Review existing docs - Build on what's there, don't duplicate

Step 2: Choose Documentation Type

Based on user request and codebase analysis:

  • New project or missing README → Start with README documentation
  • Complex architecture or multiple modules → Create architecture documentation
  • Confusing code sections → Add inline code comments
  • HTTP/API endpoints → Write API documentation
  • Multiple types needed → Address in order: README → Architecture → API → Comments

Step 3: Generate Documentation

Use the templates from assets/templates/ as starting points:

  • assets/templates/README.template.md - For project READMEs
  • assets/templates/ARCHITECTURE.template.md - For architecture docs
  • assets/templates/API.template.md - For API documentation

Customize templates based on the specific codebase:

  1. Fill in project-specific information - Replace placeholders with actual content
  2. Add concrete examples - Use real code from the project
  3. Include visual aids - Create file trees, diagrams, flowcharts
  4. Test instructions - Verify setup steps actually work
  5. Link related docs - Connect documentation pieces together

Step 4: Review for Clarity

Before finalizing documentation:

  1. Read as a beginner - Does it make sense without project context?
  2. Check completeness - Are there gaps in the explanation?
  3. Verify examples - Do code examples actually work?
  4. Test instructions - Can someone follow the setup steps?
  5. Improve structure - Is information easy to find?

Documentation Templates

This skill includes several templates in assets/templates/ that provide starting structures:

Available Templates

  • README.template.md - Comprehensive README structure with sections for quick start, project structure, and common tasks
  • ARCHITECTURE.template.md - Architecture documentation template with system design, data flow, and design decisions
  • API.template.md - API endpoint documentation with request/response formats and examples
  • CODE_COMMENTS.template.md - Examples and patterns for effective inline documentation

Using Templates

  1. Read the appropriate template from assets/templates/
  2. Customize for the specific project - Replace placeholders with actual information
  3. Add project-specific sections - Extend the template as needed
  4. Include real examples - Use actual code from the codebase
  5. Remove irrelevant sections - Delete parts that don't apply

Best Practices Reference

For detailed documentation best practices, style guidelines, and advanced patterns, refer to:

  • references/documentation_guidelines.md - Comprehensive style guide and best practices
  • references/visual_aids_guide.md - How to create effective diagrams and file trees

Load these references when:

  • Creating documentation for complex enterprise codebases
  • Dealing with multiple stakeholder requirements
  • Needing advanced documentation patterns
  • Standardizing documentation across a large project

Common Patterns

Creating File Tree Structures

File trees help new users understand project organization:

project-root/
├── src/                    # Source code
│   ├── components/        # Reusable UI components
│   ├── pages/             # Page-level components (routing)
│   ├── services/          # Business logic and API calls
│   ├── utils/             # Helper functions
│   └── types/             # TypeScript type definitions
├── public/                # Static assets (images, fonts)
├── tests/                 # Test files mirroring src structure
└── package.json           # Dependencies and scripts

Explaining Complex Data Flows

Use numbered steps with diagrams:

User Request Flow:
1. User submits form → 2. Validation → 3. API call → 4. Database → 5. Response

[1] components/UserForm.tsx
    ↓ validates input
[2] services/validation.ts
    ↓ sends to API
[3] services/api.ts
    ↓ queries database
[4] Database (PostgreSQL)
    ↓ returns data
[5] components/UserForm.tsx (updates UI)

Documenting Design Decisions

Capture the "why" behind architectural choices:

## Why We Use Redux

**Decision:** State management with Redux instead of Context API

**Context:** Our app has 50+ components that need access to user
authentication state, shopping cart, and UI preferences.

**Reasoning:**
- Context API causes unnecessary re-renders with this many components
- Redux DevTools helps debug complex state changes
- Team has existing Redux expertise

**Trade-offs:**
- More boilerplate code
- Steeper learning curve for new developers
- Worth it for: performance, debugging, team familiarity

Output Guidelines

When generating documentation:

  1. Write for the target audience - Adjust complexity based on whether documentation is for beginners, intermediate, or advanced users
  2. Use consistent formatting - Follow markdown conventions, consistent heading hierarchy
  3. Provide working examples - Test all code snippets and commands
  4. Link between documents - Create a documentation navigation structure
  5. Keep it maintainable - Documentation should be easy to update as code changes
  6. Add dates and versions - Note when documentation was last updated

Quick Reference

Command to generate README: "Create a README file for this project that helps new developers get started"

Command to document architecture: "Document the architecture of this codebase, explaining how the different modules interact"

Command to add code comments: "Add explanatory comments to this file that help new developers understand the logic"

Command to document API: "Create API documentation for all the endpoints in this file"

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。