jpskill.com
🛠️ 開発・MCP コミュニティ

bug-audit

Node.jsで構築されたWebプロジェクトのコードを詳細に分析し、ゲームやAPIサービスなど様々な種類のプロジェクトに特化したチェック項目を生成、網羅的に検証することで、バグや脆弱性を見つけ出し、品質とセキュリティを向上させるSkill。

📜 元の英語説明(参考)

Comprehensive bug audit for Node.js web projects. Activate when user asks to audit, review, check bugs, find vulnerabilities, or do security/quality review on a project. Works by dissecting the project's actual code to build project-specific check matrices, then exhaustively verifying each item — not by running a generic checklist. Supports games, data tools, WeChat apps, API services, bots, and dashboards.

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

一言でいうと

Node.jsで構築されたWebプロジェクトのコードを詳細に分析し、ゲームやAPIサービスなど様々な種類のプロジェクトに特化したチェック項目を生成、網羅的に検証することで、バグや脆弱性を見つけ出し、品質とセキュリティを向上させるSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して bug-audit.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → bug-audit フォルダができる
  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: 分析 (10-15 分)

すべてのプロジェクトファイルを読みます。7 つのテーブルを作成します。これらのテーブルが監査そのものです — ここで見つかったすべてのものがフェーズ 2 で検証されます。

テーブル 1: API エンドポイント

サーバーサイドコードのすべてのルートについて:

| # | Method | Path | Auth? | Params validated? | Precondition | Returns | Attack vector |

各エンドポイントについて、以下を尋ねます:

  • 認証なしでこれを呼び出すことはできますか?
  • 0、負の数、NaN、非常に大きな数、配列、オブジェクトを渡すことはできますか?
  • 前提条件となる API をスキップして、これを直接呼び出すことはできますか?
  • これを 1 秒間に 100 回呼び出すとどうなりますか?
  • レスポンスは機密データ (openid、内部 ID、完全なユーザーオブジェクト) をリークしますか?

テーブル 2: ステートマシン

すべての boolean/enum 型のステート変数 (isGameOver, battleState, Game.running, phase, mode...) について:

| # | Variable | Set by | Read by | Init value | Reset when? | Can it leak across lifecycles? |

各変数について、以下を尋ねます:

  • ゲーム/セッションが終了した場合、これはリセットされますか?
  • 新しいラウンドをすぐに開始した場合、前のラウンドからの古い状態が影響を与えますか?
  • セッター間に競合状態はありますか?

テーブル 3: タイマー

すべての setTimeout/setInterval について:

| # | Type | Delay | Created in | Cleared in | What if lifecycle ends before it fires? |

各タイマーについて、以下を尋ねます:

  • ハンドルはクリーンアップのために保存されていますか?
  • ゲームが終了した場合 / ユーザーが切断した場合 / ページが移動した場合、これはまだ発火しますか?
  • クリーンアップ後に発火した場合、破棄されたオブジェクトを参照しますか?

テーブル 4: 数値

すべてのユーザーが影響を与えられる数値 (cost, score, damage, lootValue, kills, quantity...) について:

| # | Name | Source (client/server/config) | Validated? | Min | Max | What if 0? | What if negative? |

各数値について、以下を尋ねます:

  • サーバー側の制限は現実的ですか? (kills の上限は 200 だが、敵の最大数は 50?)
  • クライアントは検証なしでサーバーが信頼する値を送信できますか?
  • 浮動小数点数の精度の問題はありますか? (累積された計算 → 290402.0000000001)

テーブル 5: データフロー (重要!)

関連する API のすべてのペア (buy→use, start→complete, pay→deliver, login→action) について:

| # | Step 1 API | Step 2 API | Token/link between them? | Can skip Step 1? | Can replay Step 1? |

ここに最大のバグが隠れています。各フローについて、以下を尋ねます:

  • Step 1 を呼び出さずに Step 2 を呼び出すことはできますか? (buy なしで raid-result)
  • Step 1 を 1 回呼び出して、Step 2 を何度も呼び出すことはできますか? (buy を 1 回、結果を 10 回送信)
  • それらをリンクする 1 回限りのトークンはありますか? そうでない場合、これは重大な脆弱性です。
  • cost=0 で Step 1 を呼び出し、高い報酬で Step 2 を呼び出すことはできますか?

テーブル 6: リソース台帳

すべてのゲーム内リソース (coins, gems, items, XP, energy...) について:

| # | Resource | All INFLOWS (APIs/events that add) | All OUTFLOWS (APIs/events that subtract) | Daily limits? | Can any inflow be infinite? |

各リソースについて、以下を尋ねます:

  • 対応するコストなしで流入はありますか? (クールダウンなしのクエストからの無料 coins)
  • 流出がマイナスになることはありますか? (item を売る → coins、しかし coins がオーバーフローした場合はどうなりますか?)
  • safe-box 内の item はすべての流出から除外されていますか? (trade, sell, merge, fuse, gift)
  • ループはありますか? (item A を購入 → コストよりも高く売る → 繰り返す)

テーブル 7: 並行性のホットスポット (TOCTOU)

共有状態を読み取ってから書き込むすべての操作 (balance check→deduct, stock check→reserve, coupon check→redeem) について:

| # | Operation | Read step | Write step | Atomic? | What if 2 requests hit simultaneously? |

これは、単一リクエストのテストでは見逃される競合状態をキャッチします。各操作について、以下を尋ねます:

  • 読み取りから書き込みはアトミックですか? (SQL UPDATE x=x-1 WHERE x>=1 はアトミックです。SELECT の後に UPDATE はそうではありません)
  • 2 つの同時リクエストが両方ともチェックに合格し、両方とも書き込みを実行できますか? (二重使用)
  • mutex/lock/transaction はありますか? SQLite を使用している場合、同時読み取りのために WAL モードが有効になっていますか?
  • 複数ステップのフローの場合: リクエスト A がステップ間にあり、リクエスト B が同じフローを開始できますか?

フェーズ 2: 検証 (メイン監査)

すべてのテーブルのすべての行を調べます。各行について、以下を決定します:

  • 🔴 クリティカル: 悪用可能なセキュリティホール、データ損失、クラッシュ
  • 🟡 中: ロジックエラー、不整合、パフォーマンスの問題
  • 🟢 軽微: コード品質、エッジケース、UX の問題
  • ✅ OK: 正しいことを検証済み

出力形式:

Bug N: [🔴/🟡/🟢] 簡単な説明
- Row: Table X, #Y
- Cause: ...
- Fix: ...
- File: ...

「インスピレーション」が尽きたら停止しないでください。 すべてのテーブルのすべての行が検証済み ✅ またはフラグ付け 🔴/🟡/🟢 になるまで停止します。これは徹底的であり、ヒューリスティックではありません。

フェーズ 3: レッドチーム / ブルーチーム

すべてのテーブルを検証した後、敵対的なモードに切り替えます。完全なプレイブックについては、references/redblue.md を参照してください。

構造

プレイブックには 4 つの部分があります。

  1. ユニバーサルチェーン (5) — すべてのプロジェクトに適用: Auth Bypass, Injection, Rate Abuse, Data Leakage, Concurrency/Race Conditions
  2. タイプ固有のチェーン — プロジェクトに一致するセクションを選択:
    • 🎮 ゲーム: Skip-Pay-Collect, Economic Loop, State Manipulation, Anti-Cheat Bypass
    • 📊 データツール: Data Access Control, Data Integrity, Scheduled Task Abuse
    • 🔌 API サービス: Key/Token Abuse, Upstream Dependency, Response Manipulation
    • 🤖 ボット: Message Injection, Bot State Abuse
    • 🔧 WeChat: OAuth & Identity, WebView Compatibility, H5 Hybrid
    • 📈 プラットフォーム: Cross-Service Trust, Multi-Tenant Isolation
  3. ブルーチームの防御 — 各発見について、4 つのレイヤーを検証します: Prevention → Detection → Containment → Recovery
  4. 実行ガイド — 監査担当者向けのステップバイステップ

実行方法

  1. フェーズ 1 の分析から、プロジェクトのタイプを特定します — プロジェクトは複数のタイプに一致する可能性があります
  2. すべての 5 つのユニバーサルチェーンを実行します
  3. プロジェクトに一致するタイプ固有のチェーンを実行します
  4. 各 🔴 の発見について: すべての 4 つのブルーチームレイヤーを検証します
  5. 各 🟡 の発見について: 少なくともレイヤー 1 (Prevention) を検証します

フェーズ 4: 補足

レッド/ブルーチームの後、最終的な安全ネットとして一般的なチェックを実行します。references/modules.md を読み、プロジェクトに一致するセクションを選択します:

  • 🔒 セキュリティ (S1-S3): CORS
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Bug Audit — Dissect, Then Verify

Do NOT run a generic checklist. Instead: read the code, extract every auditable entity, then exhaustively question each one.

Phase 1: Dissect (10-15 min)

Read all project files. Build 7 tables. These tables ARE the audit — everything found here gets verified in Phase 2.

Table 1: API Endpoints

For every route in server-side code:

| # | Method | Path | Auth? | Params validated? | Precondition | Returns | Attack vector |

For each endpoint, ask:

  • Can I call this without authentication?
  • Can I pass 0, negative, NaN, huge numbers, arrays, objects?
  • Can I skip a prerequisite API and call this directly?
  • What happens if I call this 100 times per second?
  • Does the response leak sensitive data (openid, internal IDs, full user objects)?

Table 2: State Machines

For every boolean/enum state variable (isGameOver, battleState, Game.running, phase, mode...):

| # | Variable | Set by | Read by | Init value | Reset when? | Can it leak across lifecycles? |

For each variable, ask:

  • If the game/session ends, does this get reset?
  • If I start a new round immediately, will stale state from the previous round affect it?
  • Are there race conditions between setters?

Table 3: Timers

For every setTimeout/setInterval:

| # | Type | Delay | Created in | Cleared in | What if lifecycle ends before it fires? |

For each timer, ask:

  • Is the handle stored for cleanup?
  • If the game ends / user disconnects / page navigates, does this still fire?
  • If it fires after cleanup, does it reference destroyed objects?

Table 4: Numeric Values

For every user-influenceable number (cost, score, damage, lootValue, kills, quantity...):

| # | Name | Source (client/server/config) | Validated? | Min | Max | What if 0? | What if negative? |

For each value, ask:

  • Is the server-side cap realistic? (kills cap 200 but max enemies is 50?)
  • Can the client send a value the server trusts without verification?
  • Float precision issues? (accumulated math → 290402.0000000001)

Table 5: Data Flows (Critical!)

For every pair of related APIs (buy→use, start→complete, pay→deliver, login→action):

| # | Step 1 API | Step 2 API | Token/link between them? | Can skip Step 1? | Can replay Step 1? |

This is where the biggest bugs hide. For each flow, ask:

  • Can I call Step 2 without ever calling Step 1? (raid-result without buy)
  • Can I call Step 1 once but Step 2 many times? (buy once, submit results 10 times)
  • Is there a one-time token linking them? If not, this is a critical vulnerability.
  • Can I call Step 1 with cost=0 then Step 2 with high reward?

Table 6: Resource Ledger

For every in-game resource (coins, gems, items, XP, energy...):

| # | Resource | All INFLOWS (APIs/events that add) | All OUTFLOWS (APIs/events that subtract) | Daily limits? | Can any inflow be infinite? |

For each resource, ask:

  • Is there any inflow without a corresponding cost? (free coins from quest with no cooldown)
  • Can any outflow go negative? (sell item → coins, but what if coins overflow?)
  • Are items in safe-box excluded from ALL outflows? (trade, sell, merge, fuse, gift)
  • Is there a loop? (buy item A → sell for more than cost → repeat)

Table 7: Concurrency Hotspots (TOCTOU)

For every operation that reads-then-writes shared state (balance check→deduct, stock check→reserve, coupon check→redeem):

| # | Operation | Read step | Write step | Atomic? | What if 2 requests hit simultaneously? |

This catches race conditions that single-request testing misses. For each operation, ask:

  • Is the read-then-write atomic? (SQL UPDATE x=x-1 WHERE x>=1 is atomic; SELECT then UPDATE is NOT)
  • Can two concurrent requests both pass the check and both execute the write? (double-spend)
  • Is there a mutex/lock/transaction? If using SQLite, is WAL mode enabled for concurrent reads?
  • For multi-step flows: can request A be between steps while request B starts the same flow?

Phase 2: Verify (main audit)

Go through every row in every table. For each row, determine:

  • 🔴 Critical: exploitable security hole, data loss, crash
  • 🟡 Medium: logic error, inconsistency, performance issue
  • 🟢 Minor: code quality, edge case, UX issue
  • ✅ OK: verified correct

Output format:

Bug N: [🔴/🟡/🟢] Brief description
- Row: Table X, #Y
- Cause: ...
- Fix: ...
- File: ...

Do NOT stop when you run out of "inspiration". You stop when every row in every table has been verified ✅ or flagged 🔴/🟡/🟢. This is exhaustive, not heuristic.

Phase 3: Red Team / Blue Team

After verifying all tables, switch to adversarial mode. Read references/redblue.md for the full playbook.

Structure

The playbook has 4 parts:

  1. Universal Chains (5) — apply to ALL projects: Auth Bypass, Injection, Rate Abuse, Data Leakage, Concurrency/Race Conditions
  2. Type-Specific Chains — pick sections matching the project:
    • 🎮 Game: Skip-Pay-Collect, Economic Loop, State Manipulation, Anti-Cheat Bypass
    • 📊 Data Tool: Data Access Control, Data Integrity, Scheduled Task Abuse
    • 🔌 API Service: Key/Token Abuse, Upstream Dependency, Response Manipulation
    • 🤖 Bot: Message Injection, Bot State Abuse
    • 🔧 WeChat: OAuth & Identity, WebView Compatibility, H5 Hybrid
    • 📈 Platform: Cross-Service Trust, Multi-Tenant Isolation
  3. Blue Team Defense — for each finding, verify 4 layers: Prevention → Detection → Containment → Recovery
  4. Execution Guide — step-by-step for the auditor

How to Run

  1. From Phase 1 dissection, identify project type(s) — a project can match multiple types
  2. Run ALL 5 Universal Chains
  3. Run type-specific chains matching the project
  4. For each 🔴 finding: verify all 4 Blue Team layers
  5. For each 🟡 finding: verify Layer 1 (Prevention) at minimum

Phase 4: Supplement

After red/blue team, run generic checks as a final safety net. Read references/modules.md and pick sections matching the project:

  • 🔒 Security (S1-S3): CORS, XSS, SQLi, brute force — if project has users
  • 🔐 Crypto (C1): Hardcoded secrets, weak hashing, plaintext storage, insecure random — all projects
  • 📊 Data (D1-D3): Timezone, atomic ops, float precision — if project has DB
  • ⚡ Performance (P1-P2): Memory leaks, hot paths — if project is large/realtime
  • 🎮 Game (G1-G4): State guards, rendering, config — if project is a game
  • 🔧 WeChat (W1-W3): ES6 compat, CDN, debugging — if runs in WeChat WebView
  • 🔌 API (A1-A3): Interface standards, rate limiting — if project is an API service
  • 🤖 Bot (B1): Timeout, dedup, sensitive words — if project is a bot
  • 🚀 Deploy (R1-R2): PM2, nginx, SSL, SDK overwrite — all projects
  • 🧪 Error Handling (E1-E2): Network errors, server errors, graceful degradation — all projects
  • 📱 UX Robustness (U1-U2): Error states, edge case UX — all projects with UI
  • 📦 Supply Chain (SC1): npm audit, dependency vulnerabilities, lockfile integrity — all Node.js projects
  • 📝 Logging (L1): Security event logging, audit trail completeness — all projects with users

Phase 5: Regression + Verify

  • Check that fixes didn't introduce new bugs
  • After modular split: verify cross-file variable/function reachability
  • Live smoke test: homepage 200, key APIs return JSON, login works, core feature functional

Phase 6: Archive

Update project docs with: date, tables built, bugs found/fixed, key pitfalls for next audit.

Key Principles

  1. Tables first, checking second. Building the tables IS the hard work. Once you have them, verification is mechanical.
  2. Exhaustive, not heuristic. Don't stop when you "feel done." Stop when every row is verified.
  3. Think like an attacker. For every API: "How would I exploit this?" For every value: "What if I send garbage?"
  4. Data flows are where critical bugs hide. The link (or lack thereof) between related APIs is the #1 source of exploitable vulnerabilities.
  5. Generic checklists are supplements, not the main event. They catch known patterns; the tables catch project-specific logic bugs.

Reference Files

  • references/modules.md — Generic audit modules (Security, Crypto, Data, Performance, Game, WeChat, API, Bot, Deploy, Error Handling, UX, Supply Chain, Logging) for Phase 4 supplementary checks.
  • references/redblue.md — Red team attack chains (universal + 6 project types) and blue team defense verification playbook for Phase 3.
  • references/pitfalls.md — Real-world pitfall lookup table from 200+ bugs, plus WeChat WebView remote debugging techniques.