AGENT SKILL

flaky-patterns

Reference catalogue of flaky-test causes — for each class, how it shows up in a stack trace, the real fix, the masking fixes to reject, and how to reproduce it deterministically without running the test many times. Use when diagnosing or reviewing a fix for a test that passes and fails on the same code.

License 许可
MIT
最近更新
2026-10-27
Stars
★ 0
Forks
0

01 前言 Front Matter

name
flaky-patterns
description
Reference catalogue of flaky-test causes — for each class, how it shows up in a stack trace, the real fix, the masking fixes to reject, and how to reproduce it deterministically without running the test many times. Use when diagnosing or reviewing a fix for a test that passes and fails on the same code.
user-invocable
false

03 SKILL.md 正文

Flaky test patterns

A flaky test passes and fails on the same code. The fix removes the nondeterminism; a masking change only lowers how often it shows. Masking changes: retry/rerun, skip/disable, sleep, bigger timeout, swallowed error, weaker or fewer assertions.

Classes

Class Trace / symptom Real fix Masking to reject Deterministic repro
async-wait assertion on a value that is "not yet" there; timeout waiting for element/message; NPE on a result read too early wait on the actual condition (await the promise/future, poll for the state with a bound, event/latch) sleep before the assertion; bigger timeout delay the producer (inject a slow stub / hook) so the read always comes first
race-condition intermittent wrong value, duplicate key, ConcurrentModificationException, lost update synchronise the shared resource, make the operation atomic, or remove the sharing retry; serialising the whole test suite barrier/latch that forces the two threads/tasks into the bad interleaving
order-dependency passes alone, fails after a specific other test (often a newly added one) the test sets up everything it needs; the other test cleans up after itself fixed test order; @Order run the polluting test's setup (or state) before this test inside one test
shared-state static/singleton/global, shared DB rows, files, env vars, ports, caches leak between tests per-test fixtures, unique names/ids, reset in teardown, dependency injection instead of globals clearing state with a sleep; retry pre-populate the shared state the way another test leaves it
time-dependency fails around midnight, month end, DST, in other time zones; comparisons with now() inject a clock; fixed time in the test; compare with tolerance only where the domain allows it widening tolerance until it passes freeze the clock at the boundary (23:59:59, DST switch, Feb 29)
randomness data-dependent failures, unordered collections asserted in order, hash order fixed seed in the test; order-independent assertions; sort before comparing rerun the seed / input that fails, pinned
external-dependency network errors, 5xx/429, DNS, real third-party service, real clock server stub/fake the dependency at the boundary; contract test separately retry; bigger timeout stub that returns the failing response
resource-leak "too many open files", port in use, connection pool exhausted, fails late in a suite close/dispose in finally/teardown; bounded pools; random free ports bigger pool; bigger timeout open the leaked resource N times before the test
environment only on some agents/OS/locale; after a CI image or dependency bump pin the version or make the code independent of the difference (locale, path separator, CPU count) skip on that environment set the differing locale/env/version in the test
unknown none of the above fits the evidence say what evidence is missing (another trace, logs at a given point) — —

Reading a trace

  • The top project frame is where it failed, not necessarily where it went wrong. Async failures point at the assertion; the cause is the producer.
  • TimeoutException/timed out is a symptom of async-wait, external-dependency or resource-leak — decide by what was awaited.
  • Several traces with different top frames but the same awaited resource are one cause; different resources are several.

When a masking change is acceptable

Only when the class has no deterministic fix inside the repo (a real external system that cannot be stubbed in this test layer) — and then it is bounded, labelled in the code, and the ticket says the cause stays. A bounded wait on a real condition is not a sleep: it ends as soon as the condition holds.

Culprit commits

A commit is a culprit when its diff creates the mechanism: makes something async, adds shared/static state, adds a test that leaves state behind, changes time handling, swaps a stub for a real call, bumps a dependency or CI image. Touching the same file is not enough.

04 同仓库更多 Skills

marynabieliaieva
marynabieliaieva/dev-ai-harness-marketplace

workflow-retro

Retrospective of a finished multi-agent workflow run (e.g. /sdd-engineering:run-plan, a code review, spec → plan → execution) — collects run facts (agents spawned, spawn order and waves, tokens per agent and per type, fix rounds, caps hit, human interventions), extracts insights per agent type (what was hard, what was easy, what information was duplicated, what each gate missed and who caught it later) and turns them into concrete, evidence-backed proposals for agent/skill/plan changes. Writes a ledger entry to docs/retro/ledger/ and a summary in chat. Data source is the current conversation by default; --deep also parses the session transcripts on disk. Invoked only by the user as /sdd-engineering:workflow-retro — never automatically, never by another skill or agent.

★ 0
marynabieliaieva
marynabieliaieva/dev-ai-harness-marketplace

run-plan

Runs the Spec Driven Development execution workflow for an already-written Implementation Plan (docs/plans/<slug>.md) — implementer tasks wave by wave along the plan's DAG, one plan-verifier pass with a fix loop, an architecture-review loop (review → fix → re-review until clean or the round cap), then one full test run. Accepts the plan, optionally the spec, extra requirements text and design files. Does NOT run spec-creator or implementation-planner (those are run manually first). Invoked only by the user as /sdd-engineering:run-plan.

★ 0
marynabieliaieva
marynabieliaieva/dev-ai-harness-marketplace

engineering-insights

Captures a non-obvious engineering insight (a working pattern, an antipattern/dead end, a decision with its reason, or a recurring error and fix) found while working in this repo, and files it into the INSIGHTS.md of the package the session touched. Use at the end of a session that learned something substantial, or immediately when something surprising comes up — skip when nothing non-obvious happened.

★ 0
marynabieliaieva
marynabieliaieva/dev-ai-harness-marketplace

flaky-fix

Triage and fix one flaky test without extra pipeline or test runs — from the test name, a stack trace, the date it became flaky and its failure rate to a Jira issue, a fix branch, a reviewed commit and a PR, with verification left to the normal runs of main after merge. Invoked only by the user as /flaky-fix:flaky-fix.

★ 0
marynabieliaieva
marynabieliaieva/dev-ai-harness-marketplace

zod

Zod schema validation best practices for type safety, parsing, and error handling. This skill should be used when defining z.object schemas, using z.string validations, safeParse, or z.infer. This skill does NOT cover form-library integration (e.g. React Hook Form resolvers) or OpenAPI client generation.

★ 0
marynabieliaieva
marynabieliaieva/dev-ai-harness-marketplace

typescript-expert

TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.

★ 0