Debug assistant

From autonomous-ai/autonomous-intern · View interactive version

Debug assistant is an AI agent skill from the GitHub repository autonomous-ai/autonomous-intern. Diagnoses bugs, errors, and unexpected behavior by tracing root causes and providing fixes. Use when the user says "debug this", "why is this not working", "fix this error", "I'm getting an exception", "help me troubleshoot", "trace this bug", "my app is crashing", or "something is broken".

How to use this skill

Skill file

Debug Assistant

Quick Start

Collect the error evidence, trace to the root cause (not just the symptom), and provide a concrete fix with verification steps. Always ask "Did it work before? What changed?" to narrow the search.

Workflow

  1. Collect evidence: error message, stack trace, reproduction steps, environment details, and recent changes
  2. Parse the error to identify the type, originating file/line, and call chain; classify as runtime, logic, type, network, state, build, config, or performance issue
  3. Formulate 2-3 ranked hypotheses, verify by reading code and tracing data flow
  4. Provide a concrete fix addressing the root cause, with verification steps and a prevention recommendation

Examples

Example 1: TypeError from null access

Input: "I'm getting TypeError: Cannot read properties of undefined (reading 'map')"

Output:

## Root Cause Analysis
The variable you're calling `.map()` on is `undefined` at the time of the call. This typically means:
1. **Most likely**: An API response hasn't loaded yet and the component renders before data arrives
2. **Alternative**: The API response shape changed and the expected field no longer exists

## Fix
Add a guard before the `.map()` call:
// Before
const items = data.results.map(item => ...)

// After
const items = (data?.results ?? []).map(item => ...)

Or use early return in the component:
if (!data?.results) return <Loading />

## Verification
- Confirm the component renders without error on initial load
- Confirm data displays correctly once the API responds
- Check the API response shape matches what the code expects

## Prevention
- Add a test that renders the component with `data = undefined`
- Add TypeScript strict null checks if not enabled

Example 2: CORS error

Input: "Getting CORS error when calling my API from localhost:3000"

Output:

## Root Cause Analysis
The browser blocks cross-origin requests when the API server doesn't include the correct `Access-Control-Allow-Origin` header.

## Fix
Add CORS middleware to your API server:

// Express
import cors from 'cors'
app.use(cors({ origin: 'http://localhost:3000' }))

## Verification
- Open DevTools Network tab, confirm the preflight OPTIONS request returns 200
- Confirm the response includes `Access-Control-Allow-Origin: http://localhost:3000`

## Prevention
- Configure allowed origins via environment variable for different environments

Tools

Error Handling

Connectors (Optional)

This skill works standalone. When connected to external tools, it unlocks additional capabilities:

| Connector | What it enables |

|-----------|----------------|

| ~code repository | Access source files and recent diffs to correlate changes with bugs |

| ~monitoring | Pull live error logs, metrics, and traces to speed up diagnosis |

| ~CI/CD | Inspect build logs and failing test output for additional context |

| ~issue tracker | Look up related bug reports and link fixes to existing tickets |

Rules

Output Template

## Error
[Exact error message or description]

## Root Cause Analysis
Origin: [File:Line] in [Function]
Cause: [Why the error occurs]
Reasoning: [Evidence chain leading to this conclusion]

## Hypotheses (ranked)
1. [Most likely] - [Supporting evidence]
2. [Alternative] - [Supporting evidence]

## Fix
[Before/after code comparison]

## Verification
- [How to confirm the fix works]
- [How to check for regressions]

## Prevention
- [ ] Add test covering this failure case
- [ ] [Additional safeguards]

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.