skills/fast-and-practical-dag-decomposition-wit/SKILL.md
Apply practical DAG decomposition, transitive-edge reduction, and reachability indexing to dense dependency graphs. Use when low width and repeated queries justify preprocessing. NOT for cyclic graphs, one-off graph checks, or exact-minimum-chain requirements.
npx skillsauth add curiositech/windags-skills fast-and-practical-dag-decomposition-witInstall 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.
Use this skill when the real win comes from a fast, good-enough decomposition that unlocks downstream reachability, indexing, or repeated-query performance.
This skill is not the primary tool for:
Dense DAGs can still be structurally simple if width stays low. True difficulty lives in irreducible independence, not just in how many arrows appear on the page.
In many dense DAGs, most edges are implied by shorter paths. Treating all of them as equal work is a representation mistake.
If a heuristic decomposition enables indexing, caching, or repeated downstream queries, the overall system can beat a slower exact method even if the decomposition itself is slightly worse.
Preprocessing is only smart when later reachability checks are common enough to repay the up-front cost.
See the broader strategy set in diagrams/INDEX.md.
flowchart TD
A[DAG workload] --> B{Graph acyclic?}
B -->|No| C[Condense or reject]
B -->|Yes| D[Estimate width and transitive-edge share]
D --> E{Many future reachability queries?}
E -->|No| F[Use simpler direct traversal]
E -->|Yes| G{Need exact minimum chains?}
G -->|Yes| H[Use exact or tighter method despite cost]
G -->|No| I[Use greedy practical decomposition]
I --> J[Build indexing on reduced-edge structure]
H --> J
J --> K[Serve O(1)-style reachability checks]
Symptoms: the team spends more time finding the optimal decomposition than the query workload could ever justify.
Recovery: compare downstream value of a fast near-optimal solution against the full pipeline cost.
Symptoms: an expensive index is built and barely used.
Recovery: estimate actual query volume before paying the preprocessing bill.
Symptoms: a dense graph is assumed to be intrinsically hard without checking width or transitive redundancy.
Recovery: measure width and reduced-edge share before choosing the algorithm.
Symptoms: the decomposition logic produces nonsense or brittle chains because the input still contains feedback loops.
Recovery: condense SCCs first or choose a different method.
Symptoms: indexing cost stays tied to full edge count because transitive edges were never stripped conceptually.
Recovery: reason on the reduced edge set and preserve only the structure that actually changes reachability.
A permission graph is queried thousands of times per minute. After confirming the graph is acyclic and structurally low-width, the team accepts a near-optimal chain decomposition and builds an index over the reduced edge structure, trading one preprocessing pass for cheap runtime checks.
A monorepo tool needs to answer "what breaks if I change X?" repeatedly. Rather than recomputing traversal against the dense full DAG every time, the system uses practical chain decomposition to compress the graph and accelerate downstream reachability queries.
| File | Load when |
| --- | --- |
| references/width-as-coordination-complexity.md | You need the width-centric view of structural difficulty. |
| references/transitive-structure-as-compression-opportunity.md | The main question is whether the graph is mostly redundant edges. |
| references/greedy-decomposition-and-progressive-refinement.md | You are comparing heuristics against exact methods. |
| references/constant-time-reachability-through-indexing.md | The work is primarily about reachability-query acceleration. |
| references/hierarchical-abstraction-for-scaling.md | You need the architectural argument for decomposition as scaling strategy. |
| references/failure-modes-and-structural-blindness.md | You suspect the technique is being applied where its assumptions do not hold. |
data-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.