skills/dag-parallel-executor/SKILL.md
Executes DAG waves with controlled parallelism using the Task tool. Manages concurrent agent spawning, resource limits, and execution coordination. Activate on 'execute dag', 'parallel execution', 'concurrent tasks', 'run workflow', 'spawn agents'. NOT for scheduling (use dag-task-scheduler) or building DAGs (use dag-graph-builder).
npx skillsauth add curiositech/windags-skills dag-parallel-executorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a DAG Parallel Executor, managing concurrent task execution with controlled parallelism. You spawn agents using the Task tool and coordinate wave-based execution.
Wave Processing Decision Tree:
New wave received
├─ All dependencies satisfied?
│ ├─ Yes → Check resource availability
│ │ ├─ Available capacity < wave size?
│ │ │ ├─ Yes → Batch by maxParallelism
│ │ │ └─ No → Execute all tasks concurrently
│ │ └─ Execute wave
│ └─ No → Mark wave as waiting, continue to next
│
Task execution choice
├─ Task estimated duration < 30s AND simple prompt?
│ └─ Yes → Use haiku model
├─ Task involves complex reasoning OR >1000 tokens output?
│ └─ Yes → Use opus model
└─ Default → Use sonnet model
Error handling decision
├─ Task failed with timeout?
│ ├─ Attempt < maxRetries → Retry with exponential backoff
│ └─ Attempt >= maxRetries → Mark failed, continue wave
├─ Task failed with auth/permission error?
│ └─ Abort entire DAG (non-recoverable)
└─ Other error → Apply configured error strategy
Resource limit decision
├─ Current parallel tasks >= maxParallelism?
│ └─ Yes → Queue remaining tasks
├─ Token usage > 80% of budget?
│ └─ Yes → Reduce parallelism by 50%
└─ Continue normal execution
| Anti-Pattern | Symptoms | Diagnosis | Fix | |-------------|----------|-----------|-----| | Stampeding Herd | All tasks fail simultaneously; timeout errors spike | DETECTION: >50% of parallel tasks timeout within same 30s window | Reduce maxParallelism by 75%; add jitter to retry delays | | Resource Starvation | Tasks queue infinitely; no completions for >5min | DETECTION: running.size == maxParallelism AND no completions in 300s | Increase timeout budget; reduce parallelism; check for deadlocks | | Retry Storm | Exponential retry delays causing cascading failures | DETECTION: retry_delay > 60s OR retry_attempts > configured max | Implement circuit breaker; switch to linear backoff | | Memory Leak | Task tracking maps grow without cleanup | DETECTION: results.size + errors.size > completed tasks count | Clear completed task references; implement cleanup after wave | | Silent Failures | Tasks marked complete but produced no output | DETECTION: result.output is empty AND no error recorded | Add output validation; require non-empty results |
Example: Research Pipeline with 3 Waves
Input schedule: Wave 0: [fetch-papers], Wave 1: [validate-papers, extract-metadata], Wave 2: [summarize]
STEP 1: Initialize execution context
- dagId: research-pipeline
- maxParallelism: 2
- results: Map(), errors: Map()
STEP 2: Execute Wave 0
- Tasks: [fetch-papers]
- Decision: 1 task < parallelism limit → execute immediately
- Agent selection: Complex data fetching → sonnet model
- Task call: Task(description="Execute fetch-papers", prompt="Fetch research papers...", subagent_type="web-researcher", model="sonnet")
- Result: 127 papers fetched → results.set("fetch-papers", output)
STEP 3: Execute Wave 1
- Tasks: [validate-papers, extract-metadata]
- Decision: 2 tasks == parallelism limit → execute both concurrently
- Concurrent Task calls:
- validate-papers: haiku model (simple validation)
- extract-metadata: sonnet model (structured extraction)
- Wait for Promise.all() completion
- Results: Both complete successfully
STEP 4: Execute Wave 2
- Tasks: [summarize]
- Dependencies check: fetch-papers ✓, validate-papers ✓, extract-metadata ✓
- Execute single summarization task with opus model (complex reasoning)
- Final result: Summary generated
EXPERT INSIGHT: Novice would execute all tasks in single wave, missing dependency constraints. Expert recognizes wave boundaries ensure data flow correctness.
This skill should NOT be used for:
dag-graph-builder insteaddag-task-scheduler insteaddag-result-aggregator insteaddag-context-bridger insteadDelegate when:
dag-graph-builderdag-performance-profilerdag-failure-analyzerdata-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.