condition-based-waiting

Replace arbitrary delays with condition-based polling in tests.

3|1|Updated Nov 5, 2025
One-click install
npx skills add https://github.com/carlopezzuto/agents --skill condition-based-waiting-carlopezzuto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: condition-based-waiting
Source: https://github.com/carlopezzuto/agents/tree/main/.claude/skills/condition-based-waiting
Command: npx skills add https://github.com/carlopezzuto/agents --skill condition-based-waiting-carlopezzuto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests caused by timing guesses.

Core Features & Use Cases

  • Polling-based waits: Provide deterministic wait for a condition.
  • Wait for state changes: Support waiting for readiness, completion, or specific data changes in async flows.
  • Use in CI and parallel runs: Improve stability in parallel execution and CI environments.

Quick Start

Instrument tests to poll for the desired condition and proceed once it evaluates to true.

Frequently Asked Questions about condition-based-waiting

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

FAQPage Schema
How do I stop flaky tests caused by arbitrary delays in asynchronous operations?

To stop flaky tests caused by arbitrary delays, replace fixed timeouts with condition-based waiting. This approach polls for actual state changes in asynchronous operations, proceeding only once the desired condition evaluates to true.

What is condition-based waiting and how does it improve test reliability?

Condition-based waiting improves test reliability by polling for specific state changes instead of relying on arbitrary delays. The deterministic waitFor pattern checks if a condition evaluates to true before proceeding, eliminating timing guesses.

How do I implement a deterministic wait for state changes in end-to-end tests?

Implement a deterministic wait for state changes in end-to-end tests by instrumenting your tests to poll for readiness, completion, or specific data changes. Proceed once the predicate match evaluates to true within a configurable timeout.

Can I use polling-based waits to stabilize parallel execution and CI environments?

Yes, you can use polling-based waits to stabilize parallel execution and CI environments. Condition-based waiting improves test stability by ensuring parallel runs proceed only after actual state changes occur, avoiding arbitrary timeout collisions.

Does condition-based waiting support configurable timeouts and polling intervals?

Yes, condition-based waiting supports configurable timeouts and polling intervals. The deterministic waitFor pattern allows you to specify the exact polling interval and maximum timeout duration for waiting on conditions, counts, or predicate matches.

When should I replace arbitrary timeouts with condition polling in integration tests?

You should replace arbitrary timeouts with condition polling in integration tests whenever dealing with event-driven flows or asynchronous operations. Use this approach to wait for actual readiness or completion, eliminating flaky tests caused by timing guesses.