π Auto Debug Skill
name: auto-debug
description: Automatically detect bugs from terminal output and suggest/βapply fixes without manual intervention
π― Purpose
ΰΈΰΈ£ΰΈ§ΰΈΰΈΰΈ±ΰΈ errors ΰΈΰΈ²ΰΈ terminal output ΰΈΰΈ±ΰΈΰΉΰΈΰΈ‘ΰΈ±ΰΈΰΈ΄ ΰΉΰΈ₯ΰΈ°ΰΉΰΈΰΈ°ΰΈΰΈ³ΰΈ«ΰΈ£ΰΈ·ΰΈΰΉΰΈΰΉΰΉΰΈΰΈΰΈ±ΰΈΰΈ«ΰΈ²ΰΈΰΈ±ΰΈΰΈΰΈ΅ ΰΈ₯ΰΈΰΉΰΈ§ΰΈ₯ΰΈ² debug ΰΈ₯ΰΈΰΈΰΈ’ΰΉΰΈ²ΰΈΰΈ‘ΰΈ²ΰΈ
π When to Use
- ΰΉΰΈ‘ΰΈ·ΰΉΰΈ terminal ΰΉΰΈͺΰΈΰΈ error messages
- ΰΉΰΈ‘ΰΈ·ΰΉΰΈ build/βcompile fail
- ΰΉΰΈ‘ΰΈ·ΰΉΰΈ tests fail
- ΰΉΰΈ‘ΰΈ·ΰΉΰΈ runtime errors occur
- ΰΉΰΈ‘ΰΈ·ΰΉΰΈ linting errors ΰΉΰΈΰΈ΄ΰΈΰΈΰΈΆΰΉΰΈ
π§ Capabilities
1. Error Detection
| Error Type | Detection Pattern |
|---|
| TypeScript | TS\d+:, Type error: |
| ESLint | error:, warning: |
| Runtime | Error:, Exception: |
| Build | ENOENT, Cannot find module |
| Test | FAIL, Expected.*but received |
2. Common Error Fixes
TypeScript Errors
// TS2322: Type 'string' is not assignable to type 'number'
// Fix: Change variable type or value
// TS2339: Property does not exist
// Fix: Add property to interface or use optional chaining
// TS7006: Parameter implicitly has 'any' type
// Fix: Add explicit type annotation
Module Errors
# Cannot find module 'xyz'
# Fix 1: npm install xyz
# Fix 2: Check import path spelling
# Fix 3: Add to tsconfig paths
# Module not found: Can't resolve './βcomponent'
# Fix: Check file exists, check extension, check case sensitivity
Runtime Errors
// TypeError: Cannot read property 'x' of undefined
// Fix: Add null check or optional chaining
// ReferenceError: variable is not defined
// Fix: Declare variable or check scope
// SyntaxError: Unexpected token
// Fix: Check JSON format, missing brackets
π Auto-Debug Process
βββββββββββββββββββ
β Error Occurs β
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Parse Error Msg β β Extract error type, location, message
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Identify Cause β β Match patterns, analyze context
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Generate Fix β β Create solution based on error type
ββββββββββ¬βββββββββ
β
βΌ
βββββββββββββββββββ
β Apply & Verify β β Apply fix, re-run to verify
ββββββββββ¬βββββββββ
β
βΌ
Fixed? ββββNoβββββΆ Try alternative fix
β
Yes
β
βΌ
Done! β
π Auto-Fix Loop
MAX_ATTEMPTS = 5
attempt = 0
while error_exists and attempt < MAX_ATTEMPTS:
error = parse_error(terminal_output)
fix = generate_fix(error)
apply_fix(fix)
result = run_command_again()
if result.success:
log_solution(error, fix) # Save for future
break
else:
attempt += 1
try_alternative_fix()
π Error Pattern Database
Build Errors
| Pattern | Cause | Auto-Fix |
|---|
ENOENT | File not found | Check path, create file |
EACCES | Permission denied | Check permissions |
EADDRINUSE | Port in use | Kill process or change port |
Dependency Errors
| Pattern | Cause | Auto-Fix |
|---|
peer dep | Version mismatch | Update package |
ERESOLVE | Conflict | Use --legacy-peer-deps |
not found | Missing package | npm install |
Syntax Errors
| Pattern | Cause | Auto-Fix |
|---|
Unexpected token | Typo, missing bracket | Add missing syntax |
Unterminated string | Missing quote | Add closing quote |
Invalid JSON | Malformed JSON | Fix JSON syntax |
β
Self-Check
π’ Announcement Format
[π Auto-Debug] Detected: {error type}
[π Auto-Debug] Cause: {root cause}
[π Auto-Debug] Fixing: {applying fix}
[π Auto-Debug] β
Fixed: {summary}
π Related Skills
debugging - Manual debugging
error-recovery - Graceful error handling
testing - Prevent errors with tests