AGENT SKILL
investigate
Use when: investigating a code problem, error, or unexpected behavior. Reports root cause and fix plan, then waits for user approval before modifying code.
- License 许可
- GPL-3.0
- 最近更新
- 2026-10-29
- Stars
- ★ 45
- Forks
- 4
01 前言 Front Matter
- name
- investigate
- description
- Use when: investigating a code problem, error, or unexpected behavior. Reports root cause and fix plan, then waits for user approval before modifying code.
03 SKILL.md 正文
Investigate: Root-Cause Analysis + Approval-Gated Fix
When to Use
- User reports an error, bug, or unexpected behavior.
- A test fails and the reason is unclear.
- The code compiles but produces wrong results.
- Before making any invasive refactoring or fix — get approval first.
Workflow
Step 1: Gather Context
- Collect the error message / symptom from the user's query or terminal output.
- Identify the relevant file(s):
- If the error includes a stack trace, read the offending file around the failing line.
- If no trace, ask the user for reproduce steps or the exact file.
- Read the affected code sections and any related dependencies.
- Check config / environment if the issue looks environment-specific.
Step 2: Identify Root Cause
- Analyze the code to determine why the symptom occurs.
- Distinguish between:
- Logic error: incorrect algorithm or condition.
- Type mismatch: wrong types being passed/returned.
- Missing null/edge-case handling: crash on empty input, None, etc.
- API change: a called function changed signature or behavior.
- Config / environment: wrong settings, missing dependencies.
- Do not propose a fix yet — just record the cause clearly.
- You can draw a graph to explain the problem.
Step 3: Propose Fix Plan (No Code Changes Yet)
- Describe the fix approach in plain language.
- List the exact files and lines that need to change.
- For each change, state what the new code should do and why it resolves the root cause.
- Use a format the user can scan quickly:
## Root Cause
(1–3 sentences explaining the real reason)
(graph)
## Fix Plan
| File | Line(s) | Change |
|------|---------|--------|
| src/foo.py | 42–50 | Replace `x` with `y` because ... |
| src/bar.py | 120 | Add None check before accessing `.name` |
- Stop here. Do NOT read, write, or edit any files after step 2. Wait for the user's explicit approval.
Step 4: Apply Fix (After Approval)
Only after the user responds with "approve", "yes", "go ahead", or an equivalent confirmation:
- Apply each change from the plan.
- After each edit, verify syntax (e.g.,
py_compilefor Python). - Run relevant tests if available.
- Summarize what was changed and the verification result.
Quality Criteria
- Every fix plan includes root cause, affected files, and exact line ranges.
- No code is written or edited before user approval.
- After applying, at least syntax verification is done — and tests if they exist.
- If multiple root causes exist, list them all in priority order.
04 同仓库更多 Skills
self-improvement-using-agile
暂无简介
★ 45
plugin-creation
暂无简介
★ 45
nimble-window
暂无简介
★ 45
minecraft
暂无简介
★ 45
gesellschaft
暂无简介
★ 45
faustbot-using-guide
暂无简介
★ 45