investigate
Investigate bugs — single-issue deep root cause analysis or batch parallel investigation from a report or issue list
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Investigate bugs — single-issue deep root cause analysis or batch parallel investigation from a report or issue list
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use for one-off / single-question inspection of the running GitLens extension — examining UI state, reading logs, checking feature flags, dispatching a command, or asking "what does the live DOM look like right now". Reference for `vscode-inspector` MCP primitives. For iterative debug-and-fix loops on UI bugs (sweep → fix → re-verify), use `/live-exercise` instead.
Use whenever any UI-bearing work touches a running instance — building or fixing a feature, ship-gating, auditing, OR debugging visible bugs (flaky behavior, intermittent rendering, "sometimes does X" reports, hover/focus/animation glitches, layout overflow). Adaptive depth from tactical fix-loop to ship-gate audit. Not for pure-logic diff review.
Use to audit a component, file, or directory for WCAG 2.1 AA accessibility compliance. Detects ARIA anti-patterns, missing semantics, keyboard gaps, and color-only information. Safety-first — refuses to emit fixes that would create a new accessibility bug. Scope is always explicit; do not use for page-level flow or cross-program planning.
Use to audit a page, view, or composed flow for WCAG 2.1 AA compliance at the composition level - landmarks, heading hierarchy, tab order across components, focus handoff on modal open/close, live-region conflicts. Scope is page/view, NOT component internals. Safety-first - refuses to emit fixes that would create a new a11y bug. For single-component audits use /a11y-audit; for cross-program planning use /a11y-remediate.
Use to produce a leader-facing remediation proposal from one or more /a11y-audit outputs plus team and product context. Translates audit findings into sprint plans, staffing asks, customer-facing language, compliance rollups, and critical-path analysis. Refuses to fabricate numbers, owners, or commitments beyond the inputs it has.
Add new icons to the GitLens GL Icons font
| name | investigate |
| description | Investigate bugs — single-issue deep root cause analysis or batch parallel investigation from a report or issue list |
Perform structured root cause analysis of bugs. Operates in two modes: single-issue deep investigation or batch parallel investigation across multiple issues.
/live-exercise when the trace alone won't close the caseThis skill is the static-tracing layer: read code, form a hypothesis, point at a likely cause. For many bugs that's enough — finish here. But if the bug is reproducible in a running instance AND any of the following apply, escalate to /live-exercise after the trace to validate the theory, add temporary logging and observe it, or iterate fix → re-verify:
Pattern: trace as far as the code alone takes you, identify the candidate cause(s), then hand off to /live-exercise to confirm or refute live. Don't skip the trace — but don't keep tracing past the point where running it would be cheaper.
Stay entirely here for: pure-logic bugs, parser/algorithm correctness, build/config errors, well-isolated functions where the trace is short, or when no running instance is available.
/investigate <symptom or issue reference> # Single deep investigation
/investigate <number> <number> [number...] # Batch parallel investigation
/investigate --from-report [path] [--verdict "..."] [--max 10] # Batch from triage report
--from-report — Reads a triage decisions JSON. If path omitted, uses most recent *-DECISIONS.json in .work/triage/reports/ (excluding *-INVESTIGATION-DECISIONS.json).--verdict — Filter report to specific verdict(s). Defaults to Valid - Needs Triage. Comma-separated. Only applies with --from-report.--max — Maximum parallel investigations. Defaults to 10. Only applies to batch mode.Single mode — invoked with one issue number or a symptom description. Performs a deep, thorough investigation in the current agent context. Best for focused debugging.
Batch mode — invoked with 2+ issue numbers or --from-report. Spawns parallel subagents, each performing an independent investigation. Produces report files. Best for processing a queue of issues.
If the issue is older than 1 year, perform a quick relevance check before the full investigation:
Glob or Grepgit log --since="<issue creation date>" -- <relevant files> for significant changes### Relevance Assessment
[One of:
- "Code path still exists — issue may still be relevant"
- "Code path no longer exists — [file(s)] deleted/removed since issue was filed"
- "Feature area significantly refactored — [summary of changes since issue creation]"
- "Unable to map issue to specific code paths — proceeding with investigation"]
If the code path no longer exists, note this prominently and consider whether the investigation should continue or if the issue should be recommended for closure.
packages/utils/src/decorators/ if behavior is unclearsrc/env/node/ and src/env/browser/ pathspackages/git/src/providers/ and packages/git-cli/src/providers/Before presenting findings, assess where the diagnosis came from:
Be honest about this. Both are valuable — confirming a reporter's analysis is useful — but the reader should know what the investigation actually contributed.
## Investigation: [Symptom]
### Symptom
[What goes wrong]
### Source Attribution
[One of: "Independent analysis from code tracing" | "Confirms reporter's diagnosis — the issue included [specific detail: code references / file paths / root cause hypothesis] which this investigation verified against current code" | "Mixed — [explain what came from the issue vs. independent tracing]"]
### Code Path
[Entry point] -> [Function 1] -> [Function 2 (@gate)] -> [Function 3]
### Root Cause
[Cause with file:line evidence]
### Alternative Causes Considered
1. [Alternative] — ruled out because [evidence]
### Proposed Fix
[Minimal change to address root cause]
### Impact
- Files to modify: [list]
- Call sites checked: [count]
- Platform paths verified: Node.js [yes/no], Browser [yes/no]
Present findings and proposed fix. Wait for user confirmation before implementing.
Direct mode (2+ issue numbers):
Use the provided issue numbers directly. Proceed to Stage 1.
From-report mode (--from-report):
*-DECISIONS.json in .work/triage/reports/, excluding *-INVESTIGATION-DECISIONS.json)--verdict filter AND where the issue is a bug (check recommendedLabels or the corresponding markdown report for type info)--max, take the first N and note how many were skippedFor each qualifying issue, use the GitHub CLI to fetch the full issue body and comments:
gh issue view <number> --repo <repo> --json title,body,comments,labels,state,author,createdAt,updatedAt
The repo slug comes from the decisions JSON's corresponding evidence pack, or default to gitkraken/vscode-gitlens.
For each issue, spawn a subagent (using the Agent tool) with:
subagent_type: general-purposeRun subagents in parallel where possible. Each subagent operates independently.
Gather all subagent results and produce report files:
File: .work/triage/reports/YYYY-MM-DD-INVESTIGATION-REPORT.md
# Investigation Report — YYYY-MM-DD
Source: <decisions file path or "direct">
Issues investigated: N
Issues with findings: N
Issues inconclusive: N
---
## Findings
### [#NNNN — Title](https://github.com/<owner>/<repo>/issues/NNNN)
- **Author**: @username (team) | @username
- **Triage verdict**: <original verdict from triage, or "N/A" for direct mode>
- **Investigation result**: Confirmed Bug | Likely Fixed | Cannot Reproduce from Description | Inconclusive | Insufficient Information
- **Confidence**: High | Medium | Low
- **Source attribution**: Independent analysis | Confirms reporter's diagnosis | Mixed
- **Estimated effort**: Small (hours) | Medium (1-3 days) | Large (3+ days) | Unknown
- **Risk level**: Low | Medium | High | Unknown
#### Symptom
<restated from issue>
#### Code Path
<entry point> -> <function chain with file:line references>
#### Root Cause Analysis
<findings or "insufficient information to determine">
#### Alternative Causes Considered
1. <alternative> — ruled out because <evidence>
#### Recommendation
<what to do next — fix approach, request specific info from reporter, close, etc.>
---
## Inconclusive Issues
Issues where investigation could not reach a meaningful conclusion:
- [#NNNN — Title](https://github.com/<owner>/<repo>/issues/NNNN) — <reason: insufficient repro info | vague description | external dependency | etc.>
---
## Classification Matrix
Buckets confirmed/likely bugs by estimated effort and risk to aid prioritization:
| Issue | Effort | Risk | Summary |
| ----- | ------ | ---- | ----------------------------- |
| #NNNN | Small | Low | <one-line description of fix> |
| #NNNN | Medium | High | <one-line description of fix> |
**Effort guide**: Small = isolated change, hours of work; Medium = multiple files/systems, 1-3 days; Large = architectural or cross-cutting, 3+ days.
**Risk guide**: Low = safe, localized change; Medium = touches shared code or has edge cases; High = could regress other features or affects critical paths.
### Quick Wins (Small effort, Low/Medium risk)
- #NNNN — <title>
### Needs Planning (Medium/Large effort or High risk)
- #NNNN — <title> — <why it needs planning>
---
## Summary
- **Confirmed bugs**: N (list issue numbers)
- **Likely already fixed**: N (list issue numbers)
- **Inconclusive**: N (list issue numbers)
- **Skipped (over max)**: N
Write the markdown file and report its path to the user.
Also produce a machine-readable companion file: .work/triage/reports/YYYY-MM-DD-INVESTIGATION-DECISIONS.json
{
"reportId": "<uuid>",
"sourceDecisionsFile": "<path to triage decisions that triggered this, or null for direct mode>",
"generatedAt": "<ISO timestamp>",
"investigations": [
{
"issueNumber": 1234,
"result": "Confirmed Bug | Likely Fixed | Cannot Reproduce | Inconclusive | Insufficient Information",
"confidence": "High | Medium | Low",
"sourceAttribution": "Independent | Confirms Reporter | Mixed",
"estimatedEffort": "Small | Medium | Large | Unknown",
"riskLevel": "Low | Medium | High | Unknown",
"rootCauseSummary": "...",
"proposedFix": "...",
"affectedFiles": ["src/path/to/file.ts"],
"blockedBy": null | "vscode" | "git" | "cli" | "language-server" | "other",
"blockedDetail": "...",
"recommendation": "Fix | Request Info | Close | Needs Planning | Blocked"
}
]
}
Generate a UUID for reportId. Write both files and confirm their paths to the user.
@gate() first@info()/@debug()/@trace(). Check @gate() (promise never resolving) or the actual async operation first.@gate() and @sequentialize(): @gate() returns the SAME promise to concurrent callers. @sequentialize() QUEUES calls. These solve different problems..is() static method with reason discriminator: PushError.is(ex, 'noUpstream'), not instanceof + ex.message.includes(...).@env/ abstraction layer.getScopedLogger() returns stale scope after await in browser. Capture the scope before the first await.errors: throw so catch blocks handle them).This skill can be used standalone or as part of the issue workflow pipeline:
/triage recent → /investigate --from-report → /prioritize --from-report → /update-issues
/triage 5096 → /investigate 5096 → /prioritize 5096 → /update-issues
/investigate 5096 5084 (standalone batch)
/investigate #5096 (standalone single)
Upstream: --from-report consumes triage decisions JSON from /triage.
Downstream: /prioritize --from-report consumes the investigation decisions JSON. /update-issues can also consume it directly.
See AGENTS.md § Decorator System for the behavior table, gotchas, and stacking order. Read the decorator source in packages/utils/src/decorators/ when behavior is unclear — options like gate grouping keys/deadlock detection, memoize version-keyed invalidation, and sequentialize queue keys often matter during investigation.
Debugging priority:
@gate() — hangs, timeouts, deadlocks (check for circular waits: a nested gated call waiting on the outer gate)@memoize() — stale data, cached rejections (no TTL; rejected Promises stay cached)