flaky-test

flaky-test is a command for Claude Code from Filip-Podstavec/claude-leverage. It costs 39 tokens per session (1,036 once invoked), scanned A, original, MIT.

A command that diagnoses an unreliable test by running it repeatedly and grouping the failures by their observed patterns. A flaky test sometimes passes and sometimes fails without a relevant code change.

In plain words
What is it for?
Use it to run a test multiple times, review grouped failure signatures, and obtain a stability report for a suspected flaky test.
Why use it?
It provides evidence about how stable the test is and whether failures share a pattern. The command diagnoses the problem but does not fix the test.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents.

Part of the claude-leverage plugin — 16 skills, 5 commands, 14 agents, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/filip-podstavec/claude-leverage/flaky-test
Clone the repo
git clone --depth 1 https://github.com/Filip-Podstavec/claude-leverage

Made for: Claude Code.

Or install claude-leverage, the plugin that ships this one along with the rest of its 16 skills, 5 commands, 14 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for flaky-test

README.md
[![agentmods](https://agentmods.dev/badge/commands/filip-podstavec/claude-leverage/flaky-test.svg)](https://agentmods.dev/commands/filip-podstavec/claude-leverage/flaky-test)
Your own site
<a href="https://agentmods.dev/commands/filip-podstavec/claude-leverage/flaky-test"><img src="https://agentmods.dev/badge/commands/filip-podstavec/claude-leverage/flaky-test.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,036 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.01036
Opus 5 $0.00019 $0.00518
Sonnet 5 $0.00008 $0.00207
Haiku 4.5 $0.00004 $0.00104

Measured 6d ago against content hash 3132c3631353, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

flaky-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/flaky-test.md · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Project framework hints (computed before delegation)

CWD: !pwd Has package.json: !test -f package.json && echo "yes" || echo "no" Has pyproject.toml: !test -f pyproject.toml && echo "yes" || echo "no" Has pytest.ini: !test -f pytest.ini && echo "yes" || echo "no" Has setup.cfg: !test -f setup.cfg && echo "yes" || echo "no" Has go.mod: !test -f go.mod && echo "yes" || echo "no" Has Cargo.toml: !test -f Cargo.toml && echo "yes" || echo "no" Has Gemfile: !test -f Gemfile && echo "yes" || echo "no"

Your role

You are routing a flaky-test diagnosis. Your job is pre-flight validation and delegation. You do NOT run the tests yourself. The flaky-test-isolator subagent (Sonnet) owns execution.

Defaults and caps

Arg Default Hard cap Why
--runs 10 50 10 runs is usually enough signal; 50 prevents runaway cost on slow suites
--timeout 60s per run 300s per run 5 min per single test is generous; total budget is enforced by the subagent (30 min wall-clock)

Pre-flight workflow

  1. Parse $ARGUMENTS:

    • First positional argument: the test target (file path, test name, or framework-specific pattern).
    • --runs N: optional, integer.
    • --timeout SECONDS: optional, integer.
  2. Validate the target. If $ARGUMENTS is empty or the first positional looks like a flag, STOP and ask the user for the test target. Do NOT delegate without a target — the subagent would have to guess and waste a delegation.

  3. Apply caps silently.

    • If --runs > 50, set to 50 and tell the user: "Capped --runs to 50."
    • If --timeout > 300, set to 300 and tell the user: "Capped --timeout to 300 seconds per run."
    • If --runs < 1 or --timeout < 1, reject and ask the user for a valid value.
  4. Warn on missing framework hint. If all of the Has * lines above are "no", warn the user: "No common test manifest detected in this directory. The subagent will ask if it can't infer the framework." Then still delegate.

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 65 lines · 39 tokens per session scan A 3132c3631353

Subscribe to this mod's changes

flaky-test is a command published in the GitHub repository Filip-Podstavec/claude-leverage (68 stars, last pushed 1mo ago), licensed MIT. It adds 39 tokens to every session and 1,036 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.