AI Debt Detector

SkillAI & models

The ai-debt-detector is a skill that guides an AI agent through a checklist audit of AI-written code. It looks for swallowed errors, resources that are never cleaned up, unhandled edge cases, invented packages, and drift from the project's existing patterns. It flags specific red flags like empty catch blocks, missing finally blocks, and imports that do not exist, then directs fixes.

Then ask your AI: use the AI Debt Detector skill

Details

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Have the AI-generated code available for review, either in a file or in the conversation.

What your AI can do with it

  • Scan generated code for swallowed errors and empty catch blocks
  • Find orphaned resources such as temp files, listeners, and connections
  • Check edge cases like null input, empty arrays, and concurrent calls
  • Verify that every import and API method actually exists
  • Compare new code against the project's existing patterns
  • Flag missing finally blocks and unreleased database connections

Getting started

  1. Have the AI-generated code available for review, either in a file or in the conversation.
  2. Add the skill to your agent's available skills or configuration.
  3. Ask the agent to audit the code with the ai-debt-detector skill.
  4. Review the flagged red flags and apply the fixes the agent suggests.

What this skill tells your AI

The instructions your AI receives, as published by wshobson/agents in plugins/skill-forge-essentials/skills/ai-debt-detector/SKILL.md and read by Ahel’s review.

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:

  1. 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)
  2. 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?
  3. 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)
  4. 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?
  5. 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) {} or catch (e) { console.log(e) } - swallowed error
  • No finally block 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.

Signals

GitHub stars
40k
Forks
4k
Last commit
Oct 2026

Questions

When should I use this skill?
Use it after generating code, after accepting AI suggestions, or when reviewing AI-written modules. Also use it when code works but feels brittle, error handling seems thin, orphaned resources are suspected, or the agent claims done but hidden debt may exist.
What kinds of problems does it catch?
It catches missing error handling, orphaned resources, ignored failure modes, hallucinated packages, and silent architectural drift. It flags empty catch blocks, missing finally blocks, imports that do not exist, and unreleased connections.
Advanced
Item type
skill
Key
ai-debt-detector
Source
github.com/wshobson/agents