ai-debt-detector
できること
このAIの「負債」検出ツールは、AIが生成したコードに、人間なら通常は避ける一般的な問題がないかをチェックします。エラー処理の不備、解放されていないリソース、存在しない依存関係、プロジェクトの規約からの逸脱などを探します。
使う場面
- ✓AIによるコード生成のあと。
- ✓AIの提案を採用する前、またはAIのコードをマージする前。
- ✓コードは動くけれど、不安定だったり未完成に感じたりするとき。
スキルのリンク
https://github.com/wshobson/agents/blob/main/plugins/skill-forge-essentials/skills/ai-debt-detector/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このAIが生成したコードをスキャンして、エラー処理の不備、解放されていないリソース、存在しない依存関係がないか確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIがよく間違えるパターンをコードから探します。たとえば、エラー処理の欠落、解放されないリソース、存在しないパッケージなどです。目的は、コードが堅牢で安全であることを確かめることです。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
AI Debt Detector
Overview
AI agents generate code that passes the happy path but hides debt: missing error handling, orphaned resources, ignored failure modes, hallucinated packages, silent architectural drift. This skill forces a targeted audit for the exact patterns AI agents get wrong.
When to Use
- After any AI code generation session (20+ lines produced)
- Before merging AI-generated PRs
- When code works but something feels off
- After vibe-coding sprints where debt accumulates fastest
- When the agent claims done without showing verification
Process
After code generation, scan for these AI-specific debt patterns:
FAILURE MODES - What happens when this fails?
- Network timeout? Disk full? Permission denied? Null input?
- Is there a try/catch? Does it catch SPECIFIC errors or swallow everything?
- Are resources cleaned up on failure? (streams closed, connections returned, temp files deleted)
ORPHANS - What gets created but never cleaned up?
- Temp files, event listeners, intervals, subscriptions, connections
- Are there corresponding cleanup/dispose/close calls for every open/create?
- In React: does every addEventListener have a removeEventListener in cleanup?
EDGE CASES - What inputs break this?
- Empty array/string? null/undefined? Multi-MB input? Unicode? Concurrent calls?
- Does the code assume the happy path? (AI almost always does)
HALLUCINATED DEPS - Do all imports actually exist?
- Is every package in package.json/requirements.txt?
- Are API methods real? (AI invents plausible-sounding methods that don't exist)
- Does this library's latest version still export this function?
ARCHITECTURAL DRIFT - Does this match the project's patterns?
- Same error handling style as existing code?
- Uses the project's established utilities (not reinventing)?
- Follows the file structure convention?
Red Flags (stop and fix immediately)
catch (e) {}orcatch (e) { console.log(e) }- swallowed error- No
finallyblock when resources were opened // TODO: handle error- AI's way of punting- Import from a path that doesn't exist in the project
- Timeout set but no abort/cleanup on timeout
- Database connection opened but never released back to pool
Common Mistakes
- Trusting that compilation means correctness (compilation checks syntax, not logic)
- Reviewing only the diff without checking what the AI did NOT generate (missing error paths)
- Assuming the AI used the right library version (it often uses deprecated APIs)
- Skipping the orphan check because garbage collection handles it (it doesn't for connections, listeners, timers)
Why This Exists
AI agents systematically optimize for "looks correct" and "passes the happy path." They miss failure modes, orphan resources, and hallucinate dependencies at rates significantly higher than manual code. This skill forces an audit for those specific blind spots.
よくある質問
AIのコードをなぜチェックする必要があるのですか?
AIは理想的な条件では動くコードを作るのが得意ですが、エラー処理やリソースの解放、正しいパッケージの利用を忘れることがあります。その結果、あとで問題を起こす「負債」が生まれます。
「孤立したリソース」とは何ですか?
ネットワーク接続や一時ファイルなど、コードが作成したものの、使い終わっても閉じたり削除したりしていないものです。システムの資源を消費し続けることがあります。
「失敗モード」とは何ですか?
ネットワークエラーや不正な入力など、コードが失敗するかもしれない状況と、その際の反応のことです。良いコードは、こうした状況への対処方法を決めています。
詳細
作者による元の説明
Use after generating code, after accepting AI suggestions, or when reviewing AI-written modules. Also use when code works but feels brittle, when error handling seems thin, when orphaned resources or missing cleanup are suspected, or when the agent claims done but hidden debt may exist. Catches the specific failure patterns AI agents produce that humans would not.
repo: wshobson/agents
人気
- GitHubのスター
- 41k
- ランキング
- #6788
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
screen-reader-testing
41kエージェントにスクリーンリーダーを使ってWebサイトをテストさせ、アクセシビリティを確認します。
wcag-audit-patterns
41kエージェントがWebサイトのアクセシビリティを監査し、WCAGガイドラインに沿って問題を修正できるようにします。
multi-reviewer-patterns
41kエージェントが複数のコードレビューを並行して調整できるようにします。指摘事項の重複を排除し、レポートにまとめます。
parallel-debugging
41kエージェントが並行調査と根本原因分析を使って、複雑な問題をデバッグできるようにします。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。