dap-request-review
Use when reviewing or refactoring a DAP request handler for parse-first ordering, typed argument extraction, and validated state changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when reviewing or refactoring a DAP request handler for parse-first ordering, typed argument extraction, and validated state changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when a new DAP feature needs replay coverage from real VS Code sessions, or when the user hands in a recording to verify, archive, and normalize into a fixture. Covers authoring the manual recording protocol (TODO.md) and the per-recording handoff cycle.
Use when analyzing a recorded dap-dbgeng session trace or investigating a live debugging bug from its DAP request/response/event flow.
Use when validating or improving test coverage for a DAP request handler, using the session replay tests and request matrix as the source of truth.
| name | dap-request-review |
| description | Use when reviewing or refactoring a DAP request handler for parse-first ordering, typed argument extraction, and validated state changes. |
Use this skill when reviewing or tightening the implementation of any DAP request
handler such as launch, attach, initialize, configurationDone, continue,
evaluate, stackTrace, setBreakpoints, pause, next, stepIn, stepOut,
threads, scopes, variables, terminate, or disconnect.
This skill is for implementation quality, not coverage (see dap-request-coverage for
that). The goal is to make each handler easy to audit: parse first, validate required
inputs early, turn arguments into typed values, and only then touch debugger-session
state, server state, or protocol side effects.
nlohmann::json into dap_server helpers, debugger_session methods, or
engine-facing code - convert to typed values at the top and pass those down.program, cwd, dbgengPath, stopAtEntry, sources, symbolPath,
processId, connectionString, kernel, dumpFile). There are no alias chains
or legacy fallbacks in this repo - keep it that way; do not add a ?? b reads.lower_case naming for locals (a stopAtEntry argument reads into
stop_at_entry); never carry a JSON spelling that differs from the canonical key.Identify the request boundary.
Open the dedicated handler file, src/service/dap_server_<command>.cpp. This
one-file-per-request layout is a project convention, so the boundary already exists;
if a new request lacks its own file, create one before reviewing style or logic.
Inspect the top of the handler for parsing order.
The first block should read arguments via util::dap_argument_reader (after
reader::get_arguments(current_request_json_)) into typed locals or a small typed
struct. Flag violations such as:
create_debugger_session, require_debugger_session,
session.set_current_thread, session.launch, session.attach,
dispatcher_.invoke, send / send_response, or other side effects before
required parsing is completeValidate required inputs before side effects.
For each required input, confirm the handler errors out (via send_error_response)
before mutating any session or server state. Examples:
program must be validated before launch session creationprocessId or dumpFile (or kernel + connectionString) must be validated
before attach session creationsource.path must be present before set_source_breakpointsthreadId before an execution request (use the shared validators
require_positive_thread_id / reject_single_thread / reject_target_id)Keep typed values below the parsing boundary.
Once the handler has the raw arguments, convert them to typed values and pass those down. Review helper and session calls for leaked raw JSON.
Bad patterns:
apply_session_configuration(session, arguments) (raw json)const nlohmann::json &arguments when it needs a few typed
valuesPreferred patterns:
apply_session_configuration(session, configuration) with a typed
session_configuration{symbol_path, source_path}launch_options / attach_options-style record)
when a request has several related optionsConfirm there are no alias or fallback reads.
The canonical key is read once. There must be no try_get_string(args, "program")
falling back to an old name, and no compatibility spellings. If you find one, remove
it (this repo deliberately carries no legacy aliases).
Check session/server state mutation ordering.
After parsing and validation, verify side effects are ordered coherently:
launch_awaiting_configuration_done_, launch_stop_at_entry_,
launch_thread_id_, detach_on_disconnect_, terminate_debuggee_on_disconnect_,
is_execution_running_, or pending_stopped_event_ only after the underlying
action has succeeded far enough to justify that statedispatcher_.invoke); only
IDebugControl::SetInterrupt (via session.interrupt()) is called off-dispatcherCheck comments for value.
Keep comments that explain a protocol or ordering constraint (why validation precedes session creation, why a state flag flips only after an operation, why an interrupt-then-resume is used). Remove comments that merely narrate code.
Finish with a verdict.
Classify findings:
a ?? b read leaked innlohmann::json passed below the handler boundaryWhen the fix is clear, name a concrete refactor target (for example "extract
read_launch_options(arguments)") rather than only describing the smell.
Before calling a handler review complete, confirm:
dap_server_<command>.cppnlohmann::jsonlower_case naming for option values/W4 /WX and is clang-format cleanFocused request: <request>
Handler file: src/service/dap_server_<command>.cpp
Verdict: <clean / needs refactor / blocked>
Findings:
- <severity>: <issue> -> <why it matters> -> <recommended refactor>
Approved patterns:
- <typed parsing or ordering choice that should be kept>
Refactor direction:
1. <parse/normalize extraction>
2. <validation reorder>
3. <typed helper boundary>
Completion check:
- <which checklist items pass>
- <which still fail>
launch handler with dap-request-review.dap-request-review on attach and flag any raw nlohmann::json passed to
session helpers.dap-request-review to setBreakpoints and check its validation ordering.dap-request-review across all dap_server_*.cpp handlers and list parse-first
violations.