技能 调试
- 作者仓库星标 263
- 作者仓库 audio-plugin-coder
Purpose
This document defines a self-directed debugging workflow for a Large Language Model (LLM) operating inside or alongside Visual Studio Code: (VS Code:). The goal is for the LLM to:
- Inspect a codebase without human intervention
- Identify likely failure points
- Insert breakpoints programmatically
- Generate a valid VS Code:
launch.jsondebugging configuration - Enter VS Code: debug mode
- Capture runtime errors, logs, and stack traces
- Filter noise while preserving full raw error telemetry
- Transmit all collected diagnostic data back to the LLM for analysis
This workflow assumes the LLM has:
- Read access to the workspace
- Write access to configuration files
- The ability to invoke VS Code: commands (directly or via an agent/tooling layer)
High-Level Debugging Strategy
The LLM must operate as a deterministic debugger, not a conversational assistant.
Core principles:
- Prefer evidence over speculation
- Favor runtime inspection over static guesses
- Never suppress errors at source
- Always preserve original error output
Step 1: Workspace Reconnaissance
- Enumerate the workspace root
- Identify:
- Primary language(s)
- Entry points (e.g.
main.py,index.js,app.ts,Program.cs) - Existing test suites
- Existing
.vscodeconfiguration
- Detect build systems and runtimes:
- Node.js, Python, Java, .NET, Go, etc.
Output a workspace map internally before proceeding.
Step 2: Static Code Analysis
For each execution path:
- Parse the AST (or equivalent)
- Identify:
- Unhandled exceptions
- Unsafe casts
- Null/undefined dereferences
- Infinite loops
- Race conditions (async / threading)
- External I/O boundaries (filesystem, network, DB)
Mark all high-risk lines.
Step 3: Breakpoint Placement Heuristics
Automatically insert breakpoints at:
- Program entry point
- All caught and uncaught exception blocks
- Function boundaries with:
- Complex conditionals
- State mutation
- External side effects
- Before and after async boundaries
- Any line referenced in stack traces from prior runs
Breakpoint Rules
- Prefer conditional breakpoints when possible
- Avoid breakpoints inside tight loops unless gated
- Label each breakpoint with intent (comment or metadata)
Step 4: Generate VS Code: Debug Configuration
Create or update:
.vscode/launch.json
Requirements
- Use the correct debugger type for the detected runtime
- Ensure
stopOnEntryis enabled - Enable verbose logging
- Capture stdout and stderr
- Do NOT suppress framework-level warnings
Example (Node.js)
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "LLM Autonomous Debug",
"program": "${workspaceFolder}/index.js",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"stopOnEntry": true,
"outputCapture": "std",
"env": {
"NODE_ENV": "development"
}
}
]
}
Adapt as required for other languages.
Step 5: Enter Debug Mode
- Invoke VS Code: command:
Debug: Start Debugging
- Confirm debugger attachment
- Verify all breakpoints are registered
If debugger fails to attach, halt and report configuration errors.
Step 6: Runtime Observation
While execution is paused or running:
Capture:
- Call stacks
- Variable states
- Heap/closure values (where available)
- Thread or async task states
On error or crash, collect:
- Full stack trace
- Error type
- Error message
- Source location
- Runtime version
- OS and architecture
Step 7: Error Telemetry Handling
DO NOT discard information
The LLM must:
- Capture raw error output verbatim
- Separately derive:
- A cleaned summary
- A probable root cause
- A confidence score
Noise Handling
- Framework warnings
- Deprecation notices
- Transitive dependency logs
These must be tagged as low-signal, not removed.
Step 8: Transmission Back to the LLM
Transmit a structured payload containing:
- Workspace map
- Breakpoint list
launch.json- Execution timeline
- Raw stderr/stdout
- Stack traces
- Memory snapshots (if available)
Suggested Format
{
"environment": {},
"breakpoints": [],
"errors": [],
"rawLogs": "",
"analysisHints": []
}
Step 9: Iterative Debugging Loop
If the root cause is not definitive:
- Adjust breakpoints
- Restart debug session
- Narrow scope
- Repeat until failure is explained by evidence
Never apply fixes without isolating the cause.
Termination Criteria
Stop only when:
- The error is fully reproducible
- The root cause is identified
- The exact line(s) responsible are known
At that point, transition from debugging mode to remediation mode.
Final Note
This document defines behavior, not intent.
The LLM must act as a debugger first, a theorist second, and a code generator last.
- 流狐分类
- AI 智能
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @Noizefield · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- macOS · Linux · Windows
- 底层运行要求
- Node.js · Python
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Enumerate the workspace root Identify: Primary language(s)
For each execution path: Parse the AST (or equivalent) Identify:
Automatically insert breakpoints at: Program entry point All caught and uncaught exception blocks
Create or update:
Invoke VS Code: command: Debug: Start Debugging Confirm debugger attachment
## Purpose
This document defines a **self-directed debugging workflow** for a Large Language Model (LLM) operating inside or alongside **Visual Studio Code: (VS Code:)**. The goal is for the LLM to:
1. Inspect a codebase without human intervention
2. Identify likely failure points
3. Insert breakpoints programmatically
4. Generate a valid VS Code: `launch.json` debugging configuration
5. Enter VS Code: debug mode
6. Capture runtime errors, logs, and stack traces
7. Filter noise while preserving full raw error telemetry
8. Transmit all collected diagnostic data back to the LLM for analysis
This workflow assumes the LLM has:
- Read access to the workspace
- Write access to configuration files
- The ability to invoke VS Code: commands (directly or via an agent/tooling layer)
---
## High-Level Debugging Strategy
The LLM must operate as a **deterministic debugger**, not a conversational assistant.
Core principles:
- Prefer evidence over speculation
- Favor runtime inspection over static guesses
- Never suppress errors at source
- Always preserve original error output
---
## Step 1: Workspace Reconnaissance
1. Enumerate the workspace root
2. Identify:
- Primary language(s)
- Entry points (e.g. `main.py`, `index.js`, `app.ts`, `Program.cs`)
- Existing test suites
- Existing `.vscode` configuration
3. Detect build systems and runtimes:
- Node.js, Python, Java, .NET, Go, etc.
Output a **workspace map** internally before proceeding.
---
## Step 2: Static Code Analysis
For each execution path:
1. Parse the AST (or equivalent)
2. Identify:
- Unhandled exceptions
- Unsafe casts
- Null/undefined dereferences
- Infinite loops
- Race conditions (async / threading)
- External I/O boundaries (filesystem, network, DB)
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> Purpose → High-Level Debugging Strategy → Step 1: Workspace Reconnaissance → Step 2: Static Code Analysis → Step 3: Breakpoint Placement Heuristics → Breakpoint Rules
要点 -> self-directed debugging workflow · Visual Studio Code: (VS Code:) · deterministic debugger · workspace map · high-risk lines · raw error output verbatim · tagged as low-signal · debugging mode
文件/命令 -> launch.json · main.py · index.js · app.ts · Program.cs · .vscode · stopOnEntry · Debug: Start Debugging
内容 SHA-256 -> 89ac5b55bd27
方法与流程
适用与边界
原文中的明确线索
launch.json、main.py、index.js、app.ts、Program.cs、.vscode、stopOnEntry、Debug: Start Debugging