Claude-Flow provides sophisticated task coordination capabilities with support for complex dependencies, priority management, workflow orchestration, and advanced scheduling. This guide covers everything from basic task creation to complex multi-agent workflows.
Information gathering and analysis tasks for knowledge acquisition.
Basic Research Task:
# Simple research task
claude-flow task create research "Analyze competitor AI development tools" \
--priority high \
--estimated-duration 2h \
--required-capabilities "web-research,analysis"
# Comprehensive research with parameters
claude-flow task create research "Market analysis for AI development platforms" \
--scope "global" \
--depth "comprehensive" \
--sources "academic,industry,competitor" \
--deliverable "research-report.md" \
--deadline "2024-12-25T17:00:00Z"Research Task Configuration:
{
"type": "research",
"title": "AI Framework Competitive Analysis",
"description": "Analyze top 10 AI development frameworks",
"parameters": {
"scope": "technical-comparison",
"depth": "detailed",
"sources": ["documentation", "github", "industry-reports"],
"criteria": ["performance", "ease-of-use", "community", "licensing"]
},
"deliverables": [
"comparison-matrix.xlsx",
"technical-report.md",
"recommendation-summary.pdf"
],
"validation": {
"peer-review": true,
"fact-checking": true,
"citations-required": true
}
}Code development and technical implementation tasks.
Basic Implementation:
# API development task
claude-flow task create implementation "Develop user authentication API" \
--language "python" \
--framework "fastapi" \
--testing-required true \
--dependencies "database-design,security-requirements"
# Frontend implementation
claude-flow task create implementation "Build responsive dashboard UI" \
--tech-stack "react,typescript,tailwind" \
--features "real-time-updates,mobile-responsive,accessibility" \
--testing "unit,integration,e2e"Complex Implementation with Subtasks:
# Microservices platform
claude-flow task create implementation "Build e-commerce microservices platform" \
--architecture "microservices" \
--subtasks "user-service,product-service,order-service,payment-service" \
--tech-stack "nodejs,postgresql,redis,docker,kubernetes" \
--patterns "api-gateway,circuit-breaker,event-sourcing"Implementation Task Configuration:
{
"type": "implementation",
"title": "E-commerce Backend Services",
"architecture": "microservices",
"services": [
{
"name": "user-service",
"responsibilities": ["authentication", "user-management", "profiles"],
"technology": "nodejs",
"database": "postgresql",
"testing": ["unit", "integration"]
},
{
"name": "product-service",
"responsibilities": ["catalog", "inventory", "search"],
"technology": "python",
"database": "elasticsearch",
"caching": "redis"
}
],
"cross-cutting": {
"logging": "structured-json",
"monitoring": "prometheus",
"security": "jwt-auth",
"deployment": "kubernetes"
}
}Data analysis, pattern recognition, and insights generation.
Data Analysis:
# User behavior analysis
claude-flow task create analysis "Analyze user behavior patterns" \
--data-source "user-logs-2024.csv" \
--analysis-type "behavioral,predictive" \
--output-format "dashboard,report" \
--tools "pandas,matplotlib,seaborn,jupyter"
# Performance analysis
claude-flow task create analysis "System performance optimization analysis" \
--metrics "response-time,throughput,resource-usage,error-rates" \
--baseline "current-performance.json" \
--target-improvement "30%" \
--recommendations-required trueAnalysis Task Configuration:
{
"type": "analysis",
"title": "Customer Journey Analytics",
"data": {
"sources": ["web-analytics", "mobile-app", "crm-system"],
"timeframe": "6-months",
"volume": "10M-events"
},
"analytics": {
"techniques": ["funnel-analysis", "cohort-analysis", "path-analysis"],
"segmentation": ["demographics", "behavior", "value"],
"predictive": ["churn-prediction", "ltv-modeling"]
},
"outputs": {
"dashboards": ["executive", "operational"],
"reports": ["findings", "recommendations"],
"models": ["churn-model", "ltv-model"]
}
}Planning, orchestration, and project management tasks.
Project Coordination:
# Project planning
claude-flow task create coordination "Plan Q2 product development roadmap" \
--timeline "3-months" \
--stakeholders "engineering,product,design,marketing" \
--deliverables "roadmap,resource-plan,milestone-schedule" \
--methodology "agile"
# Team coordination
claude-flow task create coordination "Coordinate multi-team sprint execution" \
--teams "frontend,backend,qa,devops" \
--sprint-duration "2-weeks" \
--synchronization-points "daily-standup,weekly-review,retrospective"Coordination Task Configuration:
{
"type": "coordination",
"title": "Product Launch Coordination",
"scope": "cross-functional-teams",
"phases": [
{
"name": "planning",
"duration": "2-weeks",
"activities": ["requirement-gathering", "resource-allocation", "timeline-creation"]
},
{
"name": "development",
"duration": "8-weeks",
"activities": ["feature-development", "testing", "documentation"]
},
{
"name": "launch",
"duration": "2-weeks",
"activities": ["deployment", "monitoring", "support-preparation"]
}
],
"coordination": {
"meetings": ["daily-standups", "weekly-reviews", "stakeholder-updates"],
"communication": ["slack", "email", "dashboards"],
"tracking": ["jira", "confluence", "metrics-dashboard"]
}
}Claude-Flow supports 5 priority levels with sophisticated scheduling algorithms.
Priority Configuration:
# Critical priority (level 1) - immediate execution
claude-flow task create implementation "Fix security vulnerability CVE-2024-001" \
--priority critical \
--max-delay 2h \
--interrupt-lower-priority
# High priority (level 2) - preferential scheduling
claude-flow task create research "Customer requirements for Q1 release" \
--priority high \
--deadline "2024-12-31T23:59:59Z" \
--escalation-policy "auto-escalate"
# Normal priority (level 3) - default scheduling
claude-flow task create analysis "Monthly performance metrics analysis" \
--priority normal \
--schedule-after "first-week-of-month"
# Low priority (level 4) - scheduled during low-load
claude-flow task create documentation "Update API documentation" \
--priority low \
--execute-during "low-usage-hours"
# Background priority (level 5) - opportunistic execution
claude-flow task create maintenance "Clean up old log files and temporary data" \
--priority background \
--execute-when "system-idle" \
--resource-limit "minimal"Time-Based Scheduling:
# Schedule for specific time
claude-flow task create research "Weekly market analysis report" \
--schedule "every-monday-09:00" \
--timezone "America/New_York" \
--recurrence "weekly"
# Delayed execution
claude-flow task create deployment "Deploy to production environment" \
--delay 24h \
--dependencies "testing-complete,security-review-approved" \
--confirmation-required
# Deadline-driven scheduling
claude-flow task create analysis "Quarterly business review analysis" \
--deadline "2024-12-20T17:00:00Z" \
--notify-before "2h,24h,1w" \
--auto-prioritize-near-deadlineResource-Based Scheduling:
# Schedule based on resource availability
claude-flow task create implementation "Heavy computation task" \
--require-resources "cpu:8-cores,memory:16GB,gpu:1" \
--schedule-when-available \
--max-wait-time "4h"
# Load-balanced scheduling
claude-flow task create analysis "Large dataset processing" \
--distribute-load \
--parallel-subtasks 4 \
--load-balance-strategy "capability-based"Linear Dependencies:
# Single dependency
claude-flow task create implementation "Develop frontend components" \
--dependencies "api-specification-complete"
# Multiple dependencies
claude-flow task create deployment "Deploy to production" \
--dependencies "frontend-complete,backend-complete,testing-complete,security-audit-passed"
# Dependency with conditions
claude-flow task create integration "Integrate payment system" \
--dependencies "payment-provider-approval:status=approved,security-review:score>=95"Dependency Chain Creation:
# Create dependency chain with IDs
claude-flow task create research "Market research" --id market-research-001
claude-flow task create analysis "Analyze research findings" --id analysis-001 \
--dependencies "market-research-001"
claude-flow task create implementation "Develop product features" --id implementation-001 \
--dependencies "analysis-001"
claude-flow task create coordination "Launch planning" --id launch-planning-001 \
--dependencies "implementation-001"
# Visualize dependency graph
claude-flow task dependencies --graph --output dependency-graph.png --format svgParallel Dependencies:
# Parallel execution with synchronization points
claude-flow task create implementation "Backend API development" --id backend-api
claude-flow task create implementation "Frontend UI development" --id frontend-ui
claude-flow task create implementation "Database schema design" --id database-schema
claude-flow task create integration "System integration testing" \
--dependencies "backend-api,frontend-ui,database-schema" \
--parallel-until-sync trueConditional Dependency Configuration:
{
"task": "deploy-to-production",
"dependencies": [
{
"task": "security-audit",
"condition": "security_enabled == true",
"required_score": ">= 95"
},
{
"task": "performance-testing",
"condition": "load_testing_required == true",
"required_metrics": {
"response_time": "< 200ms",
"throughput": "> 1000rps"
}
},
{
"task": "code-review",
"condition": "review_threshold >= 95",
"reviewers_required": 2
}
],
"fallback_strategy": "manual_approval"
}Basic Development Workflow:
# Create workflow from file
claude-flow task workflow create --file simple-dev-workflow.json --name "Standard Development Process"
# Monitor workflow execution
claude-flow task workflow status <workflow-id> --detailed
# Control workflow execution
claude-flow task workflow pause <workflow-id> --reason "awaiting-stakeholder-approval"
claude-flow task workflow resume <workflow-id>
claude-flow task workflow abort <workflow-id> --save-progresssimple-dev-workflow.json:
{
"name": "Standard Development Workflow",
"description": "Basic development process from requirements to deployment",
"version": "1.0",
"tasks": [
{
"id": "requirements-analysis",
"type": "research",
"description": "Analyze and document requirements",
"assignTo": "business-analyst",
"estimatedDuration": "4h",
"deliverables": ["requirements-doc.md", "acceptance-criteria.md"]
},
{
"id": "system-design",
"type": "coordination",
"description": "Design system architecture and components",
"dependencies": ["requirements-analysis"],
"assignTo": "system-architect",
"estimatedDuration": "8h",
"deliverables": ["architecture-diagram.png", "design-doc.md"]
},
{
"id": "implementation",
"type": "implementation",
"description": "Implement core functionality",
"dependencies": ["system-design"],
"assignTo": "development-team",
"estimatedDuration": "40h",
"parallelizable": true
},
{
"id": "testing",
"type": "analysis",
"description": "Test and validate implementation",
"dependencies": ["implementation"],
"assignTo": "qa-team",
"estimatedDuration": "16h"
},
{
"id": "deployment",
"type": "coordination",
"description": "Deploy to production environment",
"dependencies": ["testing"],
"assignTo": "devops-team",
"estimatedDuration": "4h",
"approvalRequired": true
}
],
"notifications": {
"onComplete": ["stakeholders", "project-manager"],
"onError": ["development-team", "project-manager"],
"milestones": ["system-design", "testing"]
}
}Advanced Workflow with State Management:
{
"name": "Enterprise Software Development Lifecycle",
"type": "state-machine",
"version": "2.1",
"variables": {
"project_name": "enterprise-platform",
"target_environment": "production",
"compliance_required": true,
"security_level": "high"
},
"states": {
"requirements-gathering": {
"type": "parallel",
"description": "Gather requirements from multiple sources",
"branches": {
"stakeholder-interviews": {
"agent": "business-analyst",
"tasks": ["conduct-interviews", "analyze-feedback"],
"duration": "1w"
},
"technical-research": {
"agent": "technical-analyst",
"tasks": ["technology-assessment", "feasibility-study"],
"duration": "1w"
},
"compliance-review": {
"agent": "compliance-officer",
"tasks": ["regulatory-analysis", "compliance-mapping"],
"duration": "3d",
"condition": "${compliance_required}"
}
},
"completion": "all-branches",
"next": "architecture-design"
},
"architecture-design": {
"type": "sequential",
"description": "Design system architecture",
"tasks": [
{
"id": "high-level-design",
"agent": "solution-architect",
"duration": "3d",
"deliverables": ["architecture-overview.md"]
},
{
"id": "detailed-design",
"agent": "technical-architect",
"duration": "1w",
"dependencies": ["high-level-design"],
"deliverables": ["detailed-specs.md", "api-contracts.yaml"]
},
{
"id": "security-design",
"agent": "security-architect",
"duration": "2d",
"condition": "${security_level} == 'high'",
"deliverables": ["security-architecture.md"]
}
],
"validation": {
"peer-review": true,
"stakeholder-approval": true
},
"next": "implementation-planning"
},
"implementation-planning": {
"type": "coordination",
"description": "Plan implementation phases",
"agent": "project-manager",
"tasks": [
"create-sprint-backlog",
"resource-allocation",
"timeline-creation"
],
"next": "implementation"
},
"implementation": {
"type": "parallel",
"description": "Implement system components",
"branches": {
"backend-development": {
"agent": "backend-team",
"tasks": [
"api-development",
"database-implementation",
"business-logic",
"unit-testing"
],
"duration": "6w"
},
"frontend-development": {
"agent": "frontend-team",
"tasks": [
"ui-components",
"user-interfaces",
"client-logic",
"ui-testing"
],
"duration": "6w"
},
"infrastructure": {
"agent": "devops-team",
"tasks": [
"infrastructure-setup",
"ci-cd-pipeline",
"monitoring-setup"
],
"duration": "2w"
}
},
"synchronization-points": [
{
"at": "2w",
"activities": ["integration-checkpoint", "progress-review"]
},
{
"at": "4w",
"activities": ["milestone-review", "risk-assessment"]
}
],
"next": "testing-and-validation"
},
"testing-and-validation": {
"type": "sequential",
"description": "Comprehensive testing phase",
"tasks": [
{
"id": "integration-testing",
"agent": "qa-team",
"duration": "1w"
},
{
"id": "user-acceptance-testing",
"agent": "business-users",
"duration": "1w",
"dependencies": ["integration-testing"]
},
{
"id": "security-testing",
"agent": "security-team",
"duration": "3d",
"condition": "${security_level} == 'high'",
"dependencies": ["integration-testing"]
},
{
"id": "performance-testing",
"agent": "performance-team",
"duration": "3d",
"dependencies": ["integration-testing"]
}
],
"success-criteria": {
"test-coverage": ">= 90%",
"performance": "response-time < 200ms",
"security": "no-critical-vulnerabilities"
},
"next": "deployment-preparation"
},
"deployment-preparation": {
"type": "coordination",
"description": "Prepare for production deployment",
"agent": "release-manager",
"tasks": [
"deployment-planning",
"rollback-preparation",
"communication-plan",
"monitoring-setup"
],
"approvals": ["technical-lead", "business-owner"],
"next": "production-deployment"
},
"production-deployment": {
"type": "sequential",
"description": "Deploy to production",
"tasks": [
{
"id": "blue-green-deployment",
"agent": "devops-team",
"duration": "2h"
},
{
"id": "smoke-testing",
"agent": "qa-team",
"duration": "1h",
"dependencies": ["blue-green-deployment"]
},
{
"id": "traffic-switching",
"agent": "devops-team",
"duration": "30m",
"dependencies": ["smoke-testing"],
"manual-approval": true
}
],
"monitoring": {
"metrics": ["error-rate", "response-time", "throughput"],
"alerts": ["error-rate > 1%", "response-time > 500ms"],
"rollback-triggers": ["error-rate > 5%", "availability < 99%"]
},
"next": "post-deployment"
},
"post-deployment": {
"type": "coordination",
"description": "Post-deployment activities",
"tasks": [
"performance-monitoring",
"user-feedback-collection",
"documentation-updates",
"retrospective"
],
"duration": "1w",
"next": "complete"
}
},
"error-handling": {
"retry-policy": {
"max-retries": 3,
"backoff": "exponential"
},
"escalation": {
"on-failure": ["project-manager", "technical-lead"],
"on-timeout": ["project-manager"],
"on-resource-constraint": ["resource-manager"]
},
"rollback": {
"triggers": ["critical-failure", "security-breach"],
"strategy": "previous-stable-state"
}
}
}Event-Driven Workflow Setup:
# Set up event-driven CI/CD pipeline
claude-flow workflow event-driven create "ci-cd-pipeline" \
--triggers "git-push,pr-created,tag-released,schedule:daily" \
--handlers event-handlers.json \
--conditions workflow-conditions.jsonevent-handlers.json:
{
"git-push": {
"branch-patterns": ["main", "develop", "feature/*"],
"actions": [
{
"task": "automated-testing",
"condition": "branch != 'main'",
"priority": "high"
},
{
"task": "code-quality-check",
"parallel": true
}
]
},
"pr-created": {
"actions": [
{
"task": "pr-validation",
"assign-to": "code-reviewer"
},
{
"task": "automated-testing",
"parallel": true
}
]
},
"tag-released": {
"tag-patterns": ["v*.*.*"],
"actions": [
{
"task": "release-build",
"priority": "critical"
},
{
"task": "deployment-preparation",
"dependencies": ["release-build"]
}
]
}
}Template Definition:
# Create reusable template
claude-flow workflow template create "microservice-development" \
--description "Standard microservice development workflow" \
--parameters "service-name,tech-stack,deployment-target" \
--file microservice-template.json
# Publish to template registry
claude-flow workflow template publish "microservice-development" \
--registry "company-templates" \
--version "2.1.0" \
--tags "microservice,development,standard"microservice-template.json:
{
"name": "Microservice Development Template",
"description": "Standardized workflow for microservice development",
"version": "2.1.0",
"parameters": [
{
"name": "service_name",
"type": "string",
"required": true,
"description": "Name of the microservice"
},
{
"name": "tech_stack",
"type": "string",
"enum": ["nodejs", "python", "java", "go"],
"default": "nodejs"
},
{
"name": "deployment_target",
"type": "string",
"enum": ["kubernetes", "docker-swarm", "ecs"],
"default": "kubernetes"
}
],
"workflow": {
"tasks": [
{
"id": "service-design",
"type": "coordination",
"description": "Design ${service_name} service architecture",
"deliverables": ["api-spec.yaml", "service-design.md"]
},
{
"id": "implementation",
"type": "implementation",
"description": "Implement ${service_name} using ${tech_stack}",
"tech-stack": "${tech_stack}",
"patterns": ["hexagonal-architecture", "dependency-injection"]
},
{
"id": "containerization",
"type": "implementation",
"description": "Create Docker container for ${service_name}",
"dependencies": ["implementation"],
"deliverables": ["Dockerfile", "docker-compose.yml"]
},
{
"id": "deployment",
"type": "coordination",
"description": "Deploy to ${deployment_target}",
"dependencies": ["containerization"],
"target": "${deployment_target}"
}
]
}
}Generate Workflow from Template:
# Use template with parameters
claude-flow workflow generate \
--template "microservice-development" \
--parameters "service_name:user-service,tech_stack:python,deployment_target:kubernetes" \
--name "User Service Development"
# Interactive template usage
claude-flow workflow generate-interactive "microservice-development"
# Customize template before generation
claude-flow workflow customize-template "microservice-development" \
--modifications template-modifications.json \
--output custom-workflow.jsonComprehensive Task Monitoring:
# Monitor all tasks with live dashboard
claude-flow task monitor --all --dashboard --refresh 2s
# Monitor specific workflow
claude-flow task workflow monitor <workflow-id> \
--metrics "progress,performance,resources" \
--alerts "delays,failures,bottlenecks"
# Monitor by criteria
claude-flow task monitor \
--type implementation \
--status "running,pending" \
--priority "high,critical" \
--assigned-to "development-team"Performance Analytics:
# Task performance analysis
claude-flow task analytics performance \
--time-range "30d" \
--metrics "completion-time,resource-usage,success-rate" \
--group-by "type,priority,agent"
# Bottleneck analysis
claude-flow task analytics bottlenecks \
--workflow-id <workflow-id> \
--recommendations true
# Productivity metrics
claude-flow task analytics productivity \
--agents "all" \
--period "weekly" \
--trending trueIndividual Task Control:
# Pause task with reason
claude-flow task pause <task-id> \
--reason "awaiting-external-dependency" \
--estimated-delay "2h"
# Resume paused task
claude-flow task resume <task-id> \
--priority-adjustment "+1"
# Reschedule task
claude-flow task reschedule <task-id> \
--new-time "2024-12-20T14:00:00Z" \
--reason "resource-conflict"
# Change task priority
claude-flow task priority <task-id> --priority critical \
--justification "customer-critical-issue"
# Reassign task
claude-flow task reassign <task-id> \
--from "agent-1" \
--to "agent-2" \
--transfer-context trueBatch Operations:
# Batch pause by criteria
claude-flow task batch-pause \
--type "research" \
--assigned-to "researcher-team" \
--reason "team-meeting"
# Batch priority update
claude-flow task batch-update \
--filter "status:pending,created_after:2024-12-01" \
--set "priority:high,deadline:2024-12-25"
# Bulk reassignment
claude-flow task bulk-reassign \
--from-agent "overloaded-agent" \
--to-agents "backup-agent-1,backup-agent-2" \
--strategy "load-balance"Task Queue Optimization:
# Analyze queue performance
claude-flow task queue-analysis \
--metrics "wait-time,throughput,utilization" \
--recommendations true
# Optimize task distribution
claude-flow task optimize-distribution \
--algorithm "capability-weighted" \
--consider-agent-performance true
# Resource-aware scheduling
claude-flow task schedule-optimize \
--consider-resources "cpu,memory,network" \
--prediction-model "ml-based"Agent Workload Balancing:
# Monitor agent workload
claude-flow agent workload-monitor \
--real-time true \
--alert-thresholds "overload:>90%,idle:<10%"
# Rebalance workload
claude-flow task rebalance \
--strategy "even-distribution" \
--preserve-specialization true
# Predictive load balancing
claude-flow task predictive-balance \
--forecast-horizon "4h" \
--optimization-goal "minimize-completion-time"This comprehensive task coordination guide provides all the tools and patterns needed to build sophisticated, scalable workflows with Claude-Flow. Use these examples and best practices to orchestrate complex multi-agent systems effectively.