Langsung ke konten
Skillpedia
Testing48k Β· #4354

debugging-code

Fungsinya

Membantu menemukan error dalam kode program. Anda bisa menghentikan program sementara, melihat nilai variabel, dan menjalankan kode baris demi baris untuk memahami apa yang sedang terjadi.

Kapan dipakai

  • βœ“Ketika program crash atau menampilkan error.
  • βœ“Ketika output program tidak sesuai.
  • βœ“Ketika Anda perlu memahami bagaimana kode sampai ke titik tertentu.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/debugging-code/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-code/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

β€œBantu saya men-debug kode Python ini: `my_script.py`”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Alat ini menghentikan eksekusi kode Anda pada titik-titik tertentu. Anda kemudian bisa memeriksa kondisi saat itu, seperti nilai variabel, dan mengendalikan eksekusi langkah demi langkah.

Konten teknis (SKILL.md asli)

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

Interactive Debugger

When to Use

Use this skill when you need interactively debug source code β€” set breakpoints, step through execution line by line, inspect live variable state, evaluate expressions against the running program, and navigate the call stack to trace root causes. Use when a program crashes, raises unexpected exceptions, produces...

Use when a program crashes, produces wrong output, or you need to understand exactly how execution reached a particular state β€” and running it again with more print statements won't give you the answer fast enough.

You can pause a running program at any point, read live variable values and the call stack at that exact moment, step forward line by line or jump to the next breakpoint, and evaluate arbitrary expressions against the live process β€” all without restarting.

Setup

This skill uses dap, a CLI tool that background daemon to interact with the debugger via the DAP Protocol, maintain the debugger state, so you can simply interact with it with multiple calls.

If dap isn't installed (check: command -v dap), install it NOW. Ask/notify the user before proceeding to install it.

From Homebrew (macOS)

brew install AlmogBaku/tap/dap

Installer script:

bash scripts/install-dap.sh

Install from sources:

go install github.com/AlmogBaku/debug-skill/cmd/dap@latest

This tool is open-sourced and available on GitHub, maintained and follows best practices.

Supports natively Python, Go, Node.js/TypeScript, Rust, C/C++, and any other language that supports DAP.

If a debugger backend is missing or fails to start, see references/installing-debuggers.md

For all commands and flags: dap --help or dap <cmd> --help.

Starting a Session

dap debug <file> launches the program under the debugger. Backend is auto-detected from the file extension.

Choose your starting strategy based on what you know:

  • Have a hypothesis β€” set a breakpoint where you expect the bug: dap debug script.py --break script.py:42
  • Conditional breakpoint β€” only stop when a condition is met: dap debug script.py --break "script.py:42:x > 5" ( always quote specs with conditions)
  • Multi-file app β€” breakpoints across modules: --break src/api/routes.py:55 --break src/models/user.py:30
  • No hypothesis, small program β€” walk from entry: dap debug script.py --stop-on-entry (avoid for large projects β€” startup code is noisy; bisect with breakpoints instead)
  • Exception, location unknown β€” dap debug script.py --break-on-exception raised (Python) / all (Go/JS)
  • Remote process β€” dap debug --attach host:port --backend <name>
  • Process already running (stuck server, live issue) β€” attach without restarting: dap debug --pid <PID> --backend <name>

    macOS + Go gotcha: dlv --pid requires SIP disabled (csrutil disable). Prefer starting the program under the debugger instead or attaching to a remote debugger!

Session isolation: --session <name> keeps concurrent agents from interfering. Tip: You might want to use your session id(${CLAUDE_SESSION_ID}) if available.

Run dap debug --help for all flags, backends, and examples.

The Debugging Mindset

Reach for a debugger when reading source alone can't validate the root cause. A debugger lets you observe what does happen: actual values, actual path, actual state. When that diverges from what should happen, you've found your bug.

Two strikes, rethink. If two hypotheses fail at the same location, your mental model is wrong. Re-read the code, form a completely different theory with different breakpoints.

Escalate gradually. Start with dap eval to test a quick hypothesis. Use conditional breakpoints to filter noise. Fall back to full breakpoints + stepping only when you need interactive control.

Mimic the user journey. If you're debugging a user flow, set breakpoints along the path you expect the code to take. If you expected compute() to be called, but it never is, then the bug is in the caller β€” not compute(), but whatever was supposed to call it.

Set breakpoints instead of prints. When you feel the urge to print something, set a breakpoint instead.

Know Your State

Every dap execution command returns full context automatically: current location, source, locals, call stack, and output. At each stop, ask:

  • Do the local variables have the values I expected?

…

Pertanyaan umum

Bagaimana cara menginstal alat ini?

Anda bisa menginstal menggunakan Homebrew di macOS (`brew install AlmogBaku/tap/dap`), skrip instalasi (`bash scripts/install-dap.sh`), atau dengan mengompilasi dari source (`go install github.com/AlmogBaku/debug-skill/cmd/dap@latest`).

Bahasa pemrograman apa saja yang didukung?

Alat ini mendukung Python, Go, Node.js/TypeScript, Rust, C/C++, dan bahasa lain yang menggunakan protokol DAP.

Apa itu 'breakpoint'?

'Breakpoint' adalah titik yang Anda tentukan di dalam kode, tempat eksekusi program akan berhenti sementara sehingga Anda bisa memeriksa kondisi program.

Detail

Deskripsi asli dari pembuat

Interactively debug source code β€” set breakpoints, step through execution line by line, inspect live variable state, evaluate expressions against the running program, and navigate the call stack to trace root causes.

repo: sickn33/agentic-awesome-skills

Popularitas

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

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa