Skip to content

Commit b723aeb

Browse files
init
Co-authored-by: Cursor <cursoragent@cursor.com>
0 parents  commit b723aeb

12 files changed

Lines changed: 1564 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: 20
15+
- run: npm run check
16+
- run: npm test

‎.gitignore‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
node_modules/
3+
npm-debug.log*
4+
5+
.runtime-debug/
6+
*.ndjson

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 wangnan0916
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎README.md‎

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
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).

‎package.json‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "debug-mode-skill",
3+
"version": "0.1.0",
4+
"private": true,
5+
"type": "module",
6+
"description": "Agent-agnostic debug-mode skill with local NDJSON log collection.",
7+
"scripts": {
8+
"check": "node --check skills/debug-mode/scripts/log-server.mjs && node --check skills/debug-mode/assets/browser-log-helper.js && node --check skills/debug-mode/assets/node-log-helper.js && node --check tests/log-server.test.mjs && node --check tests/skill-config.test.mjs",
9+
"test": "node tests/log-server.test.mjs && node tests/skill-config.test.mjs"
10+
},
11+
"engines": {
12+
"node": ">=18"
13+
}
14+
}

0 commit comments

Comments
 (0)