IDAE Debug Engine
Detection Logic
Trigger this skill when the user reports an issue or executes testing/dependency commands:
- •Error Reports: ReferenceError, TypeError, "it's broken", "not working", stack traces.
- •Test Commands:
pnpm test,pnpm run test,npx vitest,pnpm vitest. - •Task Intent: "debug this", "fix the failing test", "why is the build failing".
- •Environment: Detected use of
pnpm-lock.yaml, Vitest configs, or TypeScript files.
Core Methodology
Follow the Trace-Isolate-Fix protocol with a focus on pnpm environments:
- •Trace Analysis: Pinpoint the exact file, line, and column from the stack trace.
- •Dependency Audit: Check for peer dependency conflicts or missing packages (using
pnpm list). - •Logic Isolation: Suggest targeted testing using Vitest filters (
-t) orvi.eachto pinpoint data-driven failures. - •Resolution Path: Provide code fixes and a validation command to ensure the fix works.
Instructions
- •pnpm Preference: Always suggest
pnpmcommands over npm/yarn. - •Strict Typing: Look for "as any" or missing type guards in TypeScript that might hide runtime bugs.
- •Async & Timers: Specifically check for unawaited promises in Vitest suites or leaked timers.
Example Output
User: "pnpm test" -> Output shows: 1 failed, Auth Service > should hash password
🔍 Debugging Session: should hash password failure
1. Trace Diagnostics
- • Locate Failure: Check if the error is a
Matcher error(assertion failed) or aRuntime error(function threw). - • Dependency Check: Run
pnpm list bcryptorargon2to ensure native bindings are correctly linked.
2. Isolation & Reproduction
- • Targeted Run: Execute
pnpm vitest -t 'should hash password'. - • Mock Verification: Ensure
vi.mockis called at the top level and not inside a conditional block. - • Console Inspection: Use
console.dir(result, { depth: null })to inspect complex objects.
3. Common Resolutions
- •Vitest Setup: Add
vi.clearAllMocks()inbeforeEachif state leaks between tests. - •Environment Vars: Ensure
.env.testis loaded viavitestconfig.
Edge Cases
- •Symlink Issues: Being a pnpm user, check if
node_modulessymlinks are causing resolution issues in monorepos. - •Zod Failures: If using Zod, parse the
ZodErrorto show exactly which field failed validation. - •CI/CD Flakiness: If it passes locally but fails in CI, check for architecture-specific dependencies (e.g., Linux vs macOS).