condition-based-waiting

Replace fixed delays with deterministic polling for events, state, or counts.

1|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/tuantiensiu/todo-app --skill condition-based-waiting-tuantiensiu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/tuantiensiu/todo-app/tree/main/.opencode/skill/condition-based-waiting
Command: npx skills add https://github.com/tuantiensiu/todo-app --skill condition-based-waiting-tuantiensiu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Flaky tests often race or rely on arbitrary delays, causing instability across environments and CI runs.

Core Features & Use Cases

  • Wait for actual state changes instead of guesses.
  • Replace timeouts with deterministic polling for events, state, or counts.
  • Reduce maintenance by documenting WHY timeouts are used and when to remove them.

Quick Start

Run the test suite with the condition-based waiting approach to replace arbitrary waits with explicit polling.

Frequently Asked Questions about condition-based-waiting

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

FAQPage Schema
How do I eliminate flaky tests caused by race conditions and arbitrary delays?

Condition polling replaces fixed delays by continuously checking for actual state changes in asynchronous operations. It ensures deterministic test outcomes by verifying specific events, state transitions, or counts have successfully occurred before proceeding.

What is the best way to handle asynchronous testing and wait for state changes?

The best way to handle asynchronous testing is implementing waitFor patterns for events, state, or counts. This replaces guessing with deterministic polling to identify and wait for actual state changes, ensuring stable and reliable outcomes across different environments.

Can I use condition polling for test automation without adding external dependencies?

Yes, you can use condition polling without adding external dependencies. It requires no external inputs beyond your existing polling utilities, making it straightforward to integrate into your current test automation suite to handle flaky timings.

Why does condition-based waiting provide more deterministic outcomes than fixed timeouts?

Condition-based waiting provides deterministic outcomes by identifying and waiting for the actual state change instead of relying on fixed timeouts. This removes arbitrary guesses, directly addressing race conditions and asynchronous operations that cause flaky tests.

When do I need to use condition polling in my test suite?

You need condition polling when your tests experience race conditions, asynchronous operations, or flaky timings across environments and CI runs. It enables deterministic outcomes by explicitly waiting for state changes rather than relying on arbitrary delays.

Does condition-based waiting work with existing polling utilities for test automation?

Yes, condition-based waiting works directly with existing polling utilities. It requires no external inputs beyond those utilities and supports waitFor patterns to monitor events, state, or counts, allowing you to quickly replace arbitrary waits.