skills/investigate/SKILL.md
Investigate, audit, triage, and fix. Systematic debugging, incident lifecycle, domain auditing, and issue logging. Four-phase protocol: root cause → pattern analysis → hypothesis test → fix. Use for: any bug, test failure, production incident, error spikes, audit, triage, postmortem, "investigate", "why is this broken", "debug this", "production down", "is production ok", "audit stripe", "log issues".
npx skillsauth add phrazzld/spellbook investigateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Find root cause. Fix it. Prove it works.
You are the executive orchestrator.
| Intent | Sub-capability |
|--------|---------------|
| Debug a bug, test failure, unexpected behavior | This file (below) |
| Flaky test investigation | references/flaky-test-investigation.md |
| Incident lifecycle: triage, investigate, postmortem | references/triage.md |
| Domain audit: "audit stripe", "audit quality" | references/audit.md |
| Audit then fix highest priority issue | references/fix.md |
| Create GitHub issues from audit findings | references/log-issues.md |
If first argument matches a domain name (stripe, quality, etc.), route to references/audit.md.
If "triage", "incident", "postmortem", "production down" → references/triage.md.
If "flaky", "flake", "intermittent", "nondeterministic test" → references/flaky-test-investigation.md.
If "fix" → references/fix.md. If "log issues" → references/log-issues.md.
Otherwise, this is a debugging session — continue below.
The user's symptoms: $ARGUMENTS
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
External service issues are usually config, not code. Check in order:
npx convex env list --prod | grep <SERVICE> or vercel env lscurl -I -X POST <webhook_url>Spawn a single Explore subagent to gather evidence. Tell it to investigate the symptoms, reproduce the issue, trace data flow, and report back with root cause + evidence + proposed fix. It should NOT implement the fix — just report. You review, decide if root cause is proven, then dispatch a builder for the fix or dig deeper.
When >2 plausible root causes and a single investigation would anchor on one: spawn parallel Explore subagents, one per hypothesis. Each gets one hypothesis to prove or disprove by tracing a specific subsystem. They report back with confirmed/disproved + evidence. You synthesize into a consensus root cause, then dispatch a builder (general-purpose) for the fix.
Use when: ambiguous stack trace, multiple services, flaky failures. Don't use when: obvious single cause, config issue, simple regression.
| You (lead) | Sub-agents (investigators) | |------------|---------------------------| | Ranking hypotheses | Tracing one subsystem | | Declaring root cause proven | Comparing working vs broken | | Choosing the fix | Gathering logs and reproductions | | Deciding when evidence is sufficient | Running targeted test cases |
When you can't reproduce the bug yourself (auth-gated, mobile, timing-dependent, hardware-specific, user-flow-dependent):
INSTRUMENT → USER REPRODUCES → READ LOGS → REFINE → REPEAT
LOG_FILE="${HOME}/Desktop/debug-$(date +%s).log"
Log at decision points: function entry/exit, branch taken, values at boundaries.
Tag each log line with the hypothesis it tests: [H1] auth token expired: ${token.exp}Use when: flaky tests, user-reported bugs you can't trigger, environment-specific issues. Don't use when: bug reproduces in your environment (just use Phase 1-4 directly).
BEFORE attempting ANY fix:
git diff, git log --oneline -10, new deps, configScientific method. One experiment at a time. No stacking.
Never skip justification. "Just try X" is a red flag — if you can't explain what you'll learn from an experiment, you don't understand the problem yet.
references/systematic-debugging.md.For each hypothesis, categorize:
Post-fix question: "If we revert in 6 months, does the problem return?"
Before declaring "fixed", show:
Mark as UNVERIFIED until observables confirm.
| Type | Signals | Approach | |------|---------|----------| | Test failure | Assertion error | Read test, trace expectation | | Runtime error | Exception, crash | Stack trace -> source -> state | | Type error | TS complaint | Read error, check types | | Build failure | Bundler error | Check deps, config | | Behavior mismatch | "Does Y, should do X" | Trace code path | | Performance | Slow, timeout | Add timing instrumentation | | Production incident | Incident tracker, alerts | Create INCIDENT.md, timeline |
For non-trivial production issues, create INCIDENT-{timestamp}.md:
wc -l <file> or du -hsed -n '1,120p'; jump with rg -nhead -n 200, tail -n 200testing
Capture one compounding repo-technical learning while a solved problem is still fresh. Use when: after a bug fix, diagnosis, delivery, review, or incident reveals a reusable pattern worth adding to `docs/solutions/`. Trigger: /compound, /capture-learning, /learning.
testing
Route Misty Step factory application capabilities. Use when choosing, auditing, integrating, or operating Canary, Powder, Landmark, Aesthetic, or Bitterblossom: production observability, incidents, health checks, error logging, backlog/work-card state, release intelligence, UI/UX system adoption, or supervised/unsupervised agent dispatch. Trigger: /factory-apps, /factory-stack.
testing
Prove a skill beats no-skill with a falsifiable A/B eval, or retire it. Design, generate, run, and maintain a skill-specific eval: name the one claim the skill must earn, run it skill-on vs raw same-model, grade blind with objective checks first, return a keep/adapt/cut verdict. Use when: "eval this skill", "does this skill help", "prove the skill beats no skill", "write an eval for", "benchmark a skill", "is this skill worth it", "skill A/B", "skill regression test", "generate skill evals". Trigger: /skill-eval, /eval-skill, /prove-skill.
tools
> Template. Copy to `<target-repo>/.agents/skills/<repo>-<domain>/SKILL.md` > and fill every bracketed placeholder from the live target repo. Delete this > line and every other `> ` guidance line before committing. See > `../../references/repo-local-skill-generation.md` for the full process. --- name: <repo>-<domain> description: | [One paragraph: what this skill verifies/runs/operates for <repo>, stated in terms of the repo's real shape (service/CLI/library/etc.), not generic process. En