bhagyas/dag-thinking-skill
Overview
This skill uses directed acyclic graphs (DAGs) to model problems with dependencies, ordering constraints, or causal structure. It helps detect cycles, compute valid execution orders, identify critical paths, and simplify complex dependency networks. Apply it when work items, decisions, or components have clear prerequisite relationships.
How this skill works
I represent each unit of work or concept as a node and each prerequisite relationship as a directed edge (X → Y means X is required before Y). The skill validates the structure by detecting cycles, then computes topological order(s), identifies available next actions (frontier), and can compute critical paths when nodes include duration estimates. Optional reductions (transitive reduction, clustering) simplify the graph for clearer phases.
When to use it
- Planning pipelines, release plans, or multi-step projects with prerequisites
- Scheduling tasks where ordering and blocking relationships matter
- Analyzing impact when a change to X affects downstream items
- Detecting and resolving feedback loops or circular dependencies
- Optimizing lead time by identifying the critical path and slack
Best practices
- Choose a consistent node unit (task, decision, file, owner) and stick to it
- Define edges as prerequisites only; prefer one direction convention (X → Y means X must finish first)
- Always run cycle detection early; break or collapse cycles before scheduling
- Capture minimal metadata per node (owner, status, estimate) to enable planning calculations
- Use transitive reduction to remove redundant edges and cluster nodes into phases
Example use cases
- Convert a project backlog into a DAG to produce a phase-by-phase execution plan
- Map a data pipeline’s tasks to find the next runnable jobs and detect blocking stages
- Analyze product dependencies to see which features block a release and which can be parallelized
- Resolve a circular dependency by collapsing strongly connected components or time-slicing iterations
- Compute the critical path for a launch using node duration estimates to prioritize work
FAQ
Either clarify and remove nonessential edges, collapse the strongly connected nodes into a single super-node, or model the loop as iterative time-slices (v1 → v2) to restore acyclicity.
How do I pick nodes versus edges granularity?
Pick the smallest meaningful unit you need to reason about consistently: tasks for execution order, decisions for governance, or components for impact analysis. Avoid mixing units in the same graph.
How do I choose among multiple available nodes to run next?
Prioritize by criteria: shortest-first to unblock quickly, highest impact, lowest risk, or nodes on the critical path to minimize completion time.