{"slug":"claude-code-workflow-reproduce-a-flaky-test","title":"Reproduce a flaky test with competing theories","summary":"Claude Code handles this as a draft: Use a dynamic workflow to reproduce a rare failure, form competing theories, and keep only the theory that survives evidence. Do not push a fix until I say so.","agent":"Claude Code","agentSlug":"claude-code","category":"Coding","categorySlug":"coding","roles":["Software engineer"],"roleSlugs":["software-engineer"],"industries":["Software"],"industrySlugs":["software"],"jobs":["shipping-code"],"topic":"Dev & Coding","topicSlug":"dev-and-coding","score":19,"difficulty":"hard","estCost":"A longer Claude Code session while the test is rerun. No extra paid service is named in this playbook.","costTier":"medium","timeSaved":"Repeated one-off reruns, if a reproduction recipe comes back. This is an estimate, not a measurement.","prompt":"This test fails maybe 1 in 50 runs. Use a workflow (or ultracode) to reproduce it. Form competing theories about the race or flake, and do not stop until one theory survives the evidence.\n\nWork in isolated worktrees where useful. Keep an audit of theories rejected and why.\n\nDo not push commits. Do not merge. Stop when you have a surviving theory and a reliable reproduction recipe I can re-run.","steps":[{"title":"Point Claude Code at the repo and the flaky test","detail":"Name the test you already see fail. Isolated worktrees are for the hunt, not for a push."},{"title":"Re-run the reproduction recipe yourself","detail":"Read the audit of rejected theories. Keep the draft only if one theory survives evidence you can repeat."},{"title":"Stop","detail":"You push and you merge. The agent stops at the surviving theory and the recipe."}],"sourceUrl":"https://claude.com/blog/a-harness-for-every-task-dynamic-workflows-in-claude-code","sourceNote":"Claude's dynamic-workflows post. The given URL returned HTTP 200 on 16 Oct 2026. Prompt and stop rules are an AI Playbook Gems adaptation, not a vendor quote; unverified.","date":"2026-10-16","verified":false,"status":"unverified","sponsorUrl":"","metrics":[{"label":"Hands-on time","value":"Re-running the reproduction recipe"},{"label":"You still approve","value":"Push and merge"}],"faq":[{"question":"Has this Claude Code playbook been re-run for the catalog?","answer":"No. Status is unverified. The given source URL was checked on 16 Oct 2026. The prompt is an adaptation, not a vendor quote."},{"question":"What stays human?","answer":"Pushing commits and merging. The agent owes a surviving theory and a recipe you can re-run, not a landed fix."}],"url":"https://aiplaybookgems.com/usecases/claude-code-workflow-reproduce-a-flaky-test","jsonUrl":"https://aiplaybookgems.com/api/usecases/claude-code-workflow-reproduce-a-flaky-test"}