|
| 1 | +# Debug Mode Skill |
| 2 | + |
| 3 | +Agent-agnostic, opt-in debug mode for reproducible runtime bugs. It includes |
| 4 | +first-class probe helpers for browser/frontend JavaScript and Node.js, while |
| 5 | +the local collector accepts the same structured events from other runtimes. |
| 6 | + |
| 7 | +Agents add temporary structured probes, collect NDJSON evidence through a |
| 8 | +local loopback collector, wait for you to reproduce manually, fix from log proof, |
| 9 | +verify once, then clean up. |
| 10 | + |
| 11 | +```text |
| 12 | +hypothesize -> instrument -> reproduce -> inspect evidence -> fix -> verify -> clean up |
| 13 | +``` |
| 14 | + |
| 15 | +## When to Use |
| 16 | + |
| 17 | +Use this skill only when you explicitly ask for it, for example: |
| 18 | + |
| 19 | +- `$debug-mode` or `debug mode` |
| 20 | +- instrumented debugging |
| 21 | +- local runtime log collection with temporary probes |
| 22 | + |
| 23 | +For ordinary bug reports, failing tests, build errors, or issues already |
| 24 | +explained by existing logs, agents should debug normally without this workflow. |
| 25 | + |
| 26 | +Full opt-in rules and the agent workflow live in |
| 27 | +[`skills/debug-mode/SKILL.md`](skills/debug-mode/SKILL.md). |
| 28 | + |
| 29 | +## How It Works |
| 30 | + |
| 31 | +1. The agent states ranked hypotheses and adds 3–8 targeted probes. |
| 32 | +2. A small loopback collector receives structured events at `POST /log` and |
| 33 | + writes one NDJSON line per event. |
| 34 | +3. The agent stops and asks you to reproduce the bug manually. |
| 35 | +4. After you reply, it reads the log file, confirms or rejects hypotheses, makes |
| 36 | + a minimal fix, verifies once with probes still active, then removes all |
| 37 | + instrumentation. |
| 38 | + |
| 39 | +Probe templates for browser/frontend JavaScript and Node/server-side JavaScript |
| 40 | +live under `skills/debug-mode/assets/`. The collector script is |
| 41 | +`skills/debug-mode/scripts/log-server.mjs`. |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +Ask your agent explicitly: |
| 46 | + |
| 47 | +```text |
| 48 | +Use $debug-mode to investigate this reproducible runtime bug with temporary probes, manual reproduction, log evidence, a minimal fix, and cleanup. |
| 49 | +``` |
| 50 | + |
| 51 | +When the agent pauses for manual verification, reply with the leading letter: |
| 52 | + |
| 53 | +```text |
| 54 | +A - Reproduced |
| 55 | +B - Fixed |
| 56 | +C - Other; describe what happened |
| 57 | +``` |
| 58 | + |
| 59 | +Checkpoint wording, evidence format, troubleshooting, and cleanup steps are in |
| 60 | +`SKILL.md`. |
| 61 | + |
| 62 | +## Install |
| 63 | + |
| 64 | +Install with the open Agent Skills CLI: |
| 65 | + |
| 66 | +```bash |
| 67 | +npx skills add wangnan0916/debug-mode-skill |
| 68 | +``` |
| 69 | + |
| 70 | +Install globally: |
| 71 | + |
| 72 | +```bash |
| 73 | +npx skills add wangnan0916/debug-mode-skill -g |
| 74 | +``` |
| 75 | + |
| 76 | +Install to a specific agent: |
| 77 | + |
| 78 | +```bash |
| 79 | +npx skills add wangnan0916/debug-mode-skill -a codex |
| 80 | +``` |
| 81 | + |
| 82 | +List without installing: |
| 83 | + |
| 84 | +```bash |
| 85 | +npx skills add wangnan0916/debug-mode-skill --list |
| 86 | +``` |
| 87 | + |
| 88 | +Update later: |
| 89 | + |
| 90 | +```bash |
| 91 | +npx skills update debug-mode |
| 92 | +``` |
| 93 | + |
| 94 | +## Layout |
| 95 | + |
| 96 | +```text |
| 97 | +skills/debug-mode/ |
| 98 | + SKILL.md # full agent workflow and protocol |
| 99 | + agents/openai.yaml # Codex / OpenAI skill UI metadata |
| 100 | + assets/ |
| 101 | + browser-log-helper.js # copy into frontend code |
| 102 | + node-log-helper.js # copy into Node/server code |
| 103 | + scripts/ |
| 104 | + log-server.mjs # loopback NDJSON collector |
| 105 | +
|
| 106 | +tests/ # Node built-in tests for collector + skill metadata |
| 107 | +``` |
| 108 | + |
| 109 | +## Safety |
| 110 | + |
| 111 | +- Collector binds to loopback only (`127.0.0.1`, `localhost`, or `::1`). |
| 112 | +- Probes must not log secrets, tokens, cookies, auth headers, or raw private |
| 113 | + payloads. |
| 114 | +- Temporary instrumentation uses `DEBUG_MODE_PROBE <session_id>` region markers |
| 115 | + so agents can remove it mechanically. |
| 116 | +- Debug logs are local temp evidence and should not be committed. |
| 117 | + |
| 118 | +## Development |
| 119 | + |
| 120 | +```bash |
| 121 | +npm run check |
| 122 | +npm test |
| 123 | +``` |
| 124 | + |
| 125 | +Requires Node.js 18+. Tests use only Node.js built-ins. |
| 126 | + |
| 127 | +## License |
| 128 | + |
| 129 | +MIT. See [LICENSE](LICENSE). |
0 commit comments