# code-debugging

Structured error analysis for ML experiments and research code. It categorizes tracebacks, limits retry cycles, and explains fixes line by line.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1700 installs · ★ 433
- Author: lingzhi227
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/lingzhi227/agent-research-skills/tree/HEAD/skills/code-debugging/SKILL.md
- Updated: 2026-02-27
- HTML: https://affpapa.org/en/nevibecode/skills/code-debugging

## What it does

The skill organizes debugging into severity levels. Syntax and import issues receive an immediate one-shot fix. Runtime errors like matrix shape mismatches or division by zero trigger a retry loop with up to four attempts. For severe logic bugs such as zero percent model accuracy, the workflow inspects metric calculations and the data pipeline. When error logs run too long, it clips the traceback to the final 1500 characters.

A multi-stage machine governs code adjustments. First attempts repost the script clean, followed by targeted patch attempts, and finally a full regeneration if failures persist. Small edits take priority over rewriting entire files. The agent caps debugging at four to five attempts before switching tactics, because repeating failed patches wastes context.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add lingzhi227/agent-research-skills --skill code-debugging -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/code-debugging/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/code-debugging/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add lingzhi227/agent-research-skills --skill code-debugging -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/code-debugging/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add lingzhi227/agent-research-skills --skill code-debugging -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/code-debugging/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install lingzhi227/agent-research-skills code-debugging
```

2. **Manually: put the files in place**
- File: `.github/skills/code-debugging/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add lingzhi227/agent-research-skills --skill code-debugging -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/lingzhi227/agent-research-skills --path skills/code-debugging
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/code-debugging/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add lingzhi227/agent-research-skills --skill code-debugging -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/lingzhi227/agent-research-skills/tree/HEAD/skills/code-debugging/SKILL.md

## When to use it
- resolve CPU and GPU device tensor mismatches
- diagnose zero percent accuracy in machine learning benchmarks
- handle computation timeouts with early stopping and smaller batches
- trim bloated error logs down to the last 1500 characters

## Example prompts
- Debug this matrix multiplication failure in `train.py`: `RuntimeError: shape mismatch`
- My evaluation script yields 0% accuracy, inspect the metric logic and data pipeline
- Resolve a timeout in `experiment.py` by finding the bottleneck and adding early stopping

## Similar
- [analyze-results](https://affpapa.org/en/nevibecode/skills/analyze-results.md) — skill · 547 installs
- [ablation-planner](https://affpapa.org/en/nevibecode/skills/ablation-planner.md) — skill · 505 installs
- [experiment-craft](https://affpapa.org/en/nevibecode/skills/experiment-craft.md) — skill · 373 installs
- [debugging-and-error-recovery](https://affpapa.org/en/nevibecode/skills/debugging-and-error-recovery.md) — skill · 62800 installs
- [debugging-strategies](https://affpapa.org/en/nevibecode/skills/debugging-strategies.md) — skill · 13414 installs
- [agent-introspection-debugging](https://affpapa.org/en/nevibecode/skills/agent-introspection-debugging.md) — skill · 4700 installs

From the same set: [lingzhi227/agent-research-skills](https://affpapa.org/en/nevibecode/by/lingzhi227/agent-research-skills.md) — 23 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
