تخطَّ إلى المحتوى
Skillsify
العودة إلى السجلّ
الاختباراتv1.1.0963 تثبيت

flaky-test-hunter

Finds and diagnoses flaky tests in a test suite. Use when tests pass locally but fail in CI, when a suite fails intermittently, or when the user asks to stabilise or de-flake their tests.

المخطّطالفحص الساكنTrigger

التثبيت

npx skillsify add flaky-test-hunter

تُعالَج الاختبارات المتذبذبة عادةً بإخفائها — تأخير هنا وإعادة محاولة هناك — فنستبدل خطّ أنابيب أحمر بآخر بطيء لم يعد يقول الحقيقة. وهذه المهارة تمنع ذلك: تُلزم الوكيل بقياس معدّل الإخفاق أوّلًا، وتصنيف التذبذب وفق تصنيف محدّد، وإجباره على التكرار الحتميّ، ثمّ إصلاح السبب الجذريّ أخيرًا، وتُختم بإعادة قياس معدّل الإخفاق كدليل.

تقرير الجودة

يجب أن تُستدعى

  • This test fails maybe one run in five, can you look?
  • CI is red again but it passes on my machine
  • Help me de-flake the e2e suite
  • Our pipeline keeps needing reruns to go green

يجب ألّا تُستدعى

  • Write a new unit test for this function
  • Deploy the app to production

الملفّات

SKILL.md
---
name: flaky-test-hunter
description: Finds and diagnoses flaky tests in a test suite. Use when tests pass locally but fail in CI, when a suite fails intermittently, or when the user asks to stabilise or de-flake their tests.
---

# Flaky test hunter

## When to use this
Tests pass locally but fail in CI, a suite fails intermittently, or the user
asks to stabilise their tests.

## Procedure
1. Establish the failure rate before changing anything. Run the suspect test in
   a loop and record how many runs in how many fail.
2. Classify the flake against [references/flake-taxonomy.md](references/flake-taxonomy.md).
3. Prove the cause by making the flake deterministic — force the ordering, freeze
   the clock, or pin the seed so the test fails every time.
4. Fix the cause, not the symptom.
5. Re-run the loop and show the new failure rate.

## Rules
- **Never** fix a flake by adding a sleep, a retry, or increasing a timeout.
  Those hide the defect and slow the suite permanently.
- A fix is not proven until the loop that used to fail passes repeatedly.
- If the flake is in the code under test rather than the test, say so plainly.
references/flake-taxonomy.md
# Flake taxonomy

| Class | Signature | Typical fix |
| --- | --- | --- |
| Order dependence | Fails only when run after another test | Reset shared state in a hook |
| Real time | Fails near midnight, month end, or on slow CI | Inject and freeze the clock |
| Async leak | Assertion runs before the effect settles | Await the actual condition, not a timeout |
| Shared fixture | Parallel workers mutate one record | Namespace fixtures per worker |
| Network | Depends on a live third party | Record and replay, or stub at the boundary |
| Randomness | Unseeded random input | Pin the seed and log it on failure |

مهارات ذات صلة

الأداءمُوثَّقة

core-web-vitals-audit

Audits a web application for Core Web Vitals regressions. Use when the user asks to check LCP, INP or CLS, investigate a Lighthouse score drop, or review front-end performance before a release.

1,284 تثبيت · v1.2.0

الأمانمُوثَّقة

dependency-risk-review

Reviews third-party dependencies for supply-chain and licence risk. Use when the user asks to audit dependencies, evaluate whether to add a package, review a lockfile diff, or check licence compatibility.

741 تثبيت · v1.0.3

إعادة الهيكلةمُوثَّقة

rtl-layout-audit

Audits a web interface for right-to-left layout correctness in Arabic, Hebrew, Persian or Urdu. Use when adding an RTL locale, when the user reports mirrored or broken Arabic layout, or before shipping a bilingual interface.

688 تثبيت · v1.1.1