dag-thinking

Solve problems by modeling them as a directed acyclic graph (DAG). Use when tasks have dependencies, prerequisites, ordering constraints, pipelines, workflows, causal graphs, or when you need to detect cycles, find a topological order, identify critical paths, or simplify dependency structure.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "dag-thinking" with this command: npx skills add bhagyas/dag-thinking-skill/bhagyas-dag-thinking-skill-dag-thinking

DAG Thinking (Directed Acyclic Graph)

Use a directed acyclic graph (DAG) as the core representation for any problem that involves dependencies. Reference: https://grokipedia.com/page/Directed_acyclic_graph

0) Decide if DAG framing fits

Use this when you can phrase the problem as:

  • “X must happen before Y”
  • “Y depends on X”
  • “If X changes, downstream things affected are …”

If there are feedback loops that matter, you may have cycles; handle them explicitly (see Cycle handling).

1) Build the graph

1A) Define nodes

Pick a consistent unit:

  • tasks, steps, tickets, files, components, decisions, assumptions, people, etc.

1B) Define edges

Use one direction consistently:

  • X → Y means “X is a prerequisite of Y” (Y depends on X)

1C) Capture metadata

For each node, store:

  • owner, status, estimate/cost, risk, notes

2) Validate the DAG

2A) Detect cycles (must do)

If cycles exist, you don’t have a DAG yet.

Cycle handling (pick one):

  • Break the cycle by clarifying dependency direction (often one edge is “nice-to-have”, not required)
  • Collapse a strongly-connected set into a single “super-node” (treat as one unit)
  • Time-slice: convert feedback into iterative stages (v1 → v2)

3) Compute order (topological sorting)

Produce a valid execution order:

  • pick any node with no remaining prerequisites (in-degree 0)
  • execute/remove it
  • repeat

If multiple nodes are available, choose by:

  • shortest-first (unblock quickly)
  • highest impact
  • critical path urgency (see below)

4) Reduce graph complexity (optional but powerful)

4A) Transitive reduction mindset

If A→B and B→C exist, then A→C is often redundant. Prefer the minimal edge set that preserves reachability.

Practical heuristic:

  • keep the edge only if removing it would change what’s reachable

4B) Cluster by layers

Group nodes by “distance from sources” to create phases:

  • Phase 0: sources
  • Phase 1: depends only on Phase 0

5) Find the critical path (for planning)

If nodes have durations/estimates:

  • compute the longest path from sources to sinks
  • that path dictates the minimum completion time

Output:

  • critical path nodes
  • slack nodes (can be delayed without affecting finish)

6) Answer typical questions with DAG outputs

  • What do we do next? → topological frontier (available nodes)
  • What blocks this task? → ancestors of node
  • What breaks if we change X? → descendants of node
  • How do we simplify? → transitive reduction / merge nodes
  • Where are we stuck? → cycle detection, no available nodes

7) Output format (default)

When you apply this skill, produce:

  1. Nodes (with 1-line descriptions)
  2. Edges (X → Y)
  3. Cycle check result
  4. Proposed order (phases or linear list)
  5. (Optional) Critical path + slack
  6. Next actions

Quick prompts to ask the user (only if needed)

  • “What counts as ‘done’ for each node?”
  • “Is X truly required for Y, or just preferred?”
  • “Do any dependencies create a loop?”
  • “Do you care about fastest completion, lowest risk, or minimal context switching?”

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

dag-ooda-problem-solving

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

CP2K Cross-Code Input Studio

Generate, refine, explain, and cross-convert CP2K-centered input drafts for computational chemistry and materials workflows. Use when a user wants a CP2K .in...

Registry SourceRecently Updated
Coding

PDF to markdown converter

Convert PDF and image documents to clean Markdown via the PDF2Markdown CLI. Use when the user wants to extract text from PDFs, convert PDFs to markdown, pars...

Registry SourceRecently Updated