kramme-cc-workflow/skills/kramme:debug:investigate/SKILL.md
Structured bug investigation workflow: reproduce, isolate, trace root cause, and fix. Use when debugging a bug, investigating an error, or tracking down a regression.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:debug:investigateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Structured debugging workflow: reproduce, isolate, trace root cause, and fix. Maintains an investigation log throughout with evidence and confidence assessment.
IMPORTANT: Follow all phases systematically. Do not skip to a fix without tracing the root cause first.
Not for: performance profiling, greenfield feature work, or changes whose cause is already known — go straight to the change in those cases.
Parse $ARGUMENTS before Step 1. If --auto is present, set AUTO_MODE=true and remove the flag from the bug description. --auto chooses conservative debugging defaults and continues without strategy prompts when evidence is sufficient. It does not bypass required bug input, low-confidence stops, reproduction gaps that make a fix speculative, or verification failure handling.
/kramme:debug:investigate "TypeError: Cannot read property 'id' of undefined"
|
v
[Step 1: Parse Input] -> Bug description / error / Linear issue
|
v
[Step 2: Reproduce] -> Confirm bug exists, find trigger
|
v
[Step 3: Isolate] -> Narrow scope to files/functions
|
v
[Step 4: Trace Root Cause] -> Follow data flow, git bisect if regression
|
v
[Step 5: Document Findings] -> Structured investigation log
|
v
[Step 6: Propose Fix] -> Confidence assessment + user approval
|
v
[Step 7: Implement and Verify] -> Fix + regression test + verify
|
v
[Step 8: Summary] -> Root cause, fix, verification status
If $ARGUMENTS matches a Linear issue pattern (e.g., TEAM-123):
get_issue (Claude Code mcp__linear__get_issue; Codex get_issue).If $ARGUMENTS contains an error message: use as a grep search target.
If $ARGUMENTS is free text: use as bug description.
If $ARGUMENTS is empty: ask the user — "What bug should I investigate? Describe it, paste an error message, or provide a Linear issue ID." Wait for a response before continuing.
Store as BUG_DESCRIPTION.
Search the codebase for the error message or relevant symbols using Grep.
Check for existing tests that cover the affected area — run them.
If reproduction is found, log: [REPRODUCE] Confirmed via {method}
If no reproduction path found:
If AUTO_MODE=true, do not ask for reproduction steps. Continue with static investigation only, log [REPRODUCE] unconfirmed via available local evidence, and do not implement a fix later unless the root cause becomes High confidence and a regression test can be written from code evidence.
Otherwise:
Ask the user, using a structured-question capability when the harness provides one. If not, ask the same question in plain text with a numbered list and wait for the response:
Header: Reproduction
Question: How can this bug be reproduced?
Options:
1. Run specific test — I'll provide the test command
2. Steps to follow — I'll describe the reproduction steps
3. Cannot reproduce — the bug is intermittent or environment-specific
[REPRODUCE] {method} → {result: confirmed/unconfirmed}From the error location (Step 2), identify affected files.
Read surrounding code to understand module boundaries and data flow.
Grep for all callers and call sites of the affected function/method.
Classify the scope:
If multiple candidate areas found:
If AUTO_MODE=true, investigate all candidates and keep a short evidence note for each before narrowing. Otherwise:
Ask the user, using a structured-question capability when the harness provides one. If not, ask the same question in plain text with a numbered list and wait for the response:
Header: Multiple Candidate Areas
Question: The bug could originate in several areas. Where should I focus first?
Options:
1. "{area 1}: {evidence}"
2. "{area 2}: {evidence}"
3. "Investigate all candidates"
[ISOLATE] Scope narrowed to {files/functions}Read identified code paths in full. Follow execution from trigger to error.
Check for regression — if the bug may have been introduced recently:
If AUTO_MODE=true, use git bisect only when both a known-good commit and an automated failing command are available without user input. Otherwise continue manual trace and note that bisect was skipped. If AUTO_MODE is false:
Ask the user, using a structured-question capability when the harness provides one. If not, ask the same question in plain text with a numbered list and wait for the response:
Header: Regression Investigation
Question: This looks like it may be a regression. Use git bisect to find the introducing commit?
Options:
1. Yes, run git bisect
2. No, continue manual trace
If bisecting:
references/bisect-guide.md.git bisect run <test-command>.git bisect reset when finished — and before any fallback or early exit — to restore the working tree.Consult investigation patterns:
references/investigation-patterns.md.Trace data flow from origin to error point. Track variable values through assignments and transformations.
Log: [ROOT CAUSE] {description} at {file}:{line}
Read the log template from assets/investigation-log.md and fill it in from the timeline logs ([REPRODUCE], [ISOLATE], [ROOT CAUSE]) and findings gathered so far. Capture evidence — code snippets, test output, bisect results — under the relevant sections.
Store the completed log for inclusion in the final summary.
Assess confidence:
If confidence is Low: present findings to user before proceeding. In AUTO_MODE, skip directly to Step 8 with Fix Applied: No.
If AUTO_MODE=true and confidence is High or Medium, choose Implement fix + write regression test only when reproduction was confirmed. If reproduction was unconfirmed, implement only when confidence is High and a deterministic regression test can be written from code evidence; otherwise skip directly to Step 8 with Fix Applied: No. When reproduction was confirmed but no local test framework or deterministic regression test path exists, implement the minimal fix and note Regression Test: skipped - no deterministic local test path found. If confidence is Low, report only.
Otherwise ask the user, using a structured-question capability when the harness provides one. If not, ask the same question in plain text with a numbered list and wait for the response:
Header: Fix Strategy
Question: Root cause identified with {confidence} confidence. How to proceed?
Options:
1. Implement fix + write regression test
2. Implement fix only, skip test
3. Report findings only, do not change code
If Report only: skip to Step 8.
[FIX] Applied at {file}:{line}[TEST] Regression test at {test_file}/kramme:verify:run if available.[VERIFY] Tests: {PASS/FAIL}, Build: {PASS/FAIL}Bug Investigation Complete
==========================
Bug: {BUG_DESCRIPTION}
Root Cause: {one-line summary}
Confidence: High / Medium / Low
Location: {file}:{line}
CHANGES MADE
- Fix Applied: Yes / No
- Files Modified: {list, or "none"}
- Regression Test: {test file path, or "none"}
- Verification: Tests PASS / FAIL, Build PASS / FAIL
THINGS I DIDN'T TOUCH
- {NOTICED BUT NOT TOUCHING entries — out-of-scope issues spotted during investigation, or "none"}
POTENTIAL CONCERNS
- {unverified assumptions, unconfirmed reproduction, skipped regression test, or Low/Medium confidence caveats, or "none"}
Investigation Log:
(include the completed log from Step 5)
STOP — Do not continue beyond this point. The investigation is complete.
| Scenario | Action |
| --- | --- |
| Error message not found in codebase | Widen search: partial matches, case-insensitive, related symbols. Ask user for context. |
| Git bisect fails | Run git bisect reset to restore the tree, then fall back to manual trace using investigation patterns. |
| Fix verification fails after 3 iterations | Present failures, suggest manual investigation. |
| Linear MCP unavailable | Treat issue ref as text, ask user to paste content. |
| No test framework detected | Skip regression test. Note in summary. |
| Codebase too large for broad grep | Ask user to narrow scope to specific directories. |
tools
Requires Linear MCP. Implements one Linear issue end to end, selects applicable code-review, convention, and PR-refactor gates, runs them to bounded convergence, verifies, and optionally opens the PR and iterates on CI and review feedback until green. Use when the user wants a single Linear issue taken from implementation through a clean Pull Request. Not for implementation-only work, SIW-tracked issues, stacked PRs, existing PR updates, or post-merge rollout.
development
Reviews PR and local changes for convention drift and overcaution against documented rules and mined peer-file practice. Use for new patterns, dependencies, abstractions, or defensive complexity that departs from established practice; every finding cites evidence. Supports --inline. Not for general code quality (use kramme:pr:code-review) or spec review (use kramme:siw:spec-audit --team).
testing
Charts huge or foggy initiatives into a local `.context` decision map and resolves one typed frontier ticket per session until the work is ready for SIW or another execution workflow. Use when the route to a destination cannot fit in one agent session or parallel workspaces need coordinated planning state. Not for clear specs, ordinary issue decomposition, implementation, or Linear-native tracking.
development
Investigates a question against primary sources and saves one cited Markdown artifact. Use for reading legwork: official docs/API facts, source-code or spec checks, standards, and first-party service behavior before planning or implementation. Not for making product or architecture decisions, implementing code, broad web search, secondary blog summaries, or uncited answers.