condition-based-waiting

Replace arbitrary timeouts with condition-based polling in test suites.

2|Updated Sep 30, 2025
One-click install
npx skills add https://github.com/krzemienski/shannon-framework --skill condition-based-waiting-krzemienski
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/krzemienski/shannon-framework/tree/main/skills/condition-based-waiting
Command: npx skills add https://github.com/krzemienski/shannon-framework --skill condition-based-waiting-krzemienski

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Replaces arbitrary timeouts with condition polling to eliminate flaky tests and timeouts caused by race conditions.

Core Features & Use Cases

  • waitFor-based waiting patterns (state, events, counts)
  • Flakiness tracking and reliability improvements

Quick Start

Begin by replacing sleeps with condition-based waits: /shannon:condition-based-waiting

Frequently Asked Questions about condition-based-waiting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace timeouts with condition-based waiting to fix flaky tests?

Condition-based waiting eliminates flaky tests by polling for specific conditions instead of using arbitrary sleeps. Replace explicit timeouts with a waitFor mechanism that checks your desired state, event, or count until it occurs or a timeout threshold is reached, reducing race condition failures.

What's the difference between polling and fixed timeouts in test reliability?

Fixed timeouts cause flakiness because they assume work completes in a predetermined window, leading to failures on slower runs. Polling checks whether your condition is met repeatedly, adapting to actual execution speed and eliminating timing-dependent failures.

Can I use condition-based waiting for events, state changes, and file existence?

Yes. Condition-based waiting supports multiple scenarios: waiting for events to fire, state transitions to occur, event counts to reach a threshold, and file existence checks. Helper functions like waitForEvent, waitForEventCount, and waitForEventMatch cover these common patterns.

How does flakiness tracking integrate with condition-based waiting?

Flakiness tracking monitors test reliability metrics as you replace timeouts with polling. Integration with a Shannon-based flakiness framework lets you measure stability improvements and identify remaining race conditions in your test suite.

Do I need prior test framework setup to use condition-based waiting?

No prior framework dependency is required. The waitFor polling mechanism works with any test suite experiencing race conditions or asynchronous work. Start by replacing sleeps with condition-based waits in your existing tests.