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.
npx skills add tmj-90/gaffer --skill fix-flaky-testgit clone --depth 1 https://github.com/tmj-90/gafferWrote 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.
[](https://agentmods.dev/skills/tmj-90/gaffer/fix-flaky-test)<a href="https://agentmods.dev/skills/tmj-90/gaffer/fix-flaky-test"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/fix-flaky-test/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/tmj-90/gaffer/fix-flaky-test"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/fix-flaky-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00077 | $0.01256 |
| Opus 5.5 | $0.00031 | $0.00502 |
| Sonnet 5.5 | $0.00015 | $0.00251 |
| Haiku 4.5 | $0.00008 | $0.00126 |
Grade A, and why
fix-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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Fix a flaky test
A flaky test passes and fails on the same code. Google measured ~1.5% of all test runs flaky and ~16% of tests flaky at least occasionally; the cost is that people stop believing red builds. The job is to find the source of non-determinism and remove it. First decide whether the flake is in the test or in the product: a test that fails one run in fifty under parallel writes may be the only thing reporting a real race — the same class of lost-update and lock defect that shipped past review in live runs. "Fixing" that by serialising the test hides a production bug.
Procedure
- Reproduce and measure. Run the single test in a loop until it fails, and record the
failure rate:
- Vitest/Jest:
for i in {1..50}; do npx --no -- vitest run <file> -t "<name>" || break; done(Jest:--runInBandvs default to compare parallelism); Playwright:npx --no -- playwright test <spec> --repeat-each=50 --retries=0. - pytest:
pytest <path>::<test> --count=50(pytest-repeat) or a shell loop; random order via pytest-randomly and-n autovia xdist — only if the repo already has them; never install plugins. - Go:
go test -run '^TestName$' -count=200 -race ./pkg/...; JUnit: repeat via the runner or a@RepeatedTest. Also try the conditions CI has: full suite (not just the file), random order, parallel workers,CI=1, a differentTZ/locale, a loaded machine (stress/taskset). Keep the failing output — you cannot fix what you have not observed.
- Vitest/Jest:
- Classify the cause from the failure (Fowler's "Eradicating Non-Determinism in
Tests" and Google's flaky-test analyses list the same families):
- Async timing: unawaited promise, fixed
sleep, assertion before the event, a timeout too tight for CI. - Order / shared state: leaked globals, singletons, DB rows, files, env vars, module caches, a port reused between tests. Passes alone, fails in the suite (or vice versa).
- Concurrency in the product: unsynchronised read-modify-write, temp-file name collisions, check-then-act on files or rows, lock or lease expiry. Fails more under parallelism or load.
- Time and environment: real clock, midnight/DST/month-end, timezone, locale, float formatting, hash/map iteration order.
- Randomness: unseeded generators, random data hitting a rare edge.
- External: real network, third-party service, container start-up races, resource leaks (open handles, file descriptors) that accumulate.
- Async timing: unawaited promise, fixed
- Fix the root cause where it lives.
- Test timing → await properly; wait for a condition (poll with a deadline, web-first assertions), never a longer sleep.
- Order/state → fresh state per test, teardown that runs on failure, unique temp dirs
and ports (the
test-fixtures-and-factoriesskill). - Time/randomness → inject or fake the clock, pin
TZ, seed the RNG and log the seed. - External → stub at the boundary, or make the dependency hermetic (a container started and awaited by the test).
- Product race → fix the code (the
concurrency-and-asyncskill), and keep or add a deterministic test that reproduces the interleaving (a barrier, controlled scheduler such as fast-checkscheduler, or N parallel real processes). If the ticket does not scope a product fix, record the finding and raiserequest_decisionrather than quietly stabilising the test.
- Prove it. Re-run the same loop that reproduced it — at least 10× the runs it took to
fail, with the same parallelism and order randomisation — with zero failures. Then run
the full suite with the repo's command (the
run-testsskill). - Evidence and stop. Use the
record-evidenceskill: the reproduction command and failure rate before, the root cause in one sentence, the fix, and the clean streak after (test_output). The runner submits for review, not you.
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.
- 1mo ago Changed 8912ca23c48d
- 2mo ago Changed · +44 lines · +8 tokens per session d75afa2e712e
- 3mo ago First seen · 38 lines · 69 tokens per session scan A 232d854c28a4
fix-flaky-test is a skill published in the GitHub repository tmj-90/gaffer (1 stars, last pushed 4d ago), licensed Apache-2.0. It adds 77 tokens to every session and 1,256 once invoked, about $0.0003 per session on Opus 5.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-31.
fix-flaky-test compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| fix-flaky-testtmj-90/gaffer | Skill | 1 | 4d ago | Apache-2.0 | A | 77 | Claude Code, Codex |
| bulwark-brainstormQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 50 | Claude Code |
| plan-creationQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 38 | Claude Code |
| anthropic-validatorQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 40 | Claude Code |
| create-subagentQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 42 | Claude Code |
| test-auditQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 0 | Claude Code |
| code-reviewQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 61 | Claude Code |