Condition-Based-Waiting

Replace arbitrary setTimeout calls with polling for events, state changes, or file existence.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/slapglif/swe-agent --skill condition-based-waiting-slapglif
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Condition-Based-Waiting
Source: https://github.com/slapglif/swe-agent/tree/main/.swe/skills/condition-based-waiting
Command: npx skills add https://github.com/slapglif/swe-agent --skill condition-based-waiting-slapglif

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eradicates flaky tests caused by arbitrary setTimeout or sleep calls, which lead to race conditions and inconsistent pass/fail rates. It replaces guesswork with reliable polling for actual state changes.

Core Features & Use Cases

  • Reliable Async Testing: Provides a generic waitFor function and specific helpers to poll for events, state changes, or file existence.
  • Race Condition Prevention: Ensures tests wait for the exact condition they depend on, not a guessed duration.
  • Performance Improvement: Reduces unnecessary delays by polling efficiently (e.g., every 10ms) instead of long, fixed timeouts.
  • Use Case: If your integration tests randomly fail because an async operation hasn't completed, use this skill to replace await new Promise(r => setTimeout(r, 300)) with await waitForEvent(manager, 'TOOL_STARTED').

Quick Start

My tests are flaky due to timing issues. Use the Condition-Based-Waiting skill to make them reliable.