Langsung ke konten
Skillpedia
Testing48k Β· #4353

debugging-and-error-recovery

Fungsinya

Panduan ini membantu Anda menemukan dan memperbaiki error pada program komputer secara terstruktur. Panduan ini mengajarkan Anda untuk berhenti sejenak, menyelidiki akar penyebabnya, lalu memperbaikinya, tanpa menebak-nebak.

Kapan dipakai

  • βœ“Ketika tes gagal setelah ada perubahan.
  • βœ“Ketika program berhenti bekerja secara tiba-tiba.
  • βœ“Ketika Anda tidak tahu mengapa sesuatu salah.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/debugging-and-error-recovery/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/debugging-and-error-recovery/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œKode saya menampilkan error aneh yang tidak bisa saya pahami, bisakah Anda membantu menyelidikinya?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Panduan ini menyarankan langkah-langkah seperti mereproduksi error, mencari lokasi terjadinya error, menyederhanakan masalah, lalu memperbaiki penyebab yang sebenarnya. Di akhir, panduan ini meminta Anda menambahkan tes agar error tidak muncul kembali.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Debugging and Error Recovery

Overview

Systematic debugging with structured triage. When something breaks, stop adding features, preserve evidence, and follow a structured process to find and fix the root cause. Guessing wastes time. The triage checklist works for test failures, build errors, runtime bugs, and production incidents.

When to Use

  • Tests fail after a code change
  • The build breaks
  • Runtime behavior doesn't match expectations
  • A bug report arrives
  • An error appears in logs or console
  • Something worked before and stopped working

The Stop-the-Line Rule

When anything unexpected happens:

1. STOP adding features or making changes
2. PRESERVE evidence (error output, logs, repro steps)
3. DIAGNOSE using the triage checklist
4. FIX the root cause
5. GUARD against recurrence
6. RESUME only after verification passes

Don't push past a failing test or broken build to work on the next feature. Errors compound. A bug in Step 3 that goes unfixed makes Steps 4-6 wrong.

The Triage Checklist

Work through these steps in order. Do not skip steps.

Step 1: Reproduce

Make the failure happen reliably. If you can't reproduce it, you can't fix it with confidence.

Can you reproduce the failure?
β”œβ”€β”€ YES β†’ Proceed to Step 2
└── NO
    β”œβ”€β”€ Gather more context (logs, environment details)
    β”œβ”€β”€ Try reproducing in a minimal environment
    └── If truly non-reproducible, document conditions and monitor

When a bug is non-reproducible:

Cannot reproduce on demand:
β”œβ”€β”€ Timing-dependent?
β”‚   β”œβ”€β”€ Add timestamps to logs around the suspected area
β”‚   β”œβ”€β”€ Try with artificial delays (setTimeout, sleep) to widen race windows
β”‚   └── Run under load or concurrency to increase collision probability
β”œβ”€β”€ Environment-dependent?
β”‚   β”œβ”€β”€ Compare Node/browser versions, OS, environment variables
β”‚   β”œβ”€β”€ Check for differences in data (empty vs populated database)
β”‚   └── Try reproducing in CI where the environment is clean
β”œβ”€β”€ State-dependent?
β”‚   β”œβ”€β”€ Check for leaked state between tests or requests
β”‚   β”œβ”€β”€ Look for global variables, singletons, or shared caches
β”‚   └── Run the failing scenario in isolation vs after other operations
└── Truly random?
    β”œβ”€β”€ Add defensive logging at the suspected location
    β”œβ”€β”€ Set up an alert for the specific error signature
    └── Document the conditions observed and revisit when it recurs

For test failures:

# Run the specific failing test
npm test -- --grep "test name"

# Run with verbose output
npm test -- --verbose

# Run in isolation (rules out test pollution)
npm test -- --testPathPattern="specific-file" --runInBand

Step 2: Localize

Narrow down WHERE the failure happens:

Which layer is failing?
β”œβ”€β”€ UI/Frontend     β†’ Check console, DOM, network tab
β”œβ”€β”€ API/Backend     β†’ Check server logs, request/response
β”œβ”€β”€ Database        β†’ Check queries, schema, data integrity
β”œβ”€β”€ Build tooling   β†’ Check config, dependencies, environment
β”œβ”€β”€ External service β†’ Check connectivity, API changes, rate limits
└── Test itself     β†’ Check if the test is correct (false negative)

Use bisection for regression bugs:

# Find which commit introduced the bug
git bisect start
git bisect bad                    # Current commit is broken
git bisect good <known-good-sha> # This commit worked
# Git will checkout midpoint commits; run your test at each
git bisect run npm test -- --grep "failing test"

Step 3: Reduce

Create the minimal failing case:

  • Remove unrelated code/config until only the bug remains
  • Simplify the input to the smallest example that triggers the failure
  • Strip the test to the bare minimum that reproduces the issue

A minimal reproduction makes the root cause obvious and prevents fixing symptoms instead of causes.

Step 4: Fix the Root Cause

Fix the underlying issue, not the symptom:

Symptom: "The user list shows duplicate entries"

Symptom fix (bad):
  β†’ Deduplicate in the UI component: [...new Set(users)]

Root cause fix (good):
  β†’ The API endpoint has a JOIN that produces duplicates
  β†’ Fix the query, add a DISTINCT, or fix the data model

Ask: "Why does this happen?" until you reach the actual cause, not just where it manifests.

Step 5: Guard Against Recurrence

Write a test that catches this specific failure:

// The bug: task titles with special characters broke the search
it('finds tasks with special characters in title', async () => {

…
Pertanyaan umum

Apa maksud 'menyimpan bukti' (preserve evidence)?

Maksudnya adalah menyimpan informasi penting tentang error, seperti pesan error, log, atau langkah-langkah persis yang menyebabkan masalah, sebelum melakukan perubahan lain.

Apa itu 'bisection'?

Bisection adalah teknik untuk mencari perubahan spesifik yang menyebabkan masalah dengan membandingkan versi lama dan baru dari kode, hingga Anda menemukan titik munculnya error.

Mengapa saya tidak boleh hanya memperbaiki gejalanya saja?

Memperbaiki gejala ibarat menambal kebocoran tanpa mengatasi sumbernya. Masalahnya bisa muncul kembali atau menimbulkan error lain. Lebih baik temukan dan perbaiki akar penyebabnya agar solusinya permanen.

Detail

Deskripsi asli dari pembuat

Guides systematic root-cause debugging. Use when tests fail, builds break, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need a systematic approach to finding and fixing the root cause rather than guessing.

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#4353
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa