Skip to content
πŸ› Auto Debug Skill logo

πŸ› Auto Debug Skill

--- name: auto-debug description: Automatically detect bugs from terminal output and suggest/apply fixes without manual intervention ---

SKILL.md

Full skill instructions

πŸ› 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 TypeDetection Pattern
TypeScriptTS\d+:, Type error:
ESLinterror:, warning:
RuntimeError:, Exception:
BuildENOENT, Cannot find module
TestFAIL, 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

PatternCauseAuto-Fix
ENOENTFile not foundCheck path, create file
EACCESPermission deniedCheck permissions
EADDRINUSEPort in useKill process or change port

Dependency Errors

PatternCauseAuto-Fix
peer depVersion mismatchUpdate package
ERESOLVEConflictUse --legacy-peer-deps
not foundMissing packagenpm install

Syntax Errors

PatternCauseAuto-Fix
Unexpected tokenTypo, missing bracketAdd missing syntax
Unterminated stringMissing quoteAdd closing quote
Invalid JSONMalformed JSONFix JSON syntax

βœ… Self-Check

  • Error correctly identified
  • Root cause understood
  • Fix is safe (won't break other code)
  • Fix verified by re-running
  • Solution logged for future reference

πŸ“’ 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