builder-smoke-test
Smoke test the Agent Builder feature branch end-to-end against a hermetic project scaffolded by the skill (linked to the current…
Use early when debugging a medium or hard bug, especially when tests alone may not reveal the real runtime failure. Trigger this before extended TDD iteration when a bug involves runtime state, ordering, persistence, streaming, concurrency, UI/manual reproduction, external
Claude Code
$ npx -y skills add mastra-ai/mastra --skill debugging-difficult-bugs --agent claude-code
Codex
$ npx skills add mastra-ai/mastra --skill debugging-difficult-bugs -a codex -y
Cursor
$ npx skills add mastra-ai/mastra --skill debugging-difficult-bugs -a cursor -y
Gemini CLI
$ npx skills add mastra-ai/mastra --skill debugging-difficult-bugs -a gemini-cli -y
GitHub Copilot
$ npx skills add mastra-ai/mastra --skill debugging-difficult-bugs -a github-copilot -y
OpenCode
$ npx skills add mastra-ai/mastra --skill debugging-difficult-bugs -a opencode -y
Windsurf
$ npx skills add mastra-ai/mastra --skill debugging-difficult-bugs -a windsurf -y
name: debugging-difficult-bugs description: Use early when debugging a medium or hard bug, especially when tests alone may not reveal the real runtime failure. Trigger this before extended TDD iteration when a bug involves runtime state, ordering, persistence, streaming, concurrency, UI/manual reproduction, external services, or when a red or newly passing test may not model the real issue. Skip only when the root cause is already directly proven by a stack trace or deterministic test that exercises the real runtime path.
Use this skill early for medium or hard bugs where normal TDD may give false confidence because the test does not fully capture the real bug.
Core idea: **instrument the actual runtime path, reproduce the real issue, then inspect append-only JSONL logs before deciding on a fix.**
Use this workflow near the start of debugging when any of these are true:
Do **not** keep iterating only on tests if you do not understand the runtime behavior.
Skip this workflow only when the root cause is already directly proven by a stack trace or by a deterministic failing test that exercises the real runtime path. If you are tempted to make a second speculative fix, use this workflow.
1. **State the uncertainty**
2. **Add temporary unconditional instrumentation**
3. **Reproduce the real issue**
4. **Analyze the log before fixing**
5. **Clean up instrumentation**
6. **Keep or improve tests**
Use append-only JSONL in `cwd` so it works across CLIs, dev servers, tests, and manual reproduction.
import { appendFileSync } from 'node:fs';
import { join } from 'node:path';
function debugBug(event: string, data: Record<string, unknown> = {}) {
appendFileSync(
join(process.cwd(), 'debug-difficult-bug.jsonl'),
`${JSON.stringify({
ts: new Date().toISOString(),
event,
...data,
})}\n`,
);
}Call it at every meaningful branch or state transition:
debugBug('workflow.start', { runId, stepId, inputKeys: Object.keys(input ?? {}) });
debugBug('workflow.beforeStep', {
runId,
stepId,
status: step.status,
hasResumeData: Boolean(resumeData),
});
try {
const result = await executeStep();
debugBug('workflow.afterStep', { runId, stepId, resultShape: Object.keys(result ?? {}) });
return result;
} catch (error) {
debugBug('workflow.stepError', {
runId,
stepId,
errorName: error instanceof Error ? error.name : typeof error,
errorMessage: error instanceof Error ? error.message : String(error),
});
throw error;
}Prefer compact, structured data over huge dumps.
Log:
Avoid logging:
Treat debug logs as potentially sensitive. Do not ask the user to paste them into public issues, PRs, or shared channels unless they have reviewed/redacted them first.
If sensitive data might appear, log redacted summaries:
debugBug('request.received', {
hasAuthHeader: BooleanMastra is a framework for building AI-powered applications and agents with a modern TypeScript stack. It includes everything you need to go from early prototypes to production-ready applications.
Smoke test the Agent Builder feature branch end-to-end against a hermetic project scaffolded by the skill (linked to the current…
Autonomous, report-only documentation review for Mastra docs. Use when auditing changed docs against source, validating…
Convert existing docs diagram images to Mermaid, and author new Mermaid diagrams for Mastra docs. Use when replacing an…
REQUIRED when modifying any file in packages/playground-ui or packages/playground. Triggers on: React component…
Review open mastra-ai/mastra GitHub issues, identify direct @mastra/core bugs, and apply the @mastra/core label. Use when…
Reproduce and measure a Mastra Code runtime bug against a real model by driving the built TUI headlessly in tmux while every…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.