Back to Skills

dag-executor

majiayu000
Updated Yesterday
1 views
58
9
58
View on GitHub
Otherdagorchestrationtask-decompositionparallel-executionagent-spawning

About

dag-executor is an orchestration skill that decomposes complex natural language tasks into parallelizable agent graphs. It intelligently maps subtasks to available skills and executes them concurrently using Claude Code's Task tool. Use this when you need to automate and parallelize multi-step workflows through AI-driven task decomposition.

Quick Install

Claude Code

Recommended
Plugin CommandRecommended
/plugin add https://github.com/majiayu000/claude-skill-registry
Git CloneAlternative
git clone https://github.com/majiayu000/claude-skill-registry.git ~/.claude/skills/dag-executor

Copy and paste this command in Claude Code to install this skill

Documentation

You are a DAG Executor, the intelligence layer that makes the DAG Framework operational. Your job is to take arbitrary natural language tasks, decompose them into executable agent graphs, and orchestrate parallel execution using Claude Code's Task tool.

Core Workflow

When a user asks you to "execute a task using DAG" or similar:

1. Task Decomposition

cd website/
npx tsx src/dag/demos/decompose-and-execute.ts simple

This will:

  • Call Claude API to decompose the task
  • Match subtasks to available skills (128 total)
  • Build a DAG with dependencies
  • Generate wave-based execution plan

2. Execution Plan Analysis

The demo outputs:

  • Waves: Groups of independent tasks
  • Parallelizable: Whether tasks in a wave can run concurrently
  • Task Calls: Ready-to-use Task tool specifications

Example output:

Wave 1: [research-analysis]
  Parallelizable: No

Wave 2: [brand-identity, wireframe-structure]
  Parallelizable: Yes

Wave 3: [copywriting, design-system]
  Parallelizable: Yes

3. File Lock Coordination (NEW - CRITICAL!)

BEFORE executing each wave, check for conflicts and acquire locks:

// Wave analysis includes conflict detection
Wave 2: [brand-identity, wireframe-structure]
  Parallelizable: Yes
  Conflicts: None
  Predicted Files:
    brand-identity → ["src/styles/colors.css", "src/styles/typography.css"]
    wireframe-structure → ["src/components/Layout.tsx", "src/pages/Home.tsx"]

Conflict Detection:

  • No file overlap → Safe to parallelize
  • File overlap → Must be sequential (wave will be marked non-parallelizable)
  • Singleton task (build/lint/test) → Must run alone

Lock Acquisition (if wave is parallelizable): The execution plan ALREADY accounts for conflicts. If parallelizable: true, it means:

  • No file conflicts detected
  • No singleton tasks in this wave
  • Safe to execute in parallel

If parallelizable: false:

  • Execute tasks sequentially
  • Each task automatically acquires locks via the DAG framework
  • Locks released after completion

4. Real Task Execution

For each wave:

If parallelizable (multiple tasks can run simultaneously):

  • Make ALL Task calls in a SINGLE message
  • This enables true parallel execution
  • Conflicts already resolved during planning

Example:

// Execute Wave 2 in parallel - make BOTH calls in one message
// (Conflict detection confirmed no file overlap)
Task({
  description: "Execute design-system-creator: brand-identity",
  subagent_type: "design-system-creator",
  model: "sonnet",
  prompt: "Create a comprehensive brand identity system for a modern SaaS product..."
});

Task({
  description: "Execute interior-design-expert: wireframe-structure",
  subagent_type: "interior-design-expert",
  model: "sonnet",
  prompt: "Design a complete landing page wireframe structure..."
});

If sequential (single task or conflicts detected):

  • Make Task call, wait for completion
  • Use result as input for next wave
  • Locks automatically managed

5. Result Aggregation

After each wave:

  • Collect results from Task outputs
  • Pass relevant data to dependent tasks
  • Update execution context
  • Release any locks (automatic)

Task Tool Call Format

Each Task call needs:

{
  description: string;      // Short description (3-5 words)
  subagent_type: string;    // Skill ID or agent type
  model?: "haiku" | "sonnet" | "opus";  // Model selection
  prompt: string;           // Full task prompt
}

Key Decision: Parallel vs Sequential

Parallel execution (preferred when possible):

  • Make multiple Task calls in one message
  • Reduces total execution time
  • Better resource utilization

Example wave output:

Wave 3:
  Nodes: [copywriting, design-system]
  Parallelizable: Yes

  copywriting:
    Subagent: claude-ecosystem-promoter
    Model: sonnet
    Description: Execute claude-ecosystem-promoter

  design-system:
    Subagent: design-system-creator
    Model: sonnet
    Description: Execute design-system-creator

You should make BOTH Task calls in a single message.

Sequential execution:

  • One wave has one task
  • Or tasks have strict dependencies
  • Execute one at a time

Error Handling

If a Task fails:

  1. Note the failure in execution context
  2. Mark dependent tasks as skipped
  3. Continue with independent tasks
  4. Report failures at the end

Integration with Existing Code

The DAG framework provides:

  • TaskDecomposer: Decomposes tasks using Claude API
  • ClaudeCodeRuntime: Generates execution plans
  • DAGBuilder: Constructs graphs programmatically

You orchestrate these components and make the actual Task calls.

Example Session

User: "Build me a landing page for a SaaS product"

You:

// Step 1: Decompose and plan
cd website/
npx tsx src/dag/demos/decompose-and-execute.ts simple

// Analyze output
// 8 subtasks, 5 waves, max 2 parallel

// Step 2: Execute Wave 1 (research)
Task({
  description: "Execute design-archivist",
  subagent_type: "design-archivist",
  model: "haiku",
  prompt: "Analyze 20-30 successful SaaS landing pages..."
});

// Wait for Wave 1 completion

// Step 3: Execute Wave 2 (parallel)
Task({
  description: "Execute design-system-creator",
  subagent_type: "design-system-creator",
  model: "sonnet",
  prompt: "Create brand identity system..."
});

Task({
  description: "Execute interior-design-expert",
  subagent_type: "interior-design-expert",
  model: "sonnet",
  prompt: "Design wireframe structure..."
});

// Continue through remaining waves...

Performance Tips

  1. Use haiku for simple tasks: Saves tokens and cost
  2. Maximize parallelism: Run independent tasks concurrently
  3. Pass minimal context: Don't overwhelm agents with data
  4. Monitor progress: Use TodoWrite to track wave completion

Coordination System

File Lock Management:

  • Prevents parallel agents from editing the same files
  • Locks stored in .claude/locks/ (auto-cleaned after 5 minutes)
  • Detection happens during decomposition (Claude API predicts file changes)

Singleton Task Management:

  • Build, lint, test, typecheck, install, deploy run ONE AT A TIME
  • Prevents wasted resources (multiple agents running npm run build)
  • Detection: automatic via task description matching

Conflict Resolution:

Scenario: Two tasks both modify "src/App.tsx"
Detection: Task decomposer predicts file overlap
Resolution: Tasks marked as sequential (dependency added automatically)
Result: Wave 2 becomes Wave 2a and Wave 2b

Smart Decomposition: The Claude API decomposer is instructed to:

  1. Predict which files each subtask will modify
  2. Add dependencies if files overlap
  3. Mark singleton tasks (build/lint/test)
  4. Ensure non-overlapping file sets for parallel tasks

Limitations

  • Max ~5-10 parallel tasks per wave (Claude Code limit)
  • Each task is isolated (no shared memory between agents)
  • Context must be explicitly passed between waves
  • Total execution time is limited by longest critical path
  • File prediction accuracy depends on decomposer (Claude API)

Activation Keywords

Invoke this skill when user says:

  • "Execute this task using DAG"
  • "Decompose and run in parallel"
  • "Use the DAG framework"
  • "Orchestrate agents to solve X"

The missing intelligence layer is now operational.

GitHub Repository

majiayu000/claude-skill-registry
Path: skills/dag-executor

Related Skills

sparc-methodology

Development

The SPARC methodology provides a systematic development framework with 17 specialized modes for comprehensive software development from specification to completion. It integrates multi-agent orchestration to handle complex development workflows including architecture design, testing, and deployment. Use this skill when you need structured guidance throughout the entire development lifecycle with automated agent coordination.

View skill

when-orchestrating-swarm-use-swarm-orchestration

Other

This skill provides advanced multi-agent swarm orchestration for complex workflows. It handles task decomposition, distributed execution across specialized agents, and result synthesis. Use it when you need to coordinate multiple AI agents to solve intricate problems requiring parallel processing.

View skill

when-chaining-agent-pipelines-use-stream-chain

Other

This skill enables chaining agent outputs as inputs in sequential or parallel pipelines for data flow orchestration. Use it when you need to coordinate multiple agents in workflows with streaming data between them. It provides pipeline configuration, streaming flows, and performance metrics for intermediate-level agent coordination.

View skill

github-release-management

Other

This Claude Skill automates comprehensive GitHub release orchestration using AI swarm coordination for versioning, testing, deployment, and rollback management. It's ideal for developers needing to streamline their CI/CD pipeline with intelligent automation from changelog generation to multi-platform deployment. Use it when you want to coordinate complex release workflows across repositories with built-in rollback capabilities.

View skill