/kenji:debug-errorfrom kenji skills
Diagnoses one bug at a time using hypotheses and runtime evidence before fixing. Routes to specialized skills for FE↔BE mismatches, Sentry backlog, or full fix-and-ship workflows.
Ships in kenji skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Degree of freedom: MIXED. Root-cause judgment [HIGH freedom]; the red
feedback loop and verify-green re-run [LOW freedom — run exactly].
Systematic approach to debugging errors and unexpected behavior. Works with any project.
| Skill | Owns |
|---|---|
| debug-error (this) | Diagnose one bug with hypotheses and runtime evidence before fixing |
debug-fe-be-integration | Frontend-backend contract failures traced on both sides: 4xx/5xx, mismatched payloads |
workflow-fix-and-ship | One bug-fix lifecycle: triage, reproduce, debug, regression test, fix, PR |
debug-sentry-monitor | Operate Sentry: triage unresolved issues, cut noise, monitor after deploy |
Observe:
TypeError: Cannot read property 'email' of undefinedon/accountafter signup. Interpret: crash is in the profile card; API returnsnullfor incomplete onboarding. Classify: data bug — producer returns null, consumer assumes an object. Fix: handle the onboarding-null at the producer contract + UI empty state; do not?.the crash site only.
?. / swallowed catch as the sole fixdebug-fe-be-integration; Sentry backlog → debug-sentry-monitorBefore debugging:
README.md (project overview)
src/[domain]/@_[domain]-README.md (domain-specific behavior)
docs/ (system documentation)
If the error is from production and Sentry is configured, fetch the full context:
sentry:search_issues
{
"organizationSlug": "<ORG_SLUG>",
"query": "<error message or description>",
"projectSlugOrId": "<PROJECT_SLUG>",
"regionUrl": "<REGION_URL>",
"limit": 5
}
Then get details for the matching issue:
sentry:get_sentry_resource
{
"organizationSlug": "<ORG_SLUG>",
"resourceType": "issue",
"resourceId": "<ISSUE_ID>"
}
Extract: stacktrace, breadcrumbs, tags (browser, OS, URL, release), event frequency.
If data is involved, verify expectations against reality using Supabase MCP or direct queries.
Before diving into debug, state:
"Pre-debug check:
- README/docs read: [list]
- Sentry context: [YES with details / NO — not production / not configured]
- Database state verified: [YES/NO — findings]
- Backend API checked: [YES/NO — status]
- Error scope identified: [FE only / BE only / Integration / Data]"
1. Reproduce → 2. Isolate → 3. Research → 4. Identify → 5. Fix → 6. Verify → 7. Prevent
This is the skill — everything after is mechanical. Before reading code to build a theory, construct one command that goes red on this bug and will go green when it's fixed (adapted from mattpocock/skills, MIT). In rough order of preference: a failing test at the nearest seam → a curl/HTTP script against the dev server → a CLI invocation with a fixture input → a headless browser script → replaying a captured trace/payload through the code path in isolation.
The loop is done when it is:
If you catch yourself forming a hypothesis before this command exists, stop — that is the exact failure this phase prevents. If you genuinely cannot build a loop, say so explicitly, list what you tried, and ask for a captured artifact (HAR, log dump, recording) instead of proceeding blind.
Error Report:
- What happened: [description]
- Expected behavior: [what should happen]
- Steps to reproduce:
1. [step]
2. [step]
- Environment: [browser/OS/Node version]
- Error message: [exact message]
- Stack trace: [if available]
- First seen: [when — correlate with deploys]
git log for recent changes)Works in: Fails in:
├─ Production? ├─ Production?
├─ Staging? ├─ Staging?
├─ Local? ├─ Local?
├─ All browsers? ├─ Specific browser?
├─ All users? ├─ Specific user?
└─ All data? └─ Specific data?
For data-related bugs, trace the full pipeline:
User Action → Frontend Handler → API Call → Backend Controller → Database → Response → State Update → Render
Identify where the data goes wrong by checking each boundary.
Once the feedback loop is red, shrink the repro to the smallest scenario that still goes red: cut inputs, callers, config, and data one at a time, re-running the loop after each cut. Done when every remaining element is load-bearing — removing any one makes the loop go green. A minimal repro shrinks the hypothesis space and becomes the regression test in Phase 6.
For non-trivial errors, research the correct fix before implementing. Recognizing the framework or the error is not knowing its current behavior — search the exact error string and read the current docs even when you think you know the fix:
firecrawl:firecrawl_search
{
"query": "<framework> <exact error message> fix best practice",
"limit": 5,
"sources": [{ "type": "web" }]
}
Then scrape the most relevant result:
firecrawl:firecrawl_scrape
{
"url": "<best-result-url>",
"formats": ["markdown"],
"onlyMainContent": true
}
Also check official docs via Context7 if the error relates to a library:
context7:resolve-library-id
{
"libraryName": "<library>",
"query": "<error description>"
}
Trust hierarchy: Official docs > maintainer posts > engineering blogs > Stack Overflow (current year, high votes).
Before writing any fix, state:
Do NOT apply these as the sole fix:
?. to suppress a TypeError → fix why the value is null?? [] fallback → handle loading/error states explicitlyif guards at the consumer → fix the producer# Run tests
npm test
# Or framework-specific
pytest
cargo test
go test ./...
If the bug could recur in a different form, add monitoring:
If the bug was caused by a non-obvious interaction, add a comment explaining the constraint:
// Profile can be null for users who haven't completed onboarding.
// The API returns null (not 404) in this case. See: ISSUE-123.
## Bug Investigation: [Title]
**Pre-Debug:**
- [ ] Docs/README read
- [ ] Sentry context fetched (if applicable)
- [ ] Database state checked (if data-related)
- [ ] Error scope identified
**Investigation:**
- [ ] Can reproduce locally (or have Sentry reproduction)
- [ ] Isolated to specific component/function/layer
- [ ] Research completed (Firecrawl/Context7)
- [ ] Root cause identified and stated
**Fix:**
- [ ] Fix addresses root cause (not symptoms)
- [ ] No anti-patterns used as sole fix
- [ ] Side effects checked (other callers)
- [ ] Tests pass
**Prevention:**
- [ ] Monitoring added (if applicable)
- [ ] Documentation updated (if non-obvious)
What SKILL.md sets; muted values are Claude Code's defaults
highnpx claudepluginhub kensaurus/skills --plugin kenji162 skills in this plugin
/audit-accessibilityWCAG 2.2 AA audit via playwright-cli: axe-core, keyboard, contrast, target size, focus, ARIA. Use when "audit accessibility", "check a11y", "WCAG audit", "check keyboard nav", or "test screen reader".
/audit-agent-speedMeasure and fix a slow coding-agent setup: status line, hooks, instruction bloat, effort, worktree pile-up, antivirus and indexer scans. Use when "Claude is slow" or "CPU is pinned". App speed → audit-performance.
/audit-analyticsRead-only audit of product-analytics events (PostHog, Amplitude, Mixpanel, GA4): taxonomy, funnels, consent-gated firing, dead or duplicate events. Use when "audit our analytics", "are we tracking the right events", or "funnel instrumentation".
/audit-auth-flowsRead-only audit of app-layer auth: route×gate matrix, session lifecycle, OAuth, provider traps (getSession vs getUser, middleware-only gates, CVE-2025-29927). Use when "audit our auth" or "check middleware protection". RLS → plan-rls-audit.
/audit-backend-architectureRead-only backend-architecture audit and pattern advisor, gated by stack. Use when "audit backend architecture", "which pattern should I use", "am I over-engineering", or "sync vs event-driven". Enforced boundaries → enhance-arch-boundaries.
/audit-bundle-sizeAnalyse and shrink a web app's JavaScript bundle. Use when "reduce bundle size", "code splitting", "slow initial load", or "why is the bundle so big". Runtime → audit-performance.
Other plugins' skills for the same job