Agent skill
root-cause-finder
Performs root-cause-first debugging and review by tracing expected behavior to the first unintended side effect before changing contracts, parsing, or types. Use when debugging protocol errors, deserialization failures, null payloads, missing fields, restore or hydration issues, state-ownership bugs, unexpected requests, background mutations, or reviewing junior-created code where the visible failure may be downstream noise.
Install this agent skill to your Project
npx add-skill https://github.com/regenrek/agent-skills/tree/main/skills/root-cause-finder
SKILL.md
Root-Cause Finder
Core Instruction
Before fixing the error, prove whether the code path that produced it was intended.
Do not stop at the first contract, parsing, type, null, or schema error. Treat it as a possible symptom.
Default Workflow
- State the expected behavior in plain language.
- State the invariant in one sentence.
- State what definitely did not happen.
- Trace the causal chain from the intended action or system event to the observed system effect.
- Ask whether the request or mutation should have happened at all.
- Identify the canonical source of truth and every competing source.
- Find the first unintended side effect or write.
- Only then decide whether a downstream contract fix is still necessary.
Questions To Answer In Order
- What user action or system event was supposed to happen?
- What exact call path caused this request or response?
- Should this request, mutation, or side effect have happened at all under the expected behavior and invariants?
- Who owns the state at each layer?
- Is there observer-driven syncing, lifecycle startup code, persistence restore, retry logic, background work, or multiple sources of truth causing an unintended side effect?
- If a contract is violated, is the contract wrong, or did unintended logic reach the contract?
Rules
- Do not make the contract more permissive unless you can prove the observed payload is intended in the final design.
- Prefer fixing the upstream logic bug over accepting bad downstream data.
- Separate symptom, trigger, root cause, minimal safe fix, and architectural follow-up.
- If a low-level fix is still needed, explain why the upstream fix is not sufficient or why both are required.
- Identify the correct layer to fix first.
- Name the first visible wrong behavior, not only the final error.
Hidden Write Checks
Treat non-explicit writes as suspicious by default.
- Audit lifecycle hooks, callbacks, subscribers, watchers, interceptors, middleware, retries, background jobs, cache refreshers, persistence restore, scheduled tasks, and startup code.
- Check whether derived data is being mirrored into another store, cache, file, queue, session, or database through an observer or helper layer.
- Prefer explicit command handlers, request handlers, job runners, or user actions as writers; treat startup-time and background writes as suspects until proven intentional.
- If a framework has automatic reactivity or lifecycle execution, map this rule onto its equivalent constructs without assuming the framework behavior is correct.
Output Format
Use this structure:
- Expected behavior
- Invariant
- What definitely did not happen
- Bug class
- Causal chain from intended action to system effect
- First unintended side effect
- Canonical source of truth
- Competing sources of truth
- Symptom
- Trigger
- Root cause
- Correct layer to fix first
- Minimal safe fix
- Architectural follow-up
- Proposed patch
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
shadcn-vite-iconify-landing-page
Build, critique, and iterate high-converting marketing or product landing pages using React + Vite + TypeScript + Tailwind and shadcn/ui components, with all icons sourced from Iconify. Use when the user asks for a landing page, sales page, signup page, CRO improvements, above-the-fold vs below-the-fold structure, hero + CTA copy, section order, or wants production-ready shadcn + Vite code.
security-leak-guardrails
Sets up secret-leak prevention guardrails with forbidden path checks, gitleaks config, CI secret scanning, and dependency updates. Use when hardening repos against credential leaks or when adding gitleaks, trufflehog, git hooks, or security checks.
homebrew-publish
Publish CLIs/TUIs to Homebrew via a personal tap. Use when asked to create or manage a Homebrew tap repo, generate or update formulae, compute sha256, test installs, or ship new releases for Go, Rust, Node/TypeScript, Python, or prebuilt binaries.
architecture-ownership
Determine runtime owner, first-fix layer, and canonical long-term module or package owner in layered codebases. Use when placing code across UI vs platform shell vs runtime orchestration vs domain or application vs shared core vs adapter or integration layers, debugging ownership issues, removing duplicate policy paths, or answering "where should this live?" architecture questions.
codex-analysis
Run Codex CLI for deep code analysis and second-opinion reviews. Use when the user explicitly asks for Codex analysis, Codex help, or wants a second opinion from Codex on code, architecture, or debugging questions.
go-local-health
Run local Go health checks (tests, coverage, lint) in Go repositories that contain go.mod/go.sum. Use when the user asks to run or interpret local Go test/coverage/lint workflows using tools like lazygotest, gocovsh, tparse, and golangci-lint. Do not use for Rust or non-Go projects.
Didn't find tool you were looking for?