Qwen Code is an open-source AI coding agent that runs in a terminal and helps developers work with code through language models. It supports multiple model providers and can also be used through IDEs, desktop software, SDKs, and messaging bots.
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 agentmods add skills/qwenlm/qwen-code/deflakenpx skills add QwenLM/qwen-code --skill deflakegit clone --depth 1 https://github.com/QwenLM/qwen-codeWrote 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/qwenlm/qwen-code/deflake)<a href="https://agentmods.dev/skills/qwenlm/qwen-code/deflake"><img src="https://agentmods.dev/badge/skills/qwenlm/qwen-code/deflake.svg" alt="Measured on agentmods" 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.00026 | $0.00843 |
| Opus 5 | $0.00013 | $0.00421 |
| Sonnet 5 | $0.00005 | $0.00169 |
| Haiku 4.5 | $0.00003 | $0.00084 |
Grade A, and why
deflake 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 7d 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 — 64 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Deflake a flaky test
A deflake: issue names ONE test that has been observed failing and then
passing on a rerun of the same commit — the definitive flaky signature. Your
job is to make that test deterministic without changing what it verifies.
The issue body carries the test identity (file + name) and the observed failure
signature (e.g. Test timed out in 5000ms, Timed out waiting for …, an
order-dependent assertion, a wall-clock/random-dependent value). Read the test,
reproduce the mechanism in your head, and apply the SMALLEST fix from the
allowed set below that removes the nondeterminism.
The only allowed fixes
- Raise a timeout / poll budget. A test that blows vitest's default under
CI contention (fully-mocked or I/O-bound, not a perf test) gets a generous
per-test
testTimeout(3rd arg toit), or its internal poll loop is given a real wall-clock budget instead of a fixed iteration count (a fixed count ofsetImmediateturns elapses in milliseconds and races real I/O). - Stabilize timing / waiting. Replace a bare
setTimeout/fixedsleepwith an explicitawaitof the real condition (vi.waitFor, a resolved promise, an event). Pre-warm a lazy load (e.g. a WASM runtime) inbeforeAllso per-test time doesn't include first-load cost. - Make randomness / time deterministic. Seed the RNG,
vi.useFakeTimers()/ mockDate.now, or pin the input so a value that depends on the real clock orMath.randomcan't drift. - Isolate / serialize interference. Give tests that collide on a shared resource (a same-named tempdir, a fixed port, a global singleton) unique per-test resources, or serialize them.
Hard rules
- Never delete the test,
skip/todoit, loosen an assertion, widen an expected range, add a blankettry/catch, or add a retry wrapper around the assertion. Those hide the flake instead of fixing it — and could hide a real bug. If none of the four fixes applies, or the failure looks like a REAL intermittent product bug (not test nondeterminism), write<workdir>/failure.mdexplaining what you found and stop. A human deflakes it. - Keep the diff minimal and local to the named test (and its file's helpers). Do not refactor unrelated code.
- Preserve every assertion and every input exactly. A timeout bump changes only the ceiling; a determinism fix changes only the source of nondeterminism.
- Prefer a per-test or per-file change over a global config change unless the
same class demonstrably spans the whole package (then a
testTimeoutin that package'svitest.config.tsis acceptable, as it only raises the ceiling and weakens no assertion).
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.
- 7d ago First seen · 64 lines · 26 tokens per session scan A f2aba9cc5a37
deflake is a skill published in the GitHub repository QwenLM/qwen-code (27,673 stars, last pushed today), licensed Apache-2.0. It adds 26 tokens to every session and 843 once invoked, about $0.0001 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.
Other skills, from other repositories
tdd-test-engineer
Use for test-first development, regression tests, flaky test debugging, coverage gaps, test strategy, CI failures, or converting bugs into minimal reproducible tests.
codew-release-qa-sweep
Use before claiming Codewhale release work is done: run the full gate sweep and list the manual QA targets.
verify
Exercise the real app/API/CLI and collect observable evidence; tests alone do not count as end-to-end verification.
webapp-testing
Start/reuse a local app, wait for readiness, inspect rendered state/console/network, act from observed selectors, and verify with evidence.
cw-gates
Use before claiming any Codewhale change is done, green, or ready to land: the focused-to-broad verification ladder, the budget checks CI enforces, and the rules for what counts as a passing test.
safe-extraction
Apply when extracting code from a large monolith file into submodules. Covers barrel re-exports, internals DI seam proxy patterns, CI invariant allowlist updates, and cross-file test verification. Prevents CI failures, broken imports, and test regressions from code extraction.