code-debug-skill
予期せぬ動作や問題発生時に、仮説に基づいた標準的な調査手順で、原因特定に必要な情報を計画的に収集・比較し、ベンダーや環境に依存せず根本原因を効率的に突き止めるSkill。
📜 元の英語説明(参考)
Standardized, hypothesis-driven debug investigation workflow for unexpected behavior, regressions, incidents, flaky tests, or production issues. Use to plan instrumentation, reproduce with decisive signals, compare runs, and narrow root cause without assuming any vendor or infrastructure.
🇯🇵 日本人クリエイター向け解説
予期せぬ動作や問題発生時に、仮説に基づいた標準的な調査手順で、原因特定に必要な情報を計画的に収集・比較し、ベンダーや環境に依存せず根本原因を効率的に突き止めるSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o code-debug-skill.zip https://jpskill.com/download/8822.zip && unzip -o code-debug-skill.zip && rm code-debug-skill.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8822.zip -OutFile "$d\code-debug-skill.zip"; Expand-Archive "$d\code-debug-skill.zip" -DestinationPath $d -Force; ri "$d\code-debug-skill.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
code-debug-skill.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
code-debug-skillフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
バグ調査スキル
調査の心構え (考え方)
- 事実を最優先とする。常に観察と推論を区別する。
- 複数の競合する仮説を維持し、可能性と影響によってランク付けする。
- 各仮説について、以下を定義する。
- 予測 (真実であれば観察されるべきこと)、
- 反証可能性 (反証となること)、
- 必要な計測 (測定またはログに記録するもの)。
- 物語よりも決定的なシグナルを優先する。証拠を収集する計画なしに再現を求めない。
- 比較 (失敗 vs 成功) と可能な場合はバイナリサーチスタイルのアプローチで絞り込む。
- 1回の再現実行で決定的なシグナルをキャプチャするために、デバッグ計測を惜しみなく追加する。
- 各再現はコストがかかると仮定する。追加の実行を必要とせずに根本原因を絞り込むのに十分な計測を行う。
- 決して推測的にコードを修正しない。本番コードを変更する前に、証拠で根本原因を確認する。
ツールの選択 (何を使用するか)
- 新しい計測の主要なツール: ローカル HTTP インジェストロガー (
debugsk)。- AI は、計測の前に
npx debugsk@latest server start --jsonを介してサーバーを起動する必要がある。 - JSON 出力を使用して、スニペットとエンドポイントをコピーする。
- サーバーは CORS プリフライト (OPTIONS) を受け入れるため、デフォルトの JSON スニペットはオリジン間で機能する。
- AI は、計測の前に
- AI は sessionId/runId を自動生成し、計測コードに直接埋め込む必要がある。
- コンソールからこれらを設定するようにユーザーに依頼しないでください。
- 再現が可能な場合は、予測を直接テストするログ/メトリクスを優先する。
- 再現が不可能な場合は、既存のシグナルにピボットする。
- ログ/メトリクス/トレース、構成差分、データスナップショット、ダンプ、および決定論的なプローブ。
- ネイティブシグナルが質問に答えない場合は、新しい観察のために
debugskを優先する。- これにより、ネイティブロギングが汚染されるのを防ぎ、調査ログを分離する。
- 新しい計測に加えて、ネイティブログをリファレンスとして使用する。
運用原則
- 事実 (観察されたこと) と仮説 (推論されたこと) を分離する。
- 証拠がそれらを排除するまで、複数の競合する仮説を維持する。
- 各仮説について、予測、反証可能性、および必要な計測を定義する。
- AI は、サーバーの起動、ID の生成、ログの収集、分析など、自動化可能なすべてのタスクを実行する。
- ユーザーは、自動化できない UI アクション (クリック、フォーム入力など) のみを実行する。
- 計測計画が準備できるまで、再現を求めない。
コア ループ
- バグを正確に明確にする。
- 環境 (ローカル/ステージング/本番)、バージョン/コミット、頻度、影響。
- 最小限の再現手順、期待される動作と実際の動作、エラーとタイムスタンプ。
- 候補のコードパスを特定する。
- エンドポイント/ルート/機能/構成キー/エラテキストで検索する。
- リクエスト → ハンドラー → データ/依存関係をマッピングする。
- 少なくとも 3 つの仮説を生成する。
- クライアント/入力、サーバーロジック、データ/状態、並行性、構成、依存関係、リソース。
- デバッグサーバーを起動し、ID を生成する。
npx debugsk@latest server start --jsonを実行してエンドポイントを取得する。- sessionId/runId を自動生成し、計測コードに埋め込む。
- 仮説を検証するために計測する。
- 意思決定ポイントと境界にログ/メトリクスを追加する。
- 自動生成された相関キーを含める (ユーザーアクションは不要)。
- 制御された再現を実行する。
- AI は必要に応じてサーバーを起動する。
- ユーザーに UI 手順 (クリック、ドラッグ、送信など) のみを提供する。
- コンソールコマンド、ファイル操作は不要。
- ログを収集して分析する。
- AI は Read/Grep ツールを使用してログファイルを直接読み取る。
- 成功した実行と失敗した実行を比較する。
- 可能な場合は、バイナリサーチスタイルの絞り込みを優先する。
- 根本原因が確認されるまで繰り返す。
計測ポリシー
- 利用可能な場合は、ローカル HTTP インジェストロガーを優先する。それ以外の場合は、既存のロギングと統合する。
- ネイティブシグナルが不十分な場合は、より多くのネイティブログを追加するよりも
debugskを優先する。 - 追加された計測に加えて、ネイティブログをリファレンスとして使用する。
- ログは決して例外をスローしてはならず、シークレット/PII を避け、削除しやすいようにする。
- すべてのイベントで、場所、メッセージ、タイムスタンプ、および相関フィールドを記録する。
- すべてのログイベントに、常にすべてのログフィールド (タイムスタンプ、メッセージ、sessionId、runId、hypothesisId、場所) を含める必要があります。フィールドを省略しないでください。
- 環境フラグの背後に計測を保護しないでください。調査のためにログを書き込み、完了後に削除する。
- AI はデバッグサーバーを起動し、ID を生成し、計測を挿入し、ログを収集/分析する。
- ユーザーは UI アクション (クリック、フォーム入力など) のみを実行する。コンソールコマンド、ファイル操作は不要。
ユーザーインタラクションのルール
- ユーザーの負担を最小限に抑える。AI は、自動化可能なすべてのタスクを実行する。
- デバッグサーバーの起動/停止
- sessionId/runId の生成と埋め込み
- ログファイルの読み取りと分析
- トンネリングが必要かどうかを判断する (環境を検査し、質問しない)
- ユーザーは、自動化できない UI アクションのみを実行する。
- ボタンをクリックし、要素をドラッグし、フォームに入力する
- 画面をナビゲートする
- 目に見える動作を観察する
- 再現が必要な場合は、UI 手順のみを提供する。コンソールコマンド、ファイル操作は不要。
- 再現が不可能な場合は、既存のログ、メトリクス、トレース、構成差分、または安全なプローブにピボットする。
- 外部/モバイルアクセスの場合、AI は環境検査に基づいてトンネリングの必要性を判断する。
- リモート/ステージングの場合: 既存のトンネルを確認するか、特定の設定を提案する
- 「トンネルを使用する必要がありますか?」のようなオープンエンドな質問はしないでください。
クリーンアップポリシー
- ユーザーが問題が解決されたか、調査が終了したことを確認したら、デバッグサーバーを停止し、すべての調査ログ (例:
.logs/) を削除する。 - ログの削除に
git checkout、git clean、またはその他のバルク git クリーンアップを使用しないでください。ファイルを明示的かつ安全に削除します。 - 削除が関係のないファイルに影響を与える可能性がある場合は、削除前に正確なパスを確認してください。
レポート形式
assets/report-template.md のテンプレートを使用してください。見出しはバイリンガル (英語/日本語) です。コンテンツはユーザーの言語で記述してください。
参考文献
- 計測を追加または検証するときは、
references/logging-schema.mdを使用してください。 - `references/hyp
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Bug Investigation Skill
Investigation mindset (how to think)
- Treat facts as primary. Separate observations from inferences at all times.
- Keep multiple competing hypotheses and rank them by likelihood and impact.
- For each hypothesis, define:
- prediction (what must be observed if true),
- falsifier (what would disprove it),
- required instrumentation (what to measure or log).
- Prefer decisive signals over narratives. Do not ask for reproduction without a plan to capture evidence.
- Narrow with comparisons (fail vs pass) and a binary-search style approach when possible.
- Add debug instrumentation generously to capture decisive signals in a single reproduction run.
- Assume each reproduction is costly; instrument enough to narrow root cause without requiring additional runs.
- Never fix code speculatively. Confirm root cause with evidence before any production code change.
Tool selection (what to use)
- Primary tool for new instrumentation: local HTTP ingest logger (
debugsk).- AI MUST start the server via
npx debugsk@latest server start --jsonbefore instrumentation. - Use the JSON output to copy the snippet and endpoint.
- The server accepts CORS preflight (OPTIONS), so the default JSON snippet works across origins.
- AI MUST start the server via
- AI MUST auto-generate sessionId/runId and embed them directly into instrumentation code.
- Do NOT ask the user to set these via console.
- If reproduction is possible, prioritize logs/metrics that directly test predictions.
- If reproduction is not possible, pivot to existing signals:
- logs/metrics/traces, config diffs, data snapshots, dumps, and deterministic probes.
- If native signals do not answer the question, prefer
debugskfor new observations.- This avoids contaminating native logging and keeps investigation logs isolated.
- Use native logs as reference in addition to new instrumentation.
Operating principles
- Separate facts (observed) from hypotheses (inferred).
- Maintain multiple competing hypotheses until evidence eliminates them.
- For each hypothesis, define predictions, falsifiers, and required instrumentation.
- AI performs all automatable tasks: server start, ID generation, log collection, analysis.
- User performs ONLY non-automatable UI actions (clicks, form inputs, etc.).
- Do not ask for reproduction until an instrumentation plan is ready.
Core loop
- Clarify the bug precisely:
- Environment (local/staging/production), version/commit, frequency, impact.
- Minimal reproduction steps, expected vs actual, errors and timestamps.
- Identify candidate code paths:
- Search by endpoint/route/feature/config key/error text.
- Map request → handler → data/dependencies.
- Generate at least three hypotheses:
- Client/input, server logic, data/state, concurrency, config, dependency, resource.
- Start debug server and generate IDs:
- Run
npx debugsk@latest server start --jsonto get endpoint. - Auto-generate sessionId/runId and embed in instrumentation code.
- Run
- Instrument to validate hypotheses:
- Add logs/metrics at decision points and boundaries.
- Include auto-generated correlation keys (no user action required).
- Execute controlled reproduction:
- AI starts servers if needed.
- Provide ONLY UI steps to the user (click, drag, submit, etc.).
- NO console commands, NO file operations.
- Collect and analyze logs:
- AI reads log files directly using Read/Grep tools.
- Compare successful vs failing runs.
- Prefer binary search-style narrowing when possible.
- Iterate until root cause is confirmed.
Instrumentation policy
- Prefer a local HTTP ingest logger when available; otherwise integrate with existing logging.
- If native signals are insufficient, prioritize
debugskover adding more native logs. - Use native logs as reference alongside the added instrumentation.
- Logs must never throw, avoid secrets/PII, and be easy to remove.
- Record location, message, timestamp, and correlation fields in every event.
- YOU MUST ALWAYS include all log fields (timestamp, message, sessionId, runId, hypothesisId, location) in every log event. Never omit any field.
- Do not guard instrumentation behind environment flags. Write logs for the investigation, then remove them after completion.
- AI starts the debug server, generates IDs, inserts instrumentation, and collects/analyzes logs.
- User performs ONLY UI actions (clicks, form inputs, etc.). NO console commands, NO file operations.
User interaction rules
- MINIMIZE user burden. AI performs all automatable tasks:
- Start/stop debug server
- Generate and embed sessionId/runId
- Read and analyze log files
- Determine if tunneling is needed (inspect environment, don't ask)
- User performs ONLY non-automatable UI actions:
- Click buttons, drag elements, fill forms
- Navigate screens
- Observe visible behavior
- When reproduction is required, provide ONLY UI steps. NO console commands, NO file operations.
- If reproduction is not possible, pivot to existing logs, metrics, traces, config diffs, or safe probes.
- For external/mobile access, AI determines tunneling need based on environment inspection:
- If remote/staging: check existing tunnels or propose specific setup
- Do NOT ask open-ended "should we use tunnel?" questions
Cleanup policy
- When the user confirms the issue is resolved or the investigation is closed, stop the debug server and delete all investigation logs (e.g.,
.logs/). - Do not use
git checkout,git clean, or other bulk git cleanup for log deletion. Remove files explicitly and safely. - If deletion could affect unrelated files, confirm the exact paths before removal.
Reporting format
Use the template in assets/report-template.md. Headings are bilingual (English / Japanese); write content in the user's language.
References
- Use
references/logging-schema.mdwhen adding or validating instrumentation. - Use
references/hypothesis-template.mdto structure hypotheses and predictions.