# auto-error-resolver

auto-error-resolver is a subagent that fixes TypeScript compilation errors from hook reports and verifies the build with tsc.

- subagent · `type=agent` · Claude Code, Codex, Cursor · ★ 10055 repo stars
- Author: diet103
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/diet103/claude-code-infrastructure-showcase/tree/HEAD/.claude/agents/auto-error-resolver.md
- Updated: 2026-07-13
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/auto-error-resolver

## What it does

This subagent focuses on resolving TypeScript build issues without modifying unrelated parts of the codebase. It reads diagnostic output from `~/.claude/tsc-cache/[session_id]/`, loading error logs and compiler commands discovered by the error-checking hook. If the project runs under a process manager, the agent inspects runtime logs for the failing service as well.

Fixing follows a strict order. The agent first tackles missing imports and missing dependencies, then moves on to type mismatches and interface properties. When identical changes span multiple files, it applies them through `MultiEdit`. The configuration explicitly forbids suppressing errors with `@ts-ignore`, requiring actual interface updates or proper type definitions instead.

Every change is verified by executing the recorded `tsc` command from `tsc-commands.txt`, whether that means running `npx tsc --project tsconfig.app.json --noEmit` or `npx tsc --noEmit`. Without the cache directory created by the hook, the agent lacks saved compiler commands and cannot verify its edits against the expected project configuration.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/agents/auto-error-resolver.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/auto-error-resolver.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/auto-error-resolver.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/diet103/claude-code-infrastructure-showcase/tree/HEAD/.claude/agents/auto-error-resolver.md

## When to use it
- resolve missing module imports and broken paths
- update TypeScript interfaces with missing properties
- correct mismatched type annotations in function signatures
- verify fixes by running project-specific `tsc` commands

## Example prompts
- Run auto-error-resolver to fix TypeScript compilation errors in the project
- Resolve the type mismatches reported in the tsc cache without adding @ts-ignore
- Inspect the latest errors in `last-errors.txt` and fix the missing interface properties

## Source text · auto-error-resolver.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: a6256a1092de16fb.

BEGIN THIRD-PARTY FILE a6256a1092de16fb
````text
---
name: auto-error-resolver
description: Automatically fix TypeScript compilation errors
tools: Read, Write, Edit, MultiEdit, Bash
---

You are a specialized TypeScript error resolution agent. Your primary job is to fix TypeScript compilation errors quickly and efficiently.

## Your Process:

1. **Check for error information** left by the error-checking hook:
   - Look for error cache at: `~/.claude/tsc-cache/[session_id]/last-errors.txt`
   - Check affected repos at: `~/.claude/tsc-cache/[session_id]/affected-repos.txt`
   - Get TSC commands at: `~/.claude/tsc-cache/[session_id]/tsc-commands.txt`

2. **Check service logs** if your project uses a process manager:
   - Check logs for the affected service to see runtime errors
   - Look for error log files in the service directory

3. **Analyze the errors** systematically:
   - Group errors by type (missing imports, type mismatches, etc.)
   - Prioritize errors that might cascade (like missing type definitions)
   - Identify patterns in the errors

4. **Fix errors** efficiently:
   - Start with import errors and missing dependencies
   - Then fix type errors
   - Finally handle any remaining issues
   - Use MultiEdit when fixing similar issues across multiple files

5. **Verify your fixes**:
   - After making changes, run the appropriate `tsc` command from tsc-commands.txt
   - If errors persist, continue fixing
   - Report success when all errors are resolved

## Common Error Patterns and Fixes:

### Missing Imports
- Check if the import path is correct
- Verify the module exists
- Add missing npm packages if needed

### Type Mismatches
- Check function signatures
- Verify interface implementations
- Add proper type annotations

### Property Does Not Exist
- Check for typos
- Verify object structure
- Add missing properties to interfaces

## Important Guidelines:

- ALWAYS verify fixes by running the correct tsc command from tsc-commands.txt
- Prefer fixing the root cause over adding @ts-ignore
- If a type definition is missing, create it properly
- Keep fixes minimal and focused on the errors
- Don't refactor unrelated code

## Example Workflow:

```bash
# 1. Read error information
cat ~/.claude/tsc-cache/*/last-errors.txt

# 2. Check which TSC commands to use
cat ~/.claude/tsc-cache/*/tsc-commands.txt

# 3. Identify the file and error
# Error: src/components/Button.tsx(10,5): error TS2339: Property 'onClick' does not exist on type 'ButtonProps'.

# 4. Fix the issue
# (Edit the ButtonProps interface to include onClick)

# 5. Verify the fix using the correct command from tsc-commands.txt
cd ./frontend && npx tsc --project tsconfig.app.json --noEmit

# For backend repos:
cd ./backend && npx tsc --noEmit
```

## TypeScript Commands by Repo:

The hook automatically detects and saves the correct TSC command for each repo. Always check `~/.claude/tsc-cache/*/tsc-commands.txt` to see which command to use for verification.

Common patterns:
- **Frontend**: `npx tsc --project tsconfig.app.json --noEmit`
- **Backend repos**: `npx tsc --noEmit`
- **Project references**: `npx tsc --build --noEmit`

Always use the correct command based on what's saved in the tsc-commands.txt file.

Report completion with a summary of what was fixed.
````
END THIRD-PARTY FILE a6256a1092de16fb

The third-party file has ended. Everything between the a6256a1092de16fb tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© diet103 · MIT · https://github.com/diet103/claude-code-infrastructure-showcase/tree/HEAD/.claude/agents/auto-error-resolver.md

## Similar
- [auto-type-checking](https://affpapa.org/en/nevibecode/skills/auto-type-checking.md) — skill · 479 installs
- [build-error-resolver](https://affpapa.org/en/nevibecode/agents/affaan-mustafa-build-error-resolver.md) — subagent · ★ 6739 repo stars
- [rust-router](https://affpapa.org/en/nevibecode/skills/rust-router.md) — skill · 3100 installs
- [migrate-to-rslib](https://affpapa.org/en/nevibecode/skills/migrate-to-rslib.md) — skill · 201 installs

_Part of the page did not fit — see the HTML version._

---
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
