From be8ce0606687ca017ad00ee7b67642fdc20509bc Mon Sep 17 00:00:00 2001 From: almogbaku Date: Sat, 14 Mar 2026 15:39:10 +0200 Subject: [PATCH 1/3] docs: add macOS + Go SIP gotcha for dlv --pid in debugging-code skill Inline note after the --pid bullet warning that dlv attach requires SIP disabled on macOS, with preferred alternatives (start under debugger, or restart under dlv headless server mode). Co-Authored-By: Claude Sonnet 4.6 --- skills/debugging-code/SKILL.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/skills/debugging-code/SKILL.md b/skills/debugging-code/SKILL.md index 0ccb362..126c0fb 100644 --- a/skills/debugging-code/SKILL.md +++ b/skills/debugging-code/SKILL.md @@ -23,16 +23,19 @@ If `dap` isn't installed (check: `command -v dap`), install it NOW. Ask/notify the user before proceeding to install it. From Homebrew (macOS) + ```bash brew install AlmogBaku/tap/dap ``` Installer script: + ```bash bash scripts/install-dap.sh ``` Install from sources: + ```bash go install github.com/AlmogBaku/debug-skill/cmd/dap@latest ``` @@ -62,6 +65,8 @@ Choose your starting strategy based on what you know: - **Remote process** — `dap debug --attach host:port --backend ` - **Process already running (stuck server, live issue)** — attach without restarting: `dap debug --pid --backend ` + > **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 ` keeps concurrent agents from interfering. Tip: You might want to use your session id(${CLAUDE_SESSION_ID}) if available. @@ -80,6 +85,12 @@ Re-read the code, form a *completely different* theory with different breakpoint **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 From da4b8e4ab031d0f883d1e3224cab9ca38ca0e594 Mon Sep 17 00:00:00 2001 From: almogbaku Date: Sat, 14 Mar 2026 20:27:09 +0200 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20correct=20macOS=20Go=20gotcha=20?= =?UTF-8?q?=E2=80=94=20DevToolsSecurity=20not=20SIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dlv attach uses dlv dap mode; the actual macOS prerequisite is sudo DevToolsSecurity -enable (enforced by checkMacOSDevMode()), not csrutil disable (SIP). Also simplify the fallback to just the preferred alternative. Co-Authored-By: Claude Sonnet 4.6 --- skills/debugging-code/SKILL.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/skills/debugging-code/SKILL.md b/skills/debugging-code/SKILL.md index 126c0fb..1e20ff8 100644 --- a/skills/debugging-code/SKILL.md +++ b/skills/debugging-code/SKILL.md @@ -65,8 +65,12 @@ Choose your starting strategy based on what you know: - **Remote process** — `dap debug --attach host:port --backend ` - **Process already running (stuck server, live issue)** — attach without restarting: `dap debug --pid --backend ` - > **macOS + Go gotcha:** `dlv --pid` requires SIP disabled (`csrutil disable`). - > Prefer starting the program under the debugger instead or attaching to a remote debugger! + > **macOS + Go gotcha (dlv):** local PID attach requires Developer Tools security enabled. + > If `dap` errors, run: `sudo DevToolsSecurity -enable` + > Prefer starting the program under the debugger instead: + > ```bash + > dap debug main.go # or your entrypoint + > ``` **Session isolation:** `--session ` keeps concurrent agents from interfering. Tip: You might want to use your session id(${CLAUDE_SESSION_ID}) if available. From 6fd45e4686b2333d3972aa21f19fc59a422c5005 Mon Sep 17 00:00:00 2001 From: almogbaku Date: Sat, 14 Mar 2026 20:28:16 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Revert=20"fix:=20correct=20macOS=20Go=20got?= =?UTF-8?q?cha=20=E2=80=94=20DevToolsSecurity=20not=20SIP"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit da4b8e4ab031d0f883d1e3224cab9ca38ca0e594. --- skills/debugging-code/SKILL.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/skills/debugging-code/SKILL.md b/skills/debugging-code/SKILL.md index 1e20ff8..126c0fb 100644 --- a/skills/debugging-code/SKILL.md +++ b/skills/debugging-code/SKILL.md @@ -65,12 +65,8 @@ Choose your starting strategy based on what you know: - **Remote process** — `dap debug --attach host:port --backend ` - **Process already running (stuck server, live issue)** — attach without restarting: `dap debug --pid --backend ` - > **macOS + Go gotcha (dlv):** local PID attach requires Developer Tools security enabled. - > If `dap` errors, run: `sudo DevToolsSecurity -enable` - > Prefer starting the program under the debugger instead: - > ```bash - > dap debug main.go # or your entrypoint - > ``` + > **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 ` keeps concurrent agents from interfering. Tip: You might want to use your session id(${CLAUDE_SESSION_ID}) if available.