skills/dag-dependency-resolver/SKILL.md
Validates DAG structures, performs topological sorting, detects cycles, and resolves dependency conflicts. Uses Kahn's algorithm for optimal execution ordering. Activate on 'resolve dependencies', 'topological sort', 'cycle detection', 'dependency order', 'validate dag'. NOT for building DAGs (use dag-graph-builder) or scheduling execution (use dag-task-scheduler).
npx skillsauth add curiositech/windags-skills dag-dependency-resolverInstall 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 Dependency Resolver, ensuring graphs are executable by detecting cycles, computing optimal execution orders, and resolving dependency conflicts.
Graph Size < 100 nodes AND Dense connections (>50% edge density)?
├── YES → Use Kahn's algorithm (better for dense graphs)
└── NO → Graph Size > 1000 nodes?
├── YES → Use DFS with early termination (memory efficient)
└── NO → Use Kahn's algorithm (clearer wave structure)
Cycle Breaking Strategy (when cycles detected):
├── Single cycle with 2-3 nodes? → Suggest node merge
├── Multiple interconnected cycles? → Find minimum feedback arc set
├── Cycle involves external dependencies? → Add intermediate buffer node
└── Self-referential cycle? → Remove self-dependency (always safe)
Parallelization Opportunity Assessment:
├── Wave has >5 independent nodes? → Flag high parallelization potential
├── Critical path > 3x average path? → Recommend breaking bottleneck nodes
├── Resource conflicts detected? → Add ordering constraints
└── No conflicts? → Mark wave as fully parallelizable
Fan-Out Explosion
if node.dependents.length > 20 && maxWaveSize/avgWaveSize > 5Deep Chain Dependency
if criticalPath.length > shortestPath.length * 5Phantom Dependency
if dependency not in dag.nodes && not flagged as missingResource Thrashing
if nodes in wave share exclusive resource without orderingCycle Masking
if cycle exists in any possible execution branchInput: 10-node DAG with cycle and resource conflicts
nodes:
load-data: { deps: [], resources: [database] }
validate-data: { deps: [load-data], resources: [] }
clean-data: { deps: [validate-data], resources: [memory-pool] }
analyze-A: { deps: [clean-data], resources: [gpu] }
analyze-B: { deps: [clean-data], resources: [gpu] } # CONFLICT!
transform-A: { deps: [analyze-A, summarize], resources: [] } # CYCLE!
transform-B: { deps: [analyze-B], resources: [memory-pool] } # CONFLICT with clean-data!
summarize: { deps: [transform-A], resources: [] } # CYCLE!
report: { deps: [transform-A, transform-B], resources: [disk] }
cleanup: { deps: [report], resources: [database] } # CONFLICT with load-data!
Resolution Process:
Cycle Detection: DFS finds analyze-A → transform-A → summarize → transform-A
transform-A → summarize, add analyze-A → summarizeResource Conflict Analysis:
analyze-A vs analyze-B in wave 2clean-data vs transform-B spans wavesload-data vs cleanup in different waves (OK)Dependency Reordering:
analyze-A before analyze-B (serialize GPU)transform-B to wave after clean-data completesFinal Resolution:
executionWaves:
- wave: 0
nodes: [load-data]
parallelizable: false
- wave: 1
nodes: [validate-data]
parallelizable: false
- wave: 2
nodes: [clean-data]
parallelizable: false
- wave: 3
nodes: [analyze-A] # GPU exclusive
parallelizable: false
- wave: 4
nodes: [analyze-B, summarize] # GPU freed, memory freed
parallelizable: true
- wave: 5
nodes: [transform-A, transform-B] # Both can run
parallelizable: true
- wave: 6
nodes: [report]
parallelizable: false
- wave: 7
nodes: [cleanup]
parallelizable: false
criticalPath: [load-data, validate-data, clean-data, analyze-A, transform-A, report, cleanup]
parallelizationFactor: 1.4x # Limited by resource conflicts
Expert vs Novice: Novice would miss resource conflicts and only fix the cycle, leading to runtime failures. Expert analyzes resource constraints alongside dependency structure.
dag-graph-builder - this only validates existing graphsdag-task-scheduler - this only provides execution orderdag-dynamic-replanner - this doesn't handle dynamic changesdag-performance-optimizer - this focuses on correctnessdag-data-validator - this only checks structural dependenciesdata-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.