本文へ移動
cccskills
無料GitHub で公開

deflake

Stabilize a flaky test with a minimal, assertion-preserving fix — never by weakening or deleting the check.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md3.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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

  1. 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 to it), or its internal poll loop is given a real wall-clock budget instead of a fixed iteration count (a fixed count of setImmediate turns elapses in milliseconds and races real I/O).
  2. Stabilize timing / waiting. Replace a bare setTimeout/fixed sleep with an explicit await of the real condition (vi.waitFor, a resolved promise, an event). Pre-warm a lazy load (e.g. a WASM runtime) in beforeAll so per-test time doesn't include first-load cost.
  3. Make randomness / time deterministic. Seed the RNG, vi.useFakeTimers() / mock Date.now, or pin the input so a value that depends on the real clock or Math.random can't drift.
  4. 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/todo it, loosen an assertion, widen an expected range, add a blanket try/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.md explaining 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 testTimeout in that package's vitest.config.ts is acceptable, as it only raises the ceiling and weakens no assertion).

Verify

Run the named test's file several times (npx vitest run <file> in the right package, repeated) — it must pass every time. Then run the standard verify gate (build / typecheck / lint / the changed test). If you cannot make it pass deterministically, write <workdir>/failure.md and stop.

Then follow .qwen/skills/prepare-pr/SKILL.md for the PR body and write the bilingual <workdir>/e2e-report.md (per the Shared Rules) stating: the flaky mechanism, which of the four fixes you applied and why, and the repeated-run evidence that it is now deterministic.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Reference for briefing a subagent or a fork — what to put in the prompt, what not to delegate, and a worked example. Load before writing a delegation prompt; the Agent tool's own description carries the launch rules and the background-agent rules.

日本語の概要は準備中です。原文の説明を表示しています。

QwenLM/qwen-code2.8万2026年10月12日 更新

Use after a Codex or Claude Code feature has been implemented in Qwen Code to run the selected reference agent and Qwen Code under the same scenario, capture HTTP and terminal traces, compare request bodies, tool/function schemas, outputs, and iterate until the reproduced behavior is close enough.

日本語の概要は準備中です。原文の説明を表示しています。

QwenLM/qwen-code2.8万2026年10月12日 更新

Use when reproducing an existing Codex or Claude Code feature in Qwen Code or another agent CLI by choosing a reference agent, capturing HTTP request bodies, prompts, tool/function schemas, terminal output, and then implementing the matching behavior in the target repo.

日本語の概要は準備中です。原文の説明を表示しています。

QwenLM/qwen-code2.8万2026年10月12日 更新

autofix

無料

Review and repair current local changes until they converge, or run Qwen Code Autofix issue and review workflows from GitHub Actions.

日本語の概要は準備中です。原文の説明を表示しています。

QwenLM/qwen-code2.8万2026年10月12日 更新

batch

無料

Execute batch operations on multiple files in parallel. Automatically discovers files, splits into chunks, and processes with parallel worker agents. Use `/batch` followed by operation and file pattern. For many independent single-turn transforms (translate/rewrite/extract each file into a new file) that can wait minutes to hours, you may suggest the user type `/batch-api` themselves for the half-price asynchronous Batch API — you cannot invoke it, and it is not suited to in-place edits or tasks needing tool feedback.

日本語の概要は準備中です。原文の説明を表示しています。

QwenLM/qwen-code2.8万2026年10月12日 更新

batch-api

無料

Prepare a many-file, single-turn transform (translate, rewrite, extract) as a plan and submit it to the asynchronous, half-price DashScope Batch API; results are delivered as new files hours later. Invoke explicitly with /batch-api.

日本語の概要は準備中です。原文の説明を表示しています。

QwenLM/qwen-code2.8万2026年10月12日 更新

QwenLM のスキルをすべて見る

このスキルの問題を報告する