skills/dag-cycle-analysis/SKILL.md
Graph algorithms for detecting and resolving cycles in directed graphs and workflow definitions
npx skillsauth add curiositech/windags-skills dag-cycle-analysisInstall 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.
Skill ID: hierarchical-cycle-analysis
Domain: Complex systems, network science, information architecture
This skill applies rigorous cycle-theoretic methods to understand the hidden organizational structure of hierarchical systems. It reveals how systems that appear "acyclic" (DAGs) actually contain rich cyclic structure that determines their information-processing capabilities.
IF analyzing system behavior/comparison
├── THEN decompose DAG = undirected graph + directional metadata
├── IF need functional differences between similar topologies
│ └── THEN use metadata metrics (height, stretch, balance) + topology
└── IF need structural simplification
└── THEN apply transitive reduction first
IF detecting cycles in DAG
├── IF raw cycle count needed
│ └── THEN use DFS on undirected substrate
├── IF functional classification needed
│ ├── THEN apply path-wedge contraction first
│ └── THEN classify: feedback/shortcut/diamond/mixer
└── IF comparing cycle organization
└── THEN compute antichain structure + metadata positioning
IF system shows unexpected behavior despite "good" topology
├── THEN check antichain structure (parallel vs sequential)
├── THEN measure cycle height/stretch/balance distribution
└── IF still unclear, THEN load metadata-localizes-topology framework
IF redesigning hierarchical process
├── IF need resilience THEN preserve/add diamonds (parallel alternatives)
├── IF need integration THEN check mixer positioning (multi-level convergence)
└── IF optimizing efficiency THEN identify shortcuts for potential removal
Symptom: Two hierarchies have identical node/edge counts but behave differently
Diagnosis: Analyzing structure without considering ordering metadata
Detection Rule: If degree distributions match but information flow differs
Fix: Decompose into undirected graph + metadata, compute metadata-derived metrics
Symptom: Claiming "no cycles exist" in hierarchical system
Diagnosis: Confusing directional constraint-compatibility with topological absence
Detection Rule: If someone says "it's a DAG so no loops"
Fix: Extract undirected substrate to reveal hidden cyclic structure
Symptom: Counting all cycles as equivalent structural features
Diagnosis: Missing functional differences between diamonds vs mixers
Detection Rule: If analysis treats 3-node triangle same as 6-node mixer
Fix: Apply path-wedge contraction, classify into four classes
Symptom: System performance degrades after applying transitive reduction
Diagnosis: Removing shortcuts that were functionally valuable despite being informationally redundant
Detection Rule: If TR improves "structural metrics" but worsens latency/reliability
Fix: Distinguish informational redundancy from functional optimization
Symptom: Cannot explain why parallel nodes behave differently
Diagnosis: Missing hierarchical coordinate system, treating all "same level" nodes as equivalent
Detection Rule: If surprised by different behaviors at "same hierarchical level"
Fix: Compute antichain decomposition, analyze cycle organization by level
Scenario: Two companies with identical reporting structures (30 nodes, 35 edges) but different decision-making speeds.
Step 1 - Decomposition:
Company A: Extract undirected substrate → 12 cycles found
Company B: Extract undirected substrate → 12 cycles found
Topology identical, so analyze metadata.
Step 2 - Classification:
Apply transitive reduction:
Company A: 8 diamonds, 2 mixers remain
Company B: 4 diamonds, 4 mixers remain
Step 3 - Metadata Analysis:
Company A diamonds: Height 2-4 (mid-hierarchy resilience)
Company A mixers: Height 6-7 (senior integration points)
Company B diamonds: Height 1-2 (low-level redundancy)
Company B mixers: Height 3-8 (integration at all levels)
Expert Insight: Company B's distributed mixers create more integration overhead but higher adaptability. Company A's concentrated senior mixers create bottlenecks but faster routine decisions.
Novice Miss: Would only count total cycles (12 each) and conclude structures identical.
Scenario: Microservice dependency graphs with similar complexity metrics but different deployment reliability.
Step 1 - Cycle Detection:
System X: 45 cycles in undirected substrate
System Y: 47 cycles in undirected substrate
Step 2 - TR + Classification:
System X after TR: 15 diamonds, 8 mixers
- Diamonds concentrated in data layer (height 1-3)
- Mixers in API gateway layer (height 5-6)
System Y after TR: 8 diamonds, 12 mixers
- Diamonds scattered across all layers
- Mixers concentrated in business logic (height 3-4)
Step 3 - Antichain Analysis:
System X: 6 major antichains, services well-layered
System Y: 3 major antichains, more cross-cutting concerns
Expert Diagnosis: System X has resilient data access (diamonds) but single points of integration failure. System Y has complex business logic integration creating brittleness.
Decision: System X better for read-heavy workloads, System Y better for complex transactional workflows.
Analysis Complete When:
Ready for Implementation When:
Do NOT use this skill for:
temporal-graph-analysis insteadcommunity-detection insteadnetwork-flow-algorithms insteadmarkov-chain-analysis insteadDelegate when:
distributed-graph-algorithms for scalabilitystreaming-dag-validation for online systemstemporal-motif-analysis for time-varying hierarchiesFramework applies only when:
tools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.