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

update-docs

直近のドキュメント更新以降のコード変更点を分析し、プロジェクトのドキュメントファイルを最新の状態に更新することで、新機能の実装後や重要なコミット前にドキュメントを整備するSkill。

📜 元の英語説明(参考)

Analyse code changes since the last docs update and refresh the project's documentation files. Use when code has changed and documentation needs to be updated, after implementing new features, or before a milestone commit.

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

一言でいうと

直近のドキュメント更新以降のコード変更点を分析し、プロジェクトのドキュメントファイルを最新の状態に更新することで、新機能の実装後や重要なコミット前にドキュメントを整備するSkill。

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

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

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

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

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

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

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

このワークフローは、コードが変更され、プロジェクトのドキュメントを最新の状態にする必要がある場合に使用します。エージェントは git を使用して、最後のドキュメントコミット以降の変更を検出し、diff を分析し、影響を受けたドキュメントのみを更新します。

このワークフローはプロジェクトに依存しません: プロジェクトのルートとドキュメントの場所を自動的に検出します。


ステップ 1 — 状況把握: プロジェクトの検出

// turbo プロジェクトのルートと基本的な構造を確立するために、以下を実行します。

# プロジェクトルートと現在のブランチ
git rev-parse --show-toplevel && git branch --show-current

# 過去5件のコミット (ベースラインを選択できるように)
git log --oneline -5

次に、ドキュメントがどこにあるかを見つけます。

# 一般的なドキュメントディレクトリのパターンを探す
find "$(git rev-parse --show-toplevel)" -maxdepth 3 -type d \
  \( -name "docs" -o -name "doc" -o -name "wiki" -o -name "pages" \) \
  ! -path "*/.git/*" ! -path "*/node_modules/*" ! -path "*/.venv/*"

# トップレベルの Markdown ファイルも確認する
find "$(git rev-parse --show-toplevel)" -maxdepth 1 -name "*.md" -type f

結果から、以下を特定します。

  • $ROOT: git のルートディレクトリ
  • $DOCS_DIR: ドキュメントファイルがある場所 (例: docs/src/docs/wiki/)

$DOCS_DIR を自動的に判別できない場合は、ユーザーに質問します: "ドキュメントファイルはどこにありますか? (例: docs/docs/src/、または README.md のみ)"


ステップ 2 — ベースラインコミットの検索

// turbo ドキュメントディレクトリを最後に変更したコミットを検索します。

git log --oneline --all -- "$DOCS_DIR" | head -5

最初のハッシュをメモし、それを <baseline> と呼びます。これは、ドキュメントが最新の状態であった最後の時点です。

ドキュメントのコミットが存在しない場合は、最初のコミットをベースラインとして使用します。

git log --oneline --all | tail -1

ステップ 3 — ベースライン以降のコードの差分を取得

// turbo まず、ソースコード (ドキュメントではない) で何が変更されたかの簡潔な概要を示します。

git diff <baseline> HEAD --stat -- . \
  ':!'"$DOCS_DIR" ':!*.md' ':!*.rst' ':!*.txt' ':!*.json'

差分が管理可能な場合は、完全な差分を取得します。

git diff <baseline> HEAD -- . \
  ':!'"$DOCS_DIR" ':!*.md' ':!*.rst' ':!*.txt' ':!*.json'

ヒント: 差分が約 400 行を超える場合は、次のコマンドを使用してファイルごとに分析します。

git diff <baseline> HEAD -- path/to/file.py

重点を置くのは、新しい/削除されたクラスまたは関数、変更されたメソッドシグネチャ、新しいモジュール、変更された構成キー、新しいデータファイルです。


ステップ 4 — 既存のドキュメント構造の発見

ステップ 1 で検出されたドキュメントファイルを読みます。以下を理解します。

  • 各ファイルがカバーするトピック
  • 各ファイルがドキュメント化するモジュール/コンポーネント/概念
  • 書き方 (言語、見出しレベル、コードブロックの使用、テーブル)

編集を行う際は、既存のドキュメントと同じスタイルと言語を維持してください。


ステップ 5 — 変更を影響を受けるドキュメントにマッピング

変更されたファイルまたはモジュールごとに、更新する必要があるドキュメントファイルを決定します。

一般的なマッピングのヒューリスティクス (特定のプロジェクト構造に合わせて調整):

コード変更の種類 更新するもの
新しいクラスまたはモジュールが追加された場合 そのレイヤーをカバーするアーキテクチャ/概要ドキュメントに追加します。依存関係図を更新します。
クラスまたは関数が削除された場合 それに言及しているすべてのドキュメントから削除または取り消します。
メソッドシグネチャ/パラメータが変更された場合 コード例、パラメータテーブルを更新します。
新しい構成キーまたは環境変数が追加された場合 構成ドキュメントを更新します。
新しい外部依存関係が追加された場合 セットアップ/インストールドキュメントを更新します。
データスキーマが変更された場合 (DB、JSON、Pydantic など) データモデルドキュメントを更新します。
新しい CLI コマンドまたはフラグ CLI リファレンス/使用法ドキュメントを更新します。
動作の変更 (アルゴリズム、ビジネスロジック) 設計/アーキテクチャドキュメントを更新します。
新しいテストカバレッジ (主要な新しいテスト) テストガイドが存在しない限り、通常はドキュメントの更新は不要です。

ステップ 6 — 影響を受けるドキュメントへの外科的な編集

古くなっているセクションのみを更新します。まだ正確なセクションは書き換えないでください。

編集ルール:

  • 差分に表示された新しい項目 (クラス、メソッド、パラメータ、構成キー) を追加します。
  • 名前が変更、削除、またはリファクタリングされたものの説明を削除または修正します。
  • 新しい現実を反映するように、フロー図、ステップバイステップのパイプライン、およびテーブルを更新します。
  • 差分によって触れられていないすべてのセクションを保持します — 無意味な書き換えは行いません。
  • 既存のドキュメントの書き方 (言語、書式設定、コードフェンスのスタイル) と正確に一致させます。

ステップ 7 — 変更の要約とオプションのコミット

すべての編集後、簡単な要約を表示します。

  • どのドキュメントファイルが変更されたか
  • 各ファイルで何が追加/削除/更新されたか

次に、ユーザーに質問します: "ドキュメントは更新されました。これらの変更を Git にコミットしますか?(Y/n)"

はいの場合は、次の形式でコミットメッセージを提案します。

docs: update <DOCS_DIR> to reflect changes since <baseline-short-hash>

次に、実行します (必要に応じて <DOCS_DIR><message> を置き換えます)。

git add <DOCS_DIR> && git commit -m "<message>"

いいえの場合は、すべてのファイルがすでに保存されており、後で次のコマンドでコミットできることをユーザーに思い出させます。

git add <DOCS_DIR> && git commit -m "docs: ..."
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Update Docs Workflow

Use this workflow whenever code has changed and the project documentation needs to be brought up to date. The agent uses git to detect what changed since the last documentation commit, analyses the diff, and updates only the affected docs.

This workflow is project-agnostic: it auto-detects the project root and documentation location.


Step 1 — Orient: detect the project

// turbo Run the following to establish the project root and basic structure:

# Project root and current branch
git rev-parse --show-toplevel && git branch --show-current

# Last 5 commits (so we can pick the baseline)
git log --oneline -5

Then find where the documentation lives:

# Look for common doc directory patterns
find "$(git rev-parse --show-toplevel)" -maxdepth 3 -type d \
  \( -name "docs" -o -name "doc" -o -name "wiki" -o -name "pages" \) \
  ! -path "*/.git/*" ! -path "*/node_modules/*" ! -path "*/.venv/*"

# Also check for top-level markdown files
find "$(git rev-parse --show-toplevel)" -maxdepth 1 -name "*.md" -type f

From the results, identify:

  • $ROOT: the git root directory
  • $DOCS_DIR: where the documentation files are (e.g. docs/src/, docs/, wiki/)

If $DOCS_DIR cannot be determined automatically, ask the user: "Where are your documentation files? (e.g. docs/, docs/src/, or README.md only)"


Step 2 — Find the baseline commit

// turbo Find the most recent commit that touched the documentation directory:

git log --oneline --all -- "$DOCS_DIR" | head -5

Note the first hash — call it <baseline>. This is the last point in time when docs were current.

If no doc commits exist, use the initial commit as baseline:

git log --oneline --all | tail -1

Step 3 — Get the code diff since the baseline

// turbo First, a compact summary of what changed in source code (not docs):

git diff <baseline> HEAD --stat -- . \
  ':!'"$DOCS_DIR" ':!*.md' ':!*.rst' ':!*.txt' ':!*.json'

If the diff is manageable, get the full diff:

git diff <baseline> HEAD -- . \
  ':!'"$DOCS_DIR" ':!*.md' ':!*.rst' ':!*.txt' ':!*.json'

Tip: If the diff exceeds ~400 lines, analyse it file by file using:

git diff <baseline> HEAD -- path/to/file.py

Focus on: new/deleted classes or functions, changed method signatures, new modules, changed configuration keys, new data files.


Step 4 — Discover existing documentation structure

Read the documentation files discovered in Step 1. Understand:

  • What topics each file covers
  • What module/component/concept each file documents
  • The writing style (language, heading level, use of code blocks, tables)

Maintain the same style and language as the existing docs when making edits.


Step 5 — Map changes to affected docs

For each changed file or module, determine which documentation file(s) need updating.

General mapping heuristics (adapt to the specific project structure):

Type of code change What to update
New class or module added Add it to whichever architecture/overview doc covers that layer; update dependency diagrams
Class or function deleted Remove or strike from all docs that mention it
Method signature / parameter changed Update code examples, parameter tables
New config key or environment variable Update configuration docs
New external dependency added Update setup/installation docs
Data schema changed (DB, JSON, Pydantic, etc.) Update data model docs
New CLI command or flag Update CLI reference / usage docs
Behaviour change (algorithm, business logic) Update design/architecture docs
New test coverage (major new tests) No doc update usually needed unless testing guide exists

Step 6 — Make surgical edits to affected docs

Update only the sections that are out of date. Do not rewrite sections that are still accurate.

Edit rules:

  • Add new items (classes, methods, parameters, config keys) that appeared in the diff
  • Remove or revise descriptions of things that were renamed, deleted, or refactored
  • Update flow diagrams, step-by-step pipelines, and tables to reflect new reality
  • Preserve all sections not touched by the diff — no gratuitous rewrites
  • Match the writing style of the existing doc exactly (language, formatting, code fence style)

Step 7 — Summarise changes and optionally commit

After all edits, display a brief summary:

  • Which doc files were modified
  • What was added / removed / updated in each

Then ask the user: "文档已更新。是否要将这些改动提交到 Git?(Y/n)"

If yes, suggest a commit message in the format:

docs: update <DOCS_DIR> to reflect changes since <baseline-short-hash>

Then run (replace <DOCS_DIR> and <message> accordingly):

git add <DOCS_DIR> && git commit -m "<message>"

If no, remind the user that all files are already saved and can be committed later with:

git add <DOCS_DIR> && git commit -m "docs: ..."