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

documentation-fundamentals

READMEファイルやJSDocコメントなどのドキュメントをレビューする際に自動で起動し、「何を」ではなく「なぜ」を重視した記述になっているかを確認し、より意図や背景が伝わるドキュメント作成を支援するSkill。

📜 元の英語説明(参考)

Auto-invoke when reviewing README files, JSDoc comments, or inline documentation. Enforces "WHY not WHAT" principle.

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

一言でいうと

READMEファイルやJSDocコメントなどのドキュメントをレビューする際に自動で起動し、「何を」ではなく「なぜ」を重視した記述になっているかを確認し、より意図や背景が伝わるドキュメント作成を支援するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して documentation-fundamentals.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → documentation-fundamentals フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

ドキュメントの基礎 レビュー

「コードは HOW (どのように) を伝え、コメントは WHY (なぜ) を伝えます。コードが何をするかを説明するだけなら、みんなの時間を無駄にしています。」

適用するタイミング

このスキルは、以下の場合に有効にします。

  • README ファイルのレビューまたは作成
  • JSDoc/docstring コメントの記述
  • インラインコードコメント
  • API ドキュメント
  • アーキテクチャ決定記録

黄金律: WHAT (何) ではなく WHY (なぜ)

// ❌ BAD: 何を説明しているか (コードがすでにこれを言っている)
// カウンターを 1 増やす
counter++;

// ✅ GOOD: なぜを説明しているか (コードが提供できないコンテキスト)
// 初期値が 0 のエッジケースを考慮するために、検証の実行前にカウンターをインクリメントする必要がある
counter++;

README の構造 (5 つの必須事項)

すべての README は、次の質問に答える必要があります。

1. これは何か? (1 文)

「これはどのような問題を 1 文で解決しますか?」

## What

Figma のデザインを React コンポーネントに変換する CLI ツール。

2. なぜ存在するのか?

「このプロジェクトを動機付けた苦痛は何ですか?」

## Why

デザインを手動でコードに変換するには時間がかかり、不整合が生じます。
このツールはプロセスを自動化し、ピクセルパーフェクトなコンポーネントを保証します。

3. インストール方法

「動作するコピーアンドペーストの手順。」

## Installation

npm install your-package

4. 使い方

「動作する最も簡単な例。」

## Quick Start

npx your-tool --input design.fig --output ./components

5. 貢献方法 (オプション)

「オープンソースプロジェクトの場合。」

## Contributing

1. リポジトリをフォークする
2. 機能ブランチを作成する
3. プルリクエストを送信する

コメントの種類と使用するタイミング

関数/メソッドのドキュメント (JSDoc)

/**
 * メール形式を検証し、ドメインをブロックリストと照合します。
 *
 * @param email - 検証するメールアドレス
 * @returns 成功ステータスとエラーメッセージを含む ValidationResult
 *
 * @example
 * const result = validateEmail('user@example.com');
 * if (!result.success) {
 *   showError(result.error);
 * }
 *
 * Note: これは RFC 5322 の正規表現パターンを使用しており、使い捨てメールアドレスを防ぐために意図的に厳密になっています。
 */
function validateEmail(email: string): ValidationResult {
  // 実装
}

インラインコメント (WHY のみ)

// レート制限は 100/分ですが、再試行のヘッドルームを残すために 80 を使用します
const RATE_LIMIT = 80;

// 最新のアイテムが最初に表示されるように降順でソートします
// (PM からのビジネス要件 - チケット #1234 を参照)
items.sort((a, b) => b.date - a.date);

// HACK: API は日付を文字列として返すため、手動で解析する必要があります
// TODO: バックエンドの移行後 (2026 年第 2 四半期) に削除
const date = new Date(response.dateString);

ブロックコメント (複雑なロジック)

/*
 * 認証フロー:
 * 1. ローカルトークンキャッシュを確認する
 * 2. 期限切れの場合は、サイレントリフレッシュを試みる
 * 3. リフレッシュが失敗した場合は、ログインにリダイレクトする
 *
 * 長いセッション中にユーザーエクスペリエンスを中断しないように、再認証の代わりにリフレッシュトークンを使用します。
 */

よくある間違い (アンチパターン)

1. 明らかなことへのコメント

// ❌ BAD: 無意味なコメント
// name を "John" に設定する
const name = "John";

// ユーザーの年齢を取得する
const age = user.age;

// アイテムをループする
for (const item of items) { ... }

// ✅ GOOD: コメントは不要 (コードは自己説明的)
const name = "John";

2. 古いコメント

// ❌ BAD: コメントがコードと一致しない (危険!)
// 非アクティブなユーザーをフィルタリングする
const users = data.filter(u => u.role === 'admin');

// ✅ GOOD: コメントが現実と一致する
// 管理ビューに管理者ユーザーのみを表示する
const users = data.filter(u => u.role === 'admin');

3. マジックナンバーにコンテキストがない

// ❌ BAD: 86400 とは何ですか?
const expiresIn = 86400;

// ✅ GOOD: マジックを説明する
const SECONDS_PER_DAY = 86400;
const expiresIn = SECONDS_PER_DAY; // トークンは 24 時間後に期限切れになります

4. コメントアウトされたコード

// ❌ BAD: ファイルを汚染するデッドコード
// const oldImplementation = () => { ... };
// function deprecatedHelper() { ... }

// ✅ GOOD: 削除してください! Git はすべてを記憶しています

5. 空の README

<!-- ❌ BAD: 自動生成され、更新されない -->
# my-project

このプロジェクトは Create React App でブートストラップされました。

ソクラテス式質問

答えを与える代わりに、これらを尋ねてください。

  1. WHY (なぜ) であって WHAT (何) ではない: 「このコメントは、コードが伝えない何かを教えてくれますか?」
  2. 対象者: 「明日入社する開発者はこれを理解できますか?」
  3. メンテナンス: 「コードを変更した場合、このコメントを更新することを覚えていますか?」
  4. README: 「誰かが README の指示だけでこのプロジェクトを実行できますか?」
  5. JSDoc: 「開発者がこの関数を正しく使用するために知っておく必要のあることは何ですか?」
  6. 必要性: 「このコメントを削除した場合、何か失われるものはありますか?」

README テンプレート

# プロジェクト名

これが何をするかの 1 文の説明。

## Why

これが解決する問題とその重要性。

## Installation

npm install project-name

## Quick Start

動作する最小限のコード例。

## API

### functionName(param)

何をするかの説明。

**Parameters:**
- `param` (string): このパラメーターの目的

**Returns:** 返されるもの

**Example:**
```js
// 使用例

Configuration

利用可能なオプションとそのデフォルト値。

Contributing

貢献方法 (該当する場合)。

License

MIT (またはあなたのライセンス)


---

## JSDoc の必須事項

```typescript
/**
 * この関数が何をするかの簡単な説明。
 *
 * @param paramName - パラメーターの説明
 * @returns 戻り値の説明
 * @throws {ErrorType} このエラーが発生した場合
 * @example
 * // 使い方を示す
 * const result = myFunction('input');
 *
 * @see 類似機能の RelatedFunction
 * @deprecated 代わりに newFunction を使用してください (v2.0 以降)
 */

注意すべき危険信号

フラグ 質問
空の README 「新しい開発者は今すぐこのプロジェクトを実行できますか?」
// x を 5 に設定する 「このコメントは
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Documentation Fundamentals Review

"Code tells you HOW, comments tell you WHY. If you only explain what the code does, you're wasting everyone's time."

When to Apply

Activate this skill when:

  • Reviewing or creating README files
  • Writing JSDoc/docstring comments
  • Inline code comments
  • API documentation
  • Architecture decision records

The Golden Rule: WHY, Not WHAT

// ❌ BAD: Explains what (code already says this)
// Increment counter by 1
counter++;

// ✅ GOOD: Explains why (context the code can't provide)
// Counter must be incremented before validation runs
// to account for the edge case where initial value is 0
counter++;

README Structure (The 5 Essentials)

Every README must answer these questions:

1. What Is This? (1 sentence)

"What problem does this solve in one sentence?"

## What

A CLI tool that converts Figma designs to React components.

2. Why Does It Exist?

"What pain point motivated this project?"

## Why

Manually converting designs to code takes hours and introduces inconsistencies.
This tool automates the process, ensuring pixel-perfect components.

3. How to Install

"Copy-paste instructions that work."

## Installation

npm install your-package

4. How to Use

"The simplest possible example that works."

## Quick Start

npx your-tool --input design.fig --output ./components

5. How to Contribute (Optional)

"For open source projects."

## Contributing

1. Fork the repo
2. Create your feature branch
3. Submit a pull request

Comment Types & When to Use Them

Function/Method Documentation (JSDoc)

/**
 * Validates email format and checks domain against blocklist.
 *
 * @param email - The email address to validate
 * @returns ValidationResult with success status and error message
 *
 * @example
 * const result = validateEmail('user@example.com');
 * if (!result.success) {
 *   showError(result.error);
 * }
 *
 * Note: This uses the RFC 5322 regex pattern, which is intentionally
 * strict to prevent disposable email addresses.
 */
function validateEmail(email: string): ValidationResult {
  // Implementation
}

Inline Comments (Only for WHY)

// Rate limit is 100/min but we use 80 to leave headroom for retries
const RATE_LIMIT = 80;

// Sort descending because newest items should appear first
// (business requirement from PM - see ticket #1234)
items.sort((a, b) => b.date - a.date);

// HACK: API returns dates as strings, need to parse manually
// TODO: Remove after backend migration (Q2 2026)
const date = new Date(response.dateString);

Block Comments (Complex Logic)

/*
 * Authentication Flow:
 * 1. Check local token cache
 * 2. If expired, attempt silent refresh
 * 3. If refresh fails, redirect to login
 *
 * We use refresh tokens instead of re-authentication to avoid
 * disrupting the user experience during long sessions.
 */

Common Mistakes (Anti-Patterns)

1. Commenting the Obvious

// ❌ BAD: Useless comment
// Set name to "John"
const name = "John";

// Get the user's age
const age = user.age;

// Loop through items
for (const item of items) { ... }

// ✅ GOOD: No comment needed (code is self-explanatory)
const name = "John";

2. Outdated Comments

// ❌ BAD: Comment doesn't match code (dangerous!)
// Filter out inactive users
const users = data.filter(u => u.role === 'admin');

// ✅ GOOD: Comment matches reality
// Only show admin users in management view
const users = data.filter(u => u.role === 'admin');

3. No Context on Magic Numbers

// ❌ BAD: What is 86400?
const expiresIn = 86400;

// ✅ GOOD: Explains the magic
const SECONDS_PER_DAY = 86400;
const expiresIn = SECONDS_PER_DAY; // Tokens expire after 24 hours

4. Commented-Out Code

// ❌ BAD: Dead code polluting the file
// const oldImplementation = () => { ... };
// function deprecatedHelper() { ... }

// ✅ GOOD: Delete it! Git remembers everything

5. Empty README

<!-- ❌ BAD: Auto-generated, never updated -->
# my-project

This project was bootstrapped with Create React App.

Socratic Questions

Ask these instead of giving answers:

  1. WHY not WHAT: "Does this comment tell me something the code doesn't?"
  2. Audience: "Would a developer joining tomorrow understand this?"
  3. Maintenance: "If you change the code, would you remember to update this comment?"
  4. README: "Can someone run this project with just the README instructions?"
  5. JSDoc: "What would a developer need to know to use this function correctly?"
  6. Necessity: "If you delete this comment, is anything lost?"

README Template

# Project Name

One-sentence description of what this does.

## Why

The problem this solves and why it matters.

## Installation

npm install project-name

## Quick Start

Minimal code example that works.

## API

### functionName(param)

Description of what it does.

**Parameters:**
- `param` (string): What this parameter is for

**Returns:** What gets returned

**Example:**
```js
// Usage example

Configuration

Available options and their defaults.

Contributing

How to contribute (if applicable).

License

MIT (or your license)


---

## JSDoc Essentials

```typescript
/**
 * Brief description of what this function does.
 *
 * @param paramName - Description of parameter
 * @returns Description of return value
 * @throws {ErrorType} When this error occurs
 * @example
 * // Show how to use it
 * const result = myFunction('input');
 *
 * @see RelatedFunction for similar functionality
 * @deprecated Use newFunction instead (v2.0+)
 */

Red Flags to Call Out

Flag Question
Empty README "Can a new developer run this project right now?"
// Set x to 5 "Does this comment add value? The code already says this."
Outdated comments "Does this comment still match what the code does?"
No JSDoc on exports "How would someone know how to use this function?"
Commented-out code "Why is this here? Git has history if you need it back."
Magic numbers "What does 3600 mean? Why this number?"

Interview Connection

"I maintain comprehensive documentation including READMEs, JSDoc comments, and architecture decision records, ensuring code is maintainable by the entire team."

Documentation habits demonstrate:

  • Communication skills
  • Long-term thinking
  • Team player mentality
  • Senior-level maturity

MCP Usage

Context7 - Framework Docs

Fetch: JSDoc documentation
Fetch: Markdown best practices

Octocode - Real Examples

Search: README.md patterns in popular repos
Search: JSDoc examples in TypeScript projects