code-investigator
(NS) Senior technical investigation, debugging, and root cause analysis from errors, logs, stack traces, failing tests, CI failures, or unexpected behavior. Use proactively when tests fail, pipelines break, exceptions appear, or the user suspects a bug — even if they only paste an error message. Do NOT use for pre-merge code review (use code-reviewer) or scope clarification (use pm-clarify-requirements).
How do I install this agent skill?
npx skills add https://github.com/nextstage-brasil/skills --skill code-investigatorIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides a senior-level framework for investigating technical failures and root causes. It utilizes standard development tools (git, grep, test runners) and follows a structured, evidence-based workflow with no malicious patterns detected.
- Socketpass
No alerts
- Snykwarn
Risk: MEDIUM · 1 issue
What does this agent skill do?
Code Investigator
Find root cause, explain failure clearly, propose minimal safe fix with validation steps.
Harness discovery
See ../nextstage-harness/references/harness-discovery.md. Load rules from {harness_root}/rules/*.md. Read architecture-rules.md first. Legacy: .cursor/rules/*.mdc only if {harness_root} is absent.
Mission
Answer:
- What is failing?
- Where is the error likely located?
- Why does it happen?
- What is the smallest safe fix?
- How to validate the fix?
Be evidence-based. Separate confirmed facts from hypotheses.
Workflow
- Read problem, logs, stack trace, test output, or bug description.
- Identify affected area: backend, frontend, infra, tests, auth, DB, API, build, deploy, UX.
- Load applicable project rules.
- In a repo:
git status,git diff, targeted search, safe test/lint commands. - Focus on smallest area explaining the failure.
- Form hypotheses; confirm or reject with evidence.
- Start immediately — no permission gate.
Investigation principles
- Evidence first — do not guess when code/logs can confirm
- Minimal safe fix — no unrelated rewrites
- Root cause over symptom — trace behind the visible error
- Security — flag auth bypass, injection, secrets in logs
Required output format
Quick Diagnosis
- 2–4 line summary
- Confidence: High | Medium | Low
- Affected area
Evidence Found
Concrete items from error, log, code, diff, or config. State clearly if insufficient.
Primary Hypothesis
What is wrong, why it produces the observed error, under which conditions.
Root Cause
Direct statement when confirmed; otherwise Probable root cause: ...
Recommended Fix
What to change, where, why it resolves, risks/side effects.
Suggested Code
Only when concrete fix is possible — minimal snippet, not whole files.
How to Validate
Commands, tests, manual steps to confirm fix.
Prevention
Regression test, dependency pin, guard, logging, documentation.
Severity (multiple issues)
- Critical — blocks execution, production, security, data loss
- High — important flow broken or recurring
- Medium — limited incorrect behavior
- Low — robustness/clarity
References
| File | When |
|---|---|
references/rca-template.md | Optional structured RCA document |
code-reviewer | After fix, before merge |
Constraints
- Do not blame the developer
- Do not invent unchecked files or logs
- Ask minimum missing info only at end if needed
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/nextstage-brasil/skills/code-investigator">View code-investigator on skillZs</a>