[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BXM046H34YZBP72ABWXESW":3,"skill-same:01M6BXM046H34YZBP72ABWXESW":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":51,"commitSha":52,"skillDirectory":53,"forksCount":54,"repositoryHtmlUrl":55,"repositoryHomepageUrl":17,"ownerHtmlUrl":56,"ownerBlogUrl":57,"ownerDescription":58,"updatedAt":59,"install":60,"resources":73},"01M6BXM046H34YZBP72ABWXESW","swarm-advanced","高级智能体集群编排","Advanced swarm orchestration patterns for research, development, testing, and complex distributed workflows","面向研究、开发、测试及复杂分布式工作流的高级群体（swarm）编排模式","diegopacheco\u002Fai-playground","diegopacheco","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121278?v=4","01M6BXCP8P7GGSJ8M1W2MFDTGT","Diego Pacheco","01M6BXCPD3WM51H465XW9YM4BV",21,"Unlicense",null,"https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fclaude-flow-fun\u002F.claude\u002Fskills\u002Fswarm-advanced\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BSAA4FBTWZP6X98STEHG99","智能体开发","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42],"swarm","swarm advanced","testing","research","orchestration","workflows","distributed","development","flow","team","coordination","parallel","2026-11-10 10:12:30",false,"---\nname: swarm-advanced\ndescription: Advanced swarm orchestration patterns for research, development, testing, and complex distributed workflows\nversion: 2.0.0\ncategory: orchestration\ntags: [swarm, distributed, parallel, research, testing, development, coordination]\nauthor: Claude Flow Team\n---\n\n# Advanced Swarm Orchestration\n\nMaster advanced swarm patterns for distributed research, development, and testing workflows. This skill covers comprehensive orchestration strategies using both MCP tools and CLI commands.\n\n## Quick Start\n\n### Prerequisites\n```bash\n# Ensure Claude Flow is installed\nnpm install -g claude-flow@alpha\n\n# Add MCP server (if using MCP tools)\nclaude mcp add claude-flow npx claude-flow@alpha mcp start\n```\n\n### Basic Pattern\n```javascript\n\u002F\u002F 1. Initialize swarm topology\nmcp__claude-flow__swarm_init({ topology: \"mesh\", maxAgents: 6 })\n\n\u002F\u002F 2. Spawn specialized agents\nmcp__claude-flow__agent_spawn({ type: \"researcher\", name: \"Agent 1\" })\n\n\u002F\u002F 3. Orchestrate tasks\nmcp__claude-flow__task_orchestrate({ task: \"...\", strategy: \"parallel\" })\n```\n\n## Core Concepts\n\n### Swarm Topologies\n\n**Mesh Topology** - Peer-to-peer communication, best for research and analysis\n- All agents communicate directly\n- High flexibility and resilience\n- Use for: Research, analysis, brainstorming\n\n**Hierarchical Topology** - Coordinator with subordinates, best for development\n- Clear command structure\n- Sequential workflow support\n- Use for: Development, structured workflows\n\n**Star Topology** - Central coordinator, best for testing\n- Centralized control and monitoring\n- Parallel execution with coordination\n- Use for: Testing, validation, quality assurance\n\n**Ring Topology** - Sequential processing chain\n- Step-by-step processing\n- Pipeline workflows\n- Use for: Multi-stage processing, data pipelines\n\n### Agent Strategies\n\n**Adaptive** - Dynamic adjustment based on task complexity\n**Balanced** - Equal distribution of work across agents\n**Specialized** - Task-specific agent assignment\n**Parallel** - Maximum concurrent execution\n\n## Pattern 1: Research Swarm\n\n### Purpose\nDeep research through parallel information gathering, analysis, and synthesis.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize research swarm\nmcp__claude-flow__swarm_init({\n  \"topology\": \"mesh\",\n  \"maxAgents\": 6,\n  \"strategy\": \"adaptive\"\n})\n\n\u002F\u002F Spawn research team\nconst researchAgents = [\n  {\n    type: \"researcher\",\n    name: \"Web Researcher\",\n    capabilities: [\"web-search\", \"content-extraction\", \"source-validation\"]\n  },\n  {\n    type: \"researcher\",\n    name: \"Academic Researcher\",\n    capabilities: [\"paper-analysis\", \"citation-tracking\", \"literature-review\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Data Analyst\",\n    capabilities: [\"data-processing\", \"statistical-analysis\", \"visualization\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Pattern Analyzer\",\n    capabilities: [\"trend-detection\", \"correlation-analysis\", \"outlier-detection\"]\n  },\n  {\n    type: \"documenter\",\n    name: \"Report Writer\",\n    capabilities: [\"synthesis\", \"technical-writing\", \"formatting\"]\n  }\n]\n\n\u002F\u002F Spawn all agents\nresearchAgents.forEach(agent => {\n  mcp__claude-flow__agent_spawn({\n    type: agent.type,\n    name: agent.name,\n    capabilities: agent.capabilities\n  })\n})\n```\n\n### Research Workflow\n\n#### Phase 1: Information Gathering\n```javascript\n\u002F\u002F Parallel information collection\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    {\n      \"id\": \"web-search\",\n      \"command\": \"search recent publications and articles\"\n    },\n    {\n      \"id\": \"academic-search\",\n      \"command\": \"search academic databases and papers\"\n    },\n    {\n      \"id\": \"data-collection\",\n      \"command\": \"gather relevant datasets and statistics\"\n    },\n    {\n      \"id\": \"expert-search\",\n      \"command\": \"identify domain experts and thought leaders\"\n    }\n  ]\n})\n\n\u002F\u002F Store research findings in memory\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"research-findings-\" + Date.now(),\n  \"value\": JSON.stringify(findings),\n  \"namespace\": \"research\",\n  \"ttl\": 604800 \u002F\u002F 7 days\n})\n```\n\n#### Phase 2: Analysis and Validation\n```javascript\n\u002F\u002F Pattern recognition in findings\nmcp__claude-flow__pattern_recognize({\n  \"data\": researchData,\n  \"patterns\": [\"trend\", \"correlation\", \"outlier\", \"emerging-pattern\"]\n})\n\n\u002F\u002F Cognitive analysis\nmcp__claude-flow__cognitive_analyze({\n  \"behavior\": \"research-synthesis\"\n})\n\n\u002F\u002F Quality assessment\nmcp__claude-flow__quality_assess({\n  \"target\": \"research-sources\",\n  \"criteria\": [\"credibility\", \"relevance\", \"recency\", \"authority\"]\n})\n\n\u002F\u002F Cross-reference validation\nmcp__claude-flow__neural_patterns({\n  \"action\": \"analyze\",\n  \"operation\": \"fact-checking\",\n  \"metadata\": { \"sources\": sourcesArray }\n})\n```\n\n#### Phase 3: Knowledge Management\n```javascript\n\u002F\u002F Search existing knowledge base\nmcp__claude-flow__memory_search({\n  \"pattern\": \"topic X\",\n  \"namespace\": \"research\",\n  \"limit\": 20\n})\n\n\u002F\u002F Create knowledge graph connections\nmcp__claude-flow__neural_patterns({\n  \"action\": \"learn\",\n  \"operation\": \"knowledge-graph\",\n  \"metadata\": {\n    \"topic\": \"X\",\n    \"connections\": relatedTopics,\n    \"depth\": 3\n  }\n})\n\n\u002F\u002F Store connections for future use\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"knowledge-graph-X\",\n  \"value\": JSON.stringify(knowledgeGraph),\n  \"namespace\": \"research\u002Fgraphs\",\n  \"ttl\": 2592000 \u002F\u002F 30 days\n})\n```\n\n#### Phase 4: Report Generation\n```javascript\n\u002F\u002F Orchestrate report generation\nmcp__claude-flow__task_orchestrate({\n  \"task\": \"generate comprehensive research report\",\n  \"strategy\": \"sequential\",\n  \"priority\": \"high\",\n  \"dependencies\": [\"gather\", \"analyze\", \"validate\", \"synthesize\"]\n})\n\n\u002F\u002F Monitor research progress\nmcp__claude-flow__swarm_status({\n  \"swarmId\": \"research-swarm\"\n})\n\n\u002F\u002F Generate final report\nmcp__claude-flow__workflow_execute({\n  \"workflowId\": \"research-report-generation\",\n  \"params\": {\n    \"findings\": findings,\n    \"format\": \"comprehensive\",\n    \"sections\": [\"executive-summary\", \"methodology\", \"findings\", \"analysis\", \"conclusions\", \"references\"]\n  }\n})\n```\n\n### CLI Fallback\n```bash\n# Quick research swarm\nnpx claude-flow swarm \"research AI trends in 2025\" \\\n  --strategy research \\\n  --mode distributed \\\n  --max-agents 6 \\\n  --parallel \\\n  --output research-report.md\n```\n\n## Pattern 2: Development Swarm\n\n### Purpose\nFull-stack development through coordinated specialist agents.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize development swarm with hierarchy\nmcp__claude-flow__swarm_init({\n  \"topology\": \"hierarchical\",\n  \"maxAgents\": 8,\n  \"strategy\": \"balanced\"\n})\n\n\u002F\u002F Spawn development team\nconst devTeam = [\n  { type: \"architect\", name: \"System Architect\", role: \"coordinator\" },\n  { type: \"coder\", name: \"Backend Developer\", capabilities: [\"node\", \"api\", \"database\"] },\n  { type: \"coder\", name: \"Frontend Developer\", capabilities: [\"react\", \"ui\", \"ux\"] },\n  { type: \"coder\", name: \"Database Engineer\", capabilities: [\"sql\", \"nosql\", \"optimization\"] },\n  { type: \"tester\", name: \"QA Engineer\", capabilities: [\"unit\", \"integration\", \"e2e\"] },\n  { type: \"reviewer\", name: \"Code Reviewer\", capabilities: [\"security\", \"performance\", \"best-practices\"] },\n  { type: \"documenter\", name: \"Technical Writer\", capabilities: [\"api-docs\", \"guides\", \"tutorials\"] },\n  { type: \"monitor\", name: \"DevOps Engineer\", capabilities: [\"ci-cd\", \"deployment\", \"monitoring\"] }\n]\n\n\u002F\u002F Spawn all team members\ndevTeam.forEach(member => {\n  mcp__claude-flow__agent_spawn({\n    type: member.type,\n    name: member.name,\n    capabilities: member.capabilities,\n    swarmId: \"dev-swarm\"\n  })\n})\n```\n\n### Development Workflow\n\n#### Phase 1: Architecture and Design\n```javascript\n\u002F\u002F System architecture design\nmcp__claude-flow__task_orchestrate({\n  \"task\": \"design system architecture for REST API\",\n  \"strategy\": \"sequential\",\n  \"priority\": \"critical\",\n  \"assignTo\": \"System Architect\"\n})\n\n\u002F\u002F Store architecture decisions\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"architecture-decisions\",\n  \"value\": JSON.stringify(architectureDoc),\n  \"namespace\": \"development\u002Fdesign\"\n})\n```\n\n#### Phase 2: Parallel Implementation\n```javascript\n\u002F\u002F Parallel development tasks\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    {\n      \"id\": \"backend-api\",\n      \"command\": \"implement REST API endpoints\",\n      \"assignTo\": \"Backend Developer\"\n    },\n    {\n      \"id\": \"frontend-ui\",\n      \"command\": \"build user interface components\",\n      \"assignTo\": \"Frontend Developer\"\n    },\n    {\n      \"id\": \"database-schema\",\n      \"command\": \"design and implement database schema\",\n      \"assignTo\": \"Database Engineer\"\n    },\n    {\n      \"id\": \"api-documentation\",\n      \"command\": \"create API documentation\",\n      \"assignTo\": \"Technical Writer\"\n    }\n  ]\n})\n\n\u002F\u002F Monitor development progress\nmcp__claude-flow__swarm_monitor({\n  \"swarmId\": \"dev-swarm\",\n  \"interval\": 5000\n})\n```\n\n#### Phase 3: Testing and Validation\n```javascript\n\u002F\u002F Comprehensive testing\nmcp__claude-flow__batch_process({\n  \"items\": [\n    { type: \"unit\", target: \"all-modules\" },\n    { type: \"integration\", target: \"api-endpoints\" },\n    { type: \"e2e\", target: \"user-flows\" },\n    { type: \"performance\", target: \"critical-paths\" }\n  ],\n  \"operation\": \"execute-tests\"\n})\n\n\u002F\u002F Quality assessment\nmcp__claude-flow__quality_assess({\n  \"target\": \"codebase\",\n  \"criteria\": [\"coverage\", \"complexity\", \"maintainability\", \"security\"]\n})\n```\n\n#### Phase 4: Review and Deployment\n```javascript\n\u002F\u002F Code review workflow\nmcp__claude-flow__workflow_execute({\n  \"workflowId\": \"code-review-process\",\n  \"params\": {\n    \"reviewers\": [\"Code Reviewer\"],\n    \"criteria\": [\"security\", \"performance\", \"best-practices\"]\n  }\n})\n\n\u002F\u002F CI\u002FCD pipeline\nmcp__claude-flow__pipeline_create({\n  \"config\": {\n    \"stages\": [\"build\", \"test\", \"security-scan\", \"deploy\"],\n    \"environment\": \"production\"\n  }\n})\n```\n\n### CLI Fallback\n```bash\n# Quick development swarm\nnpx claude-flow swarm \"build REST API with authentication\" \\\n  --strategy development \\\n  --mode hierarchical \\\n  --monitor \\\n  --output sqlite\n```\n\n## Pattern 3: Testing Swarm\n\n### Purpose\nComprehensive quality assurance through distributed testing.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize testing swarm with star topology\nmcp__claude-flow__swarm_init({\n  \"topology\": \"star\",\n  \"maxAgents\": 7,\n  \"strategy\": \"parallel\"\n})\n\n\u002F\u002F Spawn testing team\nconst testingTeam = [\n  {\n    type: \"tester\",\n    name: \"Unit Test Coordinator\",\n    capabilities: [\"unit-testing\", \"mocking\", \"coverage\", \"tdd\"]\n  },\n  {\n    type: \"tester\",\n    name: \"Integration Tester\",\n    capabilities: [\"integration\", \"api-testing\", \"contract-testing\"]\n  },\n  {\n    type: \"tester\",\n    name: \"E2E Tester\",\n    capabilities: [\"e2e\", \"ui-testing\", \"user-flows\", \"selenium\"]\n  },\n  {\n    type: \"tester\",\n    name: \"Performance Tester\",\n    capabilities: [\"load-testing\", \"stress-testing\", \"benchmarking\"]\n  },\n  {\n    type: \"monitor\",\n    name: \"Security Tester\",\n    capabilities: [\"security-testing\", \"penetration-testing\", \"vulnerability-scanning\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Test Analyst\",\n    capabilities: [\"coverage-analysis\", \"test-optimization\", \"reporting\"]\n  },\n  {\n    type: \"documenter\",\n    name: \"Test Documenter\",\n    capabilities: [\"test-documentation\", \"test-plans\", \"reports\"]\n  }\n]\n\n\u002F\u002F Spawn all testers\ntestingTeam.forEach(tester => {\n  mcp__claude-flow__agent_spawn({\n    type: tester.type,\n    name: tester.name,\n    capabilities: tester.capabilities,\n    swarmId: \"testing-swarm\"\n  })\n})\n```\n\n### Testing Workflow\n\n#### Phase 1: Test Planning\n```javascript\n\u002F\u002F Analyze test coverage requirements\nmcp__claude-flow__quality_assess({\n  \"target\": \"test-coverage\",\n  \"criteria\": [\n    \"line-coverage\",\n    \"branch-coverage\",\n    \"function-coverage\",\n    \"edge-cases\"\n  ]\n})\n\n\u002F\u002F Identify test scenarios\nmcp__claude-flow__pattern_recognize({\n  \"data\": testScenarios,\n  \"patterns\": [\n    \"edge-case\",\n    \"boundary-condition\",\n    \"error-path\",\n    \"happy-path\"\n  ]\n})\n\n\u002F\u002F Store test plan\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"test-plan-\" + Date.now(),\n  \"value\": JSON.stringify(testPlan),\n  \"namespace\": \"testing\u002Fplans\"\n})\n```\n\n#### Phase 2: Parallel Test Execution\n```javascript\n\u002F\u002F Execute all test suites in parallel\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    {\n      \"id\": \"unit-tests\",\n      \"command\": \"npm run test:unit\",\n      \"assignTo\": \"Unit Test Coordinator\"\n    },\n    {\n      \"id\": \"integration-tests\",\n      \"command\": \"npm run test:integration\",\n      \"assignTo\": \"Integration Tester\"\n    },\n    {\n      \"id\": \"e2e-tests\",\n      \"command\": \"npm run test:e2e\",\n      \"assignTo\": \"E2E Tester\"\n    },\n    {\n      \"id\": \"performance-tests\",\n      \"command\": \"npm run test:performance\",\n      \"assignTo\": \"Performance Tester\"\n    },\n    {\n      \"id\": \"security-tests\",\n      \"command\": \"npm run test:security\",\n      \"assignTo\": \"Security Tester\"\n    }\n  ]\n})\n\n\u002F\u002F Batch process test suites\nmcp__claude-flow__batch_process({\n  \"items\": testSuites,\n  \"operation\": \"execute-test-suite\"\n})\n```\n\n#### Phase 3: Performance and Security\n```javascript\n\u002F\u002F Run performance benchmarks\nmcp__claude-flow__benchmark_run({\n  \"suite\": \"comprehensive-performance\"\n})\n\n\u002F\u002F Bottleneck analysis\nmcp__claude-flow__bottleneck_analyze({\n  \"component\": \"application\",\n  \"metrics\": [\"response-time\", \"throughput\", \"memory\", \"cpu\"]\n})\n\n\u002F\u002F Security scanning\nmcp__claude-flow__security_scan({\n  \"target\": \"application\",\n  \"depth\": \"comprehensive\"\n})\n\n\u002F\u002F Vulnerability analysis\nmcp__claude-flow__error_analysis({\n  \"logs\": securityScanLogs\n})\n```\n\n#### Phase 4: Monitoring and Reporting\n```javascript\n\u002F\u002F Real-time test monitoring\nmcp__claude-flow__swarm_monitor({\n  \"swarmId\": \"testing-swarm\",\n  \"interval\": 2000\n})\n\n\u002F\u002F Generate comprehensive test report\nmcp__claude-flow__performance_report({\n  \"format\": \"detailed\",\n  \"timeframe\": \"current-run\"\n})\n\n\u002F\u002F Get test results\nmcp__claude-flow__task_results({\n  \"taskId\": \"test-execution-001\"\n})\n\n\u002F\u002F Trend analysis\nmcp__claude-flow__trend_analysis({\n  \"metric\": \"test-coverage\",\n  \"period\": \"30d\"\n})\n```\n\n### CLI Fallback\n```bash\n# Quick testing swarm\nnpx claude-flow swarm \"test application comprehensively\" \\\n  --strategy testing \\\n  --mode star \\\n  --parallel \\\n  --timeout 600\n```\n\n## Pattern 4: Analysis Swarm\n\n### Purpose\nDeep code and system analysis through specialized analyzers.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize analysis swarm\nmcp__claude-flow__swarm_init({\n  \"topology\": \"mesh\",\n  \"maxAgents\": 5,\n  \"strategy\": \"adaptive\"\n})\n\n\u002F\u002F Spawn analysis specialists\nconst analysisTeam = [\n  {\n    type: \"analyst\",\n    name: \"Code Analyzer\",\n    capabilities: [\"static-analysis\", \"complexity-analysis\", \"dead-code-detection\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Security Analyzer\",\n    capabilities: [\"security-scan\", \"vulnerability-detection\", \"dependency-audit\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Performance Analyzer\",\n    capabilities: [\"profiling\", \"bottleneck-detection\", \"optimization\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Architecture Analyzer\",\n    capabilities: [\"dependency-analysis\", \"coupling-detection\", \"modularity-assessment\"]\n  },\n  {\n    type: \"documenter\",\n    name: \"Analysis Reporter\",\n    capabilities: [\"reporting\", \"visualization\", \"recommendations\"]\n  }\n]\n\n\u002F\u002F Spawn all analysts\nanalysisTeam.forEach(analyst => {\n  mcp__claude-flow__agent_spawn({\n    type: analyst.type,\n    name: analyst.name,\n    capabilities: analyst.capabilities\n  })\n})\n```\n\n### Analysis Workflow\n```javascript\n\u002F\u002F Parallel analysis execution\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    { \"id\": \"analyze-code\", \"command\": \"analyze codebase structure and quality\" },\n    { \"id\": \"analyze-security\", \"command\": \"scan for security vulnerabilities\" },\n    { \"id\": \"analyze-performance\", \"command\": \"identify performance bottlenecks\" },\n    { \"id\": \"analyze-architecture\", \"command\": \"assess architectural patterns\" }\n  ]\n})\n\n\u002F\u002F Generate comprehensive analysis report\nmcp__claude-flow__performance_report({\n  \"format\": \"detailed\",\n  \"timeframe\": \"current\"\n})\n\n\u002F\u002F Cost analysis\nmcp__claude-flow__cost_analysis({\n  \"timeframe\": \"30d\"\n})\n```\n\n## Advanced Techniques\n\n### Error Handling and Fault Tolerance\n\n```javascript\n\u002F\u002F Setup fault tolerance for all agents\nmcp__claude-flow__daa_fault_tolerance({\n  \"agentId\": \"all\",\n  \"strategy\": \"auto-recovery\"\n})\n\n\u002F\u002F Error handling pattern\ntry {\n  await mcp__claude-flow__task_orchestrate({\n    \"task\": \"complex operation\",\n    \"strategy\": \"parallel\",\n    \"priority\": \"high\"\n  })\n} catch (error) {\n  \u002F\u002F Check swarm health\n  const status = await mcp__claude-flow__swarm_status({})\n\n  \u002F\u002F Analyze error patterns\n  await mcp__claude-flow__error_analysis({\n    \"logs\": [error.message]\n  })\n\n  \u002F\u002F Auto-recovery attempt\n  if (status.healthy) {\n    await mcp__claude-flow__task_orchestrate({\n      \"task\": \"retry failed operation\",\n      \"strategy\": \"sequential\"\n    })\n  }\n}\n```\n\n### Memory and State Management\n\n```javascript\n\u002F\u002F Cross-session persistence\nmcp__claude-flow__memory_persist({\n  \"sessionId\": \"swarm-session-001\"\n})\n\n\u002F\u002F Namespace management for different swarms\nmcp__claude-flow__memory_namespace({\n  \"namespace\": \"research-swarm\",\n  \"action\": \"create\"\n})\n\n\u002F\u002F Create state snapshot\nmcp__claude-flow__state_snapshot({\n  \"name\": \"development-checkpoint-1\"\n})\n\n\u002F\u002F Restore from snapshot if needed\nmcp__claude-flow__context_restore({\n  \"snapshotId\": \"development-checkpoint-1\"\n})\n\n\u002F\u002F Backup memory stores\nmcp__claude-flow__memory_backup({\n  \"path\": \"\u002Fworkspaces\u002Fclaude-code-flow\u002Fbackups\u002Fswarm-memory.json\"\n})\n```\n\n### Neural Pattern Learning\n\n```javascript\n\u002F\u002F Train neural patterns from successful workflows\nmcp__claude-flow__neural_train({\n  \"pattern_type\": \"coordination\",\n  \"training_data\": JSON.stringify(successfulWorkflows),\n  \"epochs\": 50\n})\n\n\u002F\u002F Adaptive learning from experience\nmcp__claude-flow__learning_adapt({\n  \"experience\": {\n    \"workflow\": \"research-to-report\",\n    \"success\": true,\n    \"duration\": 3600,\n    \"quality\": 0.95\n  }\n})\n\n\u002F\u002F Pattern recognition for optimization\nmcp__claude-flow__pattern_recognize({\n  \"data\": workflowMetrics,\n  \"patterns\": [\"bottleneck\", \"optimization-opportunity\", \"efficiency-gain\"]\n})\n```\n\n### Workflow Automation\n\n```javascript\n\u002F\u002F Create reusable workflow\nmcp__claude-flow__workflow_create({\n  \"name\": \"full-stack-development\",\n  \"steps\": [\n    { \"phase\": \"design\", \"agents\": [\"architect\"] },\n    { \"phase\": \"implement\", \"agents\": [\"backend-dev\", \"frontend-dev\"], \"parallel\": true },\n    { \"phase\": \"test\", \"agents\": [\"tester\", \"security-tester\"], \"parallel\": true },\n    { \"phase\": \"review\", \"agents\": [\"reviewer\"] },\n    { \"phase\": \"deploy\", \"agents\": [\"devops\"] }\n  ],\n  \"triggers\": [\"on-commit\", \"scheduled-daily\"]\n})\n\n\u002F\u002F Setup automation rules\nmcp__claude-flow__automation_setup({\n  \"rules\": [\n    {\n      \"trigger\": \"file-changed\",\n      \"pattern\": \"*.js\",\n      \"action\": \"run-tests\"\n    },\n    {\n      \"trigger\": \"PR-created\",\n      \"action\": \"code-review-swarm\"\n    }\n  ]\n})\n\n\u002F\u002F Event-driven triggers\nmcp__claude-flow__trigger_setup({\n  \"events\": [\"code-commit\", \"PR-merge\", \"deployment\"],\n  \"actions\": [\"test\", \"analyze\", \"document\"]\n})\n```\n\n### Performance Optimization\n\n```javascript\n\u002F\u002F Topology optimization\nmcp__claude-flow__topology_optimize({\n  \"swarmId\": \"current-swarm\"\n})\n\n\u002F\u002F Load balancing\nmcp__claude-flow__load_balance({\n  \"swarmId\": \"development-swarm\",\n  \"tasks\": taskQueue\n})\n\n\u002F\u002F Agent coordination sync\nmcp__claude-flow__coordination_sync({\n  \"swarmId\": \"development-swarm\"\n})\n\n\u002F\u002F Auto-scaling\nmcp__claude-flow__swarm_scale({\n  \"swarmId\": \"development-swarm\",\n  \"targetSize\": 12\n})\n```\n\n### Monitoring and Metrics\n\n```javascript\n\u002F\u002F Real-time swarm monitoring\nmcp__claude-flow__swarm_monitor({\n  \"swarmId\": \"active-swarm\",\n  \"interval\": 3000\n})\n\n\u002F\u002F Collect comprehensive metrics\nmcp__claude-flow__metrics_collect({\n  \"components\": [\"agents\", \"tasks\", \"memory\", \"performance\"]\n})\n\n\u002F\u002F Health monitoring\nmcp__claude-flow__health_check({\n  \"components\": [\"swarm\", \"agents\", \"neural\", \"memory\"]\n})\n\n\u002F\u002F Usage statistics\nmcp__claude-flow__usage_stats({\n  \"component\": \"swarm-orchestration\"\n})\n\n\u002F\u002F Trend analysis\nmcp__claude-flow__trend_analysis({\n  \"metric\": \"agent-performance\",\n  \"period\": \"7d\"\n})\n```\n\n## Best Practices\n\n### 1. Choosing the Right Topology\n\n- **Mesh**: Research, brainstorming, collaborative analysis\n- **Hierarchical**: Structured development, sequential workflows\n- **Star**: Testing, validation, centralized coordination\n- **Ring**: Pipeline processing, staged workflows\n\n### 2. Agent Specialization\n\n- Assign specific capabilities to each agent\n- Avoid overlapping responsibilities\n- Use coordination agents for complex workflows\n- Leverage memory for agent communication\n\n### 3. Parallel Execution\n\n- Identify independent tasks for parallelization\n- Use sequential execution for dependent tasks\n- Monitor resource usage during parallel execution\n- Implement proper error handling\n\n### 4. Memory Management\n\n- Use namespaces to organize memory\n- Set appropriate TTL values\n- Create regular backups\n- Implement state snapshots for checkpoints\n\n### 5. Monitoring and Optimization\n\n- Monitor swarm health regularly\n- Collect and analyze metrics\n- Optimize topology based on performance\n- Use neural patterns to learn from success\n\n### 6. Error Recovery\n\n- Implement fault tolerance strategies\n- Use auto-recovery mechanisms\n- Analyze error patterns\n- Create fallback workflows\n\n## Real-World Examples\n\n### Example 1: AI Research Project\n```javascript\n\u002F\u002F Research AI trends, analyze findings, generate report\nmcp__claude-flow__swarm_init({ topology: \"mesh\", maxAgents: 6 })\n\u002F\u002F Spawn: 2 researchers, 2 analysts, 1 synthesizer, 1 documenter\n\u002F\u002F Parallel gather → Analyze patterns → Synthesize → Report\n```\n\n### Example 2: Full-Stack Application\n```javascript\n\u002F\u002F Build complete web application with testing\nmcp__claude-flow__swarm_init({ topology: \"hierarchical\", maxAgents: 8 })\n\u002F\u002F Spawn: 1 architect, 2 devs, 1 db engineer, 2 testers, 1 reviewer, 1 devops\n\u002F\u002F Design → Parallel implement → Test → Review → Deploy\n```\n\n### Example 3: Security Audit\n```javascript\n\u002F\u002F Comprehensive security analysis\nmcp__claude-flow__swarm_init({ topology: \"star\", maxAgents: 5 })\n\u002F\u002F Spawn: 1 coordinator, 1 code analyzer, 1 security scanner, 1 penetration tester, 1 reporter\n\u002F\u002F Parallel scan → Vulnerability analysis → Penetration test → Report\n```\n\n### Example 4: Performance Optimization\n```javascript\n\u002F\u002F Identify and fix performance bottlenecks\nmcp__claude-flow__swarm_init({ topology: \"mesh\", maxAgents: 4 })\n\u002F\u002F Spawn: 1 profiler, 1 bottleneck analyzer, 1 optimizer, 1 tester\n\u002F\u002F Profile → Identify bottlenecks → Optimize → Validate\n```\n\n## Troubleshooting\n\n### Common Issues\n\n**Issue**: Swarm agents not coordinating properly\n**Solution**: Check topology selection, verify memory usage, enable monitoring\n\n**Issue**: Parallel execution failing\n**Solution**: Verify task dependencies, check resource limits, implement error handling\n\n**Issue**: Memory persistence not working\n**Solution**: Verify namespaces, check TTL settings, ensure backup configuration\n\n**Issue**: Performance degradation\n**Solution**: Optimize topology, reduce agent count, analyze bottlenecks\n\n## Related Skills\n\n- `sparc-methodology` - Systematic development workflow\n- `github-integration` - Repository management and automation\n- `neural-patterns` - AI-powered coordination optimization\n- `memory-management` - Cross-session state persistence\n\n## References\n\n- [Claude Flow Documentation](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow)\n- [Swarm Orchestration Guide](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow\u002Fwiki\u002Fswarm)\n- [MCP Tools Reference](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow\u002Fwiki\u002Fmcp)\n- [Performance Optimization](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow\u002Fwiki\u002Fperformance)\n\n---\n\n**Version**: 2.0.0\n**Last Updated**: 2025-10-19\n**Skill Level**: Advanced\n**Estimated Learning Time**: 2-3 hours\n","# Advanced Swarm Orchestration\n\nMaster advanced swarm patterns for distributed research, development, and testing workflows. This skill covers comprehensive orchestration strategies using both MCP tools and CLI commands.\n\n## Quick Start\n\n### Prerequisites\n```bash\n# Ensure Claude Flow is installed\nnpm install -g claude-flow@alpha\n\n# Add MCP server (if using MCP tools)\nclaude mcp add claude-flow npx claude-flow@alpha mcp start\n```\n\n### Basic Pattern\n```javascript\n\u002F\u002F 1. Initialize swarm topology\nmcp__claude-flow__swarm_init({ topology: \"mesh\", maxAgents: 6 })\n\n\u002F\u002F 2. Spawn specialized agents\nmcp__claude-flow__agent_spawn({ type: \"researcher\", name: \"Agent 1\" })\n\n\u002F\u002F 3. Orchestrate tasks\nmcp__claude-flow__task_orchestrate({ task: \"...\", strategy: \"parallel\" })\n```\n\n## Core Concepts\n\n### Swarm Topologies\n\n**Mesh Topology** - Peer-to-peer communication, best for research and analysis\n- All agents communicate directly\n- High flexibility and resilience\n- Use for: Research, analysis, brainstorming\n\n**Hierarchical Topology** - Coordinator with subordinates, best for development\n- Clear command structure\n- Sequential workflow support\n- Use for: Development, structured workflows\n\n**Star Topology** - Central coordinator, best for testing\n- Centralized control and monitoring\n- Parallel execution with coordination\n- Use for: Testing, validation, quality assurance\n\n**Ring Topology** - Sequential processing chain\n- Step-by-step processing\n- Pipeline workflows\n- Use for: Multi-stage processing, data pipelines\n\n### Agent Strategies\n\n**Adaptive** - Dynamic adjustment based on task complexity\n**Balanced** - Equal distribution of work across agents\n**Specialized** - Task-specific agent assignment\n**Parallel** - Maximum concurrent execution\n\n## Pattern 1: Research Swarm\n\n### Purpose\nDeep research through parallel information gathering, analysis, and synthesis.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize research swarm\nmcp__claude-flow__swarm_init({\n  \"topology\": \"mesh\",\n  \"maxAgents\": 6,\n  \"strategy\": \"adaptive\"\n})\n\n\u002F\u002F Spawn research team\nconst researchAgents = [\n  {\n    type: \"researcher\",\n    name: \"Web Researcher\",\n    capabilities: [\"web-search\", \"content-extraction\", \"source-validation\"]\n  },\n  {\n    type: \"researcher\",\n    name: \"Academic Researcher\",\n    capabilities: [\"paper-analysis\", \"citation-tracking\", \"literature-review\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Data Analyst\",\n    capabilities: [\"data-processing\", \"statistical-analysis\", \"visualization\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Pattern Analyzer\",\n    capabilities: [\"trend-detection\", \"correlation-analysis\", \"outlier-detection\"]\n  },\n  {\n    type: \"documenter\",\n    name: \"Report Writer\",\n    capabilities: [\"synthesis\", \"technical-writing\", \"formatting\"]\n  }\n]\n\n\u002F\u002F Spawn all agents\nresearchAgents.forEach(agent => {\n  mcp__claude-flow__agent_spawn({\n    type: agent.type,\n    name: agent.name,\n    capabilities: agent.capabilities\n  })\n})\n```\n\n### Research Workflow\n\n#### Phase 1: Information Gathering\n```javascript\n\u002F\u002F Parallel information collection\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    {\n      \"id\": \"web-search\",\n      \"command\": \"search recent publications and articles\"\n    },\n    {\n      \"id\": \"academic-search\",\n      \"command\": \"search academic databases and papers\"\n    },\n    {\n      \"id\": \"data-collection\",\n      \"command\": \"gather relevant datasets and statistics\"\n    },\n    {\n      \"id\": \"expert-search\",\n      \"command\": \"identify domain experts and thought leaders\"\n    }\n  ]\n})\n\n\u002F\u002F Store research findings in memory\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"research-findings-\" + Date.now(),\n  \"value\": JSON.stringify(findings),\n  \"namespace\": \"research\",\n  \"ttl\": 604800 \u002F\u002F 7 days\n})\n```\n\n#### Phase 2: Analysis and Validation\n```javascript\n\u002F\u002F Pattern recognition in findings\nmcp__claude-flow__pattern_recognize({\n  \"data\": researchData,\n  \"patterns\": [\"trend\", \"correlation\", \"outlier\", \"emerging-pattern\"]\n})\n\n\u002F\u002F Cognitive analysis\nmcp__claude-flow__cognitive_analyze({\n  \"behavior\": \"research-synthesis\"\n})\n\n\u002F\u002F Quality assessment\nmcp__claude-flow__quality_assess({\n  \"target\": \"research-sources\",\n  \"criteria\": [\"credibility\", \"relevance\", \"recency\", \"authority\"]\n})\n\n\u002F\u002F Cross-reference validation\nmcp__claude-flow__neural_patterns({\n  \"action\": \"analyze\",\n  \"operation\": \"fact-checking\",\n  \"metadata\": { \"sources\": sourcesArray }\n})\n```\n\n#### Phase 3: Knowledge Management\n```javascript\n\u002F\u002F Search existing knowledge base\nmcp__claude-flow__memory_search({\n  \"pattern\": \"topic X\",\n  \"namespace\": \"research\",\n  \"limit\": 20\n})\n\n\u002F\u002F Create knowledge graph connections\nmcp__claude-flow__neural_patterns({\n  \"action\": \"learn\",\n  \"operation\": \"knowledge-graph\",\n  \"metadata\": {\n    \"topic\": \"X\",\n    \"connections\": relatedTopics,\n    \"depth\": 3\n  }\n})\n\n\u002F\u002F Store connections for future use\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"knowledge-graph-X\",\n  \"value\": JSON.stringify(knowledgeGraph),\n  \"namespace\": \"research\u002Fgraphs\",\n  \"ttl\": 2592000 \u002F\u002F 30 days\n})\n```\n\n#### Phase 4: Report Generation\n```javascript\n\u002F\u002F Orchestrate report generation\nmcp__claude-flow__task_orchestrate({\n  \"task\": \"generate comprehensive research report\",\n  \"strategy\": \"sequential\",\n  \"priority\": \"high\",\n  \"dependencies\": [\"gather\", \"analyze\", \"validate\", \"synthesize\"]\n})\n\n\u002F\u002F Monitor research progress\nmcp__claude-flow__swarm_status({\n  \"swarmId\": \"research-swarm\"\n})\n\n\u002F\u002F Generate final report\nmcp__claude-flow__workflow_execute({\n  \"workflowId\": \"research-report-generation\",\n  \"params\": {\n    \"findings\": findings,\n    \"format\": \"comprehensive\",\n    \"sections\": [\"executive-summary\", \"methodology\", \"findings\", \"analysis\", \"conclusions\", \"references\"]\n  }\n})\n```\n\n### CLI Fallback\n```bash\n# Quick research swarm\nnpx claude-flow swarm \"research AI trends in 2025\" \\\n  --strategy research \\\n  --mode distributed \\\n  --max-agents 6 \\\n  --parallel \\\n  --output research-report.md\n```\n\n## Pattern 2: Development Swarm\n\n### Purpose\nFull-stack development through coordinated specialist agents.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize development swarm with hierarchy\nmcp__claude-flow__swarm_init({\n  \"topology\": \"hierarchical\",\n  \"maxAgents\": 8,\n  \"strategy\": \"balanced\"\n})\n\n\u002F\u002F Spawn development team\nconst devTeam = [\n  { type: \"architect\", name: \"System Architect\", role: \"coordinator\" },\n  { type: \"coder\", name: \"Backend Developer\", capabilities: [\"node\", \"api\", \"database\"] },\n  { type: \"coder\", name: \"Frontend Developer\", capabilities: [\"react\", \"ui\", \"ux\"] },\n  { type: \"coder\", name: \"Database Engineer\", capabilities: [\"sql\", \"nosql\", \"optimization\"] },\n  { type: \"tester\", name: \"QA Engineer\", capabilities: [\"unit\", \"integration\", \"e2e\"] },\n  { type: \"reviewer\", name: \"Code Reviewer\", capabilities: [\"security\", \"performance\", \"best-practices\"] },\n  { type: \"documenter\", name: \"Technical Writer\", capabilities: [\"api-docs\", \"guides\", \"tutorials\"] },\n  { type: \"monitor\", name: \"DevOps Engineer\", capabilities: [\"ci-cd\", \"deployment\", \"monitoring\"] }\n]\n\n\u002F\u002F Spawn all team members\ndevTeam.forEach(member => {\n  mcp__claude-flow__agent_spawn({\n    type: member.type,\n    name: member.name,\n    capabilities: member.capabilities,\n    swarmId: \"dev-swarm\"\n  })\n})\n```\n\n### Development Workflow\n\n#### Phase 1: Architecture and Design\n```javascript\n\u002F\u002F System architecture design\nmcp__claude-flow__task_orchestrate({\n  \"task\": \"design system architecture for REST API\",\n  \"strategy\": \"sequential\",\n  \"priority\": \"critical\",\n  \"assignTo\": \"System Architect\"\n})\n\n\u002F\u002F Store architecture decisions\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"architecture-decisions\",\n  \"value\": JSON.stringify(architectureDoc),\n  \"namespace\": \"development\u002Fdesign\"\n})\n```\n\n#### Phase 2: Parallel Implementation\n```javascript\n\u002F\u002F Parallel development tasks\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    {\n      \"id\": \"backend-api\",\n      \"command\": \"implement REST API endpoints\",\n      \"assignTo\": \"Backend Developer\"\n    },\n    {\n      \"id\": \"frontend-ui\",\n      \"command\": \"build user interface components\",\n      \"assignTo\": \"Frontend Developer\"\n    },\n    {\n      \"id\": \"database-schema\",\n      \"command\": \"design and implement database schema\",\n      \"assignTo\": \"Database Engineer\"\n    },\n    {\n      \"id\": \"api-documentation\",\n      \"command\": \"create API documentation\",\n      \"assignTo\": \"Technical Writer\"\n    }\n  ]\n})\n\n\u002F\u002F Monitor development progress\nmcp__claude-flow__swarm_monitor({\n  \"swarmId\": \"dev-swarm\",\n  \"interval\": 5000\n})\n```\n\n#### Phase 3: Testing and Validation\n```javascript\n\u002F\u002F Comprehensive testing\nmcp__claude-flow__batch_process({\n  \"items\": [\n    { type: \"unit\", target: \"all-modules\" },\n    { type: \"integration\", target: \"api-endpoints\" },\n    { type: \"e2e\", target: \"user-flows\" },\n    { type: \"performance\", target: \"critical-paths\" }\n  ],\n  \"operation\": \"execute-tests\"\n})\n\n\u002F\u002F Quality assessment\nmcp__claude-flow__quality_assess({\n  \"target\": \"codebase\",\n  \"criteria\": [\"coverage\", \"complexity\", \"maintainability\", \"security\"]\n})\n```\n\n#### Phase 4: Review and Deployment\n```javascript\n\u002F\u002F Code review workflow\nmcp__claude-flow__workflow_execute({\n  \"workflowId\": \"code-review-process\",\n  \"params\": {\n    \"reviewers\": [\"Code Reviewer\"],\n    \"criteria\": [\"security\", \"performance\", \"best-practices\"]\n  }\n})\n\n\u002F\u002F CI\u002FCD pipeline\nmcp__claude-flow__pipeline_create({\n  \"config\": {\n    \"stages\": [\"build\", \"test\", \"security-scan\", \"deploy\"],\n    \"environment\": \"production\"\n  }\n})\n```\n\n### CLI Fallback\n```bash\n# Quick development swarm\nnpx claude-flow swarm \"build REST API with authentication\" \\\n  --strategy development \\\n  --mode hierarchical \\\n  --monitor \\\n  --output sqlite\n```\n\n## Pattern 3: Testing Swarm\n\n### Purpose\nComprehensive quality assurance through distributed testing.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize testing swarm with star topology\nmcp__claude-flow__swarm_init({\n  \"topology\": \"star\",\n  \"maxAgents\": 7,\n  \"strategy\": \"parallel\"\n})\n\n\u002F\u002F Spawn testing team\nconst testingTeam = [\n  {\n    type: \"tester\",\n    name: \"Unit Test Coordinator\",\n    capabilities: [\"unit-testing\", \"mocking\", \"coverage\", \"tdd\"]\n  },\n  {\n    type: \"tester\",\n    name: \"Integration Tester\",\n    capabilities: [\"integration\", \"api-testing\", \"contract-testing\"]\n  },\n  {\n    type: \"tester\",\n    name: \"E2E Tester\",\n    capabilities: [\"e2e\", \"ui-testing\", \"user-flows\", \"selenium\"]\n  },\n  {\n    type: \"tester\",\n    name: \"Performance Tester\",\n    capabilities: [\"load-testing\", \"stress-testing\", \"benchmarking\"]\n  },\n  {\n    type: \"monitor\",\n    name: \"Security Tester\",\n    capabilities: [\"security-testing\", \"penetration-testing\", \"vulnerability-scanning\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Test Analyst\",\n    capabilities: [\"coverage-analysis\", \"test-optimization\", \"reporting\"]\n  },\n  {\n    type: \"documenter\",\n    name: \"Test Documenter\",\n    capabilities: [\"test-documentation\", \"test-plans\", \"reports\"]\n  }\n]\n\n\u002F\u002F Spawn all testers\ntestingTeam.forEach(tester => {\n  mcp__claude-flow__agent_spawn({\n    type: tester.type,\n    name: tester.name,\n    capabilities: tester.capabilities,\n    swarmId: \"testing-swarm\"\n  })\n})\n```\n\n### Testing Workflow\n\n#### Phase 1: Test Planning\n```javascript\n\u002F\u002F Analyze test coverage requirements\nmcp__claude-flow__quality_assess({\n  \"target\": \"test-coverage\",\n  \"criteria\": [\n    \"line-coverage\",\n    \"branch-coverage\",\n    \"function-coverage\",\n    \"edge-cases\"\n  ]\n})\n\n\u002F\u002F Identify test scenarios\nmcp__claude-flow__pattern_recognize({\n  \"data\": testScenarios,\n  \"patterns\": [\n    \"edge-case\",\n    \"boundary-condition\",\n    \"error-path\",\n    \"happy-path\"\n  ]\n})\n\n\u002F\u002F Store test plan\nmcp__claude-flow__memory_usage({\n  \"action\": \"store\",\n  \"key\": \"test-plan-\" + Date.now(),\n  \"value\": JSON.stringify(testPlan),\n  \"namespace\": \"testing\u002Fplans\"\n})\n```\n\n#### Phase 2: Parallel Test Execution\n```javascript\n\u002F\u002F Execute all test suites in parallel\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    {\n      \"id\": \"unit-tests\",\n      \"command\": \"npm run test:unit\",\n      \"assignTo\": \"Unit Test Coordinator\"\n    },\n    {\n      \"id\": \"integration-tests\",\n      \"command\": \"npm run test:integration\",\n      \"assignTo\": \"Integration Tester\"\n    },\n    {\n      \"id\": \"e2e-tests\",\n      \"command\": \"npm run test:e2e\",\n      \"assignTo\": \"E2E Tester\"\n    },\n    {\n      \"id\": \"performance-tests\",\n      \"command\": \"npm run test:performance\",\n      \"assignTo\": \"Performance Tester\"\n    },\n    {\n      \"id\": \"security-tests\",\n      \"command\": \"npm run test:security\",\n      \"assignTo\": \"Security Tester\"\n    }\n  ]\n})\n\n\u002F\u002F Batch process test suites\nmcp__claude-flow__batch_process({\n  \"items\": testSuites,\n  \"operation\": \"execute-test-suite\"\n})\n```\n\n#### Phase 3: Performance and Security\n```javascript\n\u002F\u002F Run performance benchmarks\nmcp__claude-flow__benchmark_run({\n  \"suite\": \"comprehensive-performance\"\n})\n\n\u002F\u002F Bottleneck analysis\nmcp__claude-flow__bottleneck_analyze({\n  \"component\": \"application\",\n  \"metrics\": [\"response-time\", \"throughput\", \"memory\", \"cpu\"]\n})\n\n\u002F\u002F Security scanning\nmcp__claude-flow__security_scan({\n  \"target\": \"application\",\n  \"depth\": \"comprehensive\"\n})\n\n\u002F\u002F Vulnerability analysis\nmcp__claude-flow__error_analysis({\n  \"logs\": securityScanLogs\n})\n```\n\n#### Phase 4: Monitoring and Reporting\n```javascript\n\u002F\u002F Real-time test monitoring\nmcp__claude-flow__swarm_monitor({\n  \"swarmId\": \"testing-swarm\",\n  \"interval\": 2000\n})\n\n\u002F\u002F Generate comprehensive test report\nmcp__claude-flow__performance_report({\n  \"format\": \"detailed\",\n  \"timeframe\": \"current-run\"\n})\n\n\u002F\u002F Get test results\nmcp__claude-flow__task_results({\n  \"taskId\": \"test-execution-001\"\n})\n\n\u002F\u002F Trend analysis\nmcp__claude-flow__trend_analysis({\n  \"metric\": \"test-coverage\",\n  \"period\": \"30d\"\n})\n```\n\n### CLI Fallback\n```bash\n# Quick testing swarm\nnpx claude-flow swarm \"test application comprehensively\" \\\n  --strategy testing \\\n  --mode star \\\n  --parallel \\\n  --timeout 600\n```\n\n## Pattern 4: Analysis Swarm\n\n### Purpose\nDeep code and system analysis through specialized analyzers.\n\n### Architecture\n```javascript\n\u002F\u002F Initialize analysis swarm\nmcp__claude-flow__swarm_init({\n  \"topology\": \"mesh\",\n  \"maxAgents\": 5,\n  \"strategy\": \"adaptive\"\n})\n\n\u002F\u002F Spawn analysis specialists\nconst analysisTeam = [\n  {\n    type: \"analyst\",\n    name: \"Code Analyzer\",\n    capabilities: [\"static-analysis\", \"complexity-analysis\", \"dead-code-detection\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Security Analyzer\",\n    capabilities: [\"security-scan\", \"vulnerability-detection\", \"dependency-audit\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Performance Analyzer\",\n    capabilities: [\"profiling\", \"bottleneck-detection\", \"optimization\"]\n  },\n  {\n    type: \"analyst\",\n    name: \"Architecture Analyzer\",\n    capabilities: [\"dependency-analysis\", \"coupling-detection\", \"modularity-assessment\"]\n  },\n  {\n    type: \"documenter\",\n    name: \"Analysis Reporter\",\n    capabilities: [\"reporting\", \"visualization\", \"recommendations\"]\n  }\n]\n\n\u002F\u002F Spawn all analysts\nanalysisTeam.forEach(analyst => {\n  mcp__claude-flow__agent_spawn({\n    type: analyst.type,\n    name: analyst.name,\n    capabilities: analyst.capabilities\n  })\n})\n```\n\n### Analysis Workflow\n```javascript\n\u002F\u002F Parallel analysis execution\nmcp__claude-flow__parallel_execute({\n  \"tasks\": [\n    { \"id\": \"analyze-code\", \"command\": \"analyze codebase structure and quality\" },\n    { \"id\": \"analyze-security\", \"command\": \"scan for security vulnerabilities\" },\n    { \"id\": \"analyze-performance\", \"command\": \"identify performance bottlenecks\" },\n    { \"id\": \"analyze-architecture\", \"command\": \"assess architectural patterns\" }\n  ]\n})\n\n\u002F\u002F Generate comprehensive analysis report\nmcp__claude-flow__performance_report({\n  \"format\": \"detailed\",\n  \"timeframe\": \"current\"\n})\n\n\u002F\u002F Cost analysis\nmcp__claude-flow__cost_analysis({\n  \"timeframe\": \"30d\"\n})\n```\n\n## Advanced Techniques\n\n### Error Handling and Fault Tolerance\n\n```javascript\n\u002F\u002F Setup fault tolerance for all agents\nmcp__claude-flow__daa_fault_tolerance({\n  \"agentId\": \"all\",\n  \"strategy\": \"auto-recovery\"\n})\n\n\u002F\u002F Error handling pattern\ntry {\n  await mcp__claude-flow__task_orchestrate({\n    \"task\": \"complex operation\",\n    \"strategy\": \"parallel\",\n    \"priority\": \"high\"\n  })\n} catch (error) {\n  \u002F\u002F Check swarm health\n  const status = await mcp__claude-flow__swarm_status({})\n\n  \u002F\u002F Analyze error patterns\n  await mcp__claude-flow__error_analysis({\n    \"logs\": [error.message]\n  })\n\n  \u002F\u002F Auto-recovery attempt\n  if (status.healthy) {\n    await mcp__claude-flow__task_orchestrate({\n      \"task\": \"retry failed operation\",\n      \"strategy\": \"sequential\"\n    })\n  }\n}\n```\n\n### Memory and State Management\n\n```javascript\n\u002F\u002F Cross-session persistence\nmcp__claude-flow__memory_persist({\n  \"sessionId\": \"swarm-session-001\"\n})\n\n\u002F\u002F Namespace management for different swarms\nmcp__claude-flow__memory_namespace({\n  \"namespace\": \"research-swarm\",\n  \"action\": \"create\"\n})\n\n\u002F\u002F Create state snapshot\nmcp__claude-flow__state_snapshot({\n  \"name\": \"development-checkpoint-1\"\n})\n\n\u002F\u002F Restore from snapshot if needed\nmcp__claude-flow__context_restore({\n  \"snapshotId\": \"development-checkpoint-1\"\n})\n\n\u002F\u002F Backup memory stores\nmcp__claude-flow__memory_backup({\n  \"path\": \"\u002Fworkspaces\u002Fclaude-code-flow\u002Fbackups\u002Fswarm-memory.json\"\n})\n```\n\n### Neural Pattern Learning\n\n```javascript\n\u002F\u002F Train neural patterns from successful workflows\nmcp__claude-flow__neural_train({\n  \"pattern_type\": \"coordination\",\n  \"training_data\": JSON.stringify(successfulWorkflows),\n  \"epochs\": 50\n})\n\n\u002F\u002F Adaptive learning from experience\nmcp__claude-flow__learning_adapt({\n  \"experience\": {\n    \"workflow\": \"research-to-report\",\n    \"success\": true,\n    \"duration\": 3600,\n    \"quality\": 0.95\n  }\n})\n\n\u002F\u002F Pattern recognition for optimization\nmcp__claude-flow__pattern_recognize({\n  \"data\": workflowMetrics,\n  \"patterns\": [\"bottleneck\", \"optimization-opportunity\", \"efficiency-gain\"]\n})\n```\n\n### Workflow Automation\n\n```javascript\n\u002F\u002F Create reusable workflow\nmcp__claude-flow__workflow_create({\n  \"name\": \"full-stack-development\",\n  \"steps\": [\n    { \"phase\": \"design\", \"agents\": [\"architect\"] },\n    { \"phase\": \"implement\", \"agents\": [\"backend-dev\", \"frontend-dev\"], \"parallel\": true },\n    { \"phase\": \"test\", \"agents\": [\"tester\", \"security-tester\"], \"parallel\": true },\n    { \"phase\": \"review\", \"agents\": [\"reviewer\"] },\n    { \"phase\": \"deploy\", \"agents\": [\"devops\"] }\n  ],\n  \"triggers\": [\"on-commit\", \"scheduled-daily\"]\n})\n\n\u002F\u002F Setup automation rules\nmcp__claude-flow__automation_setup({\n  \"rules\": [\n    {\n      \"trigger\": \"file-changed\",\n      \"pattern\": \"*.js\",\n      \"action\": \"run-tests\"\n    },\n    {\n      \"trigger\": \"PR-created\",\n      \"action\": \"code-review-swarm\"\n    }\n  ]\n})\n\n\u002F\u002F Event-driven triggers\nmcp__claude-flow__trigger_setup({\n  \"events\": [\"code-commit\", \"PR-merge\", \"deployment\"],\n  \"actions\": [\"test\", \"analyze\", \"document\"]\n})\n```\n\n### Performance Optimization\n\n```javascript\n\u002F\u002F Topology optimization\nmcp__claude-flow__topology_optimize({\n  \"swarmId\": \"current-swarm\"\n})\n\n\u002F\u002F Load balancing\nmcp__claude-flow__load_balance({\n  \"swarmId\": \"development-swarm\",\n  \"tasks\": taskQueue\n})\n\n\u002F\u002F Agent coordination sync\nmcp__claude-flow__coordination_sync({\n  \"swarmId\": \"development-swarm\"\n})\n\n\u002F\u002F Auto-scaling\nmcp__claude-flow__swarm_scale({\n  \"swarmId\": \"development-swarm\",\n  \"targetSize\": 12\n})\n```\n\n### Monitoring and Metrics\n\n```javascript\n\u002F\u002F Real-time swarm monitoring\nmcp__claude-flow__swarm_monitor({\n  \"swarmId\": \"active-swarm\",\n  \"interval\": 3000\n})\n\n\u002F\u002F Collect comprehensive metrics\nmcp__claude-flow__metrics_collect({\n  \"components\": [\"agents\", \"tasks\", \"memory\", \"performance\"]\n})\n\n\u002F\u002F Health monitoring\nmcp__claude-flow__health_check({\n  \"components\": [\"swarm\", \"agents\", \"neural\", \"memory\"]\n})\n\n\u002F\u002F Usage statistics\nmcp__claude-flow__usage_stats({\n  \"component\": \"swarm-orchestration\"\n})\n\n\u002F\u002F Trend analysis\nmcp__claude-flow__trend_analysis({\n  \"metric\": \"agent-performance\",\n  \"period\": \"7d\"\n})\n```\n\n## Best Practices\n\n### 1. Choosing the Right Topology\n\n- **Mesh**: Research, brainstorming, collaborative analysis\n- **Hierarchical**: Structured development, sequential workflows\n- **Star**: Testing, validation, centralized coordination\n- **Ring**: Pipeline processing, staged workflows\n\n### 2. Agent Specialization\n\n- Assign specific capabilities to each agent\n- Avoid overlapping responsibilities\n- Use coordination agents for complex workflows\n- Leverage memory for agent communication\n\n### 3. Parallel Execution\n\n- Identify independent tasks for parallelization\n- Use sequential execution for dependent tasks\n- Monitor resource usage during parallel execution\n- Implement proper error handling\n\n### 4. Memory Management\n\n- Use namespaces to organize memory\n- Set appropriate TTL values\n- Create regular backups\n- Implement state snapshots for checkpoints\n\n### 5. Monitoring and Optimization\n\n- Monitor swarm health regularly\n- Collect and analyze metrics\n- Optimize topology based on performance\n- Use neural patterns to learn from success\n\n### 6. Error Recovery\n\n- Implement fault tolerance strategies\n- Use auto-recovery mechanisms\n- Analyze error patterns\n- Create fallback workflows\n\n## Real-World Examples\n\n### Example 1: AI Research Project\n```javascript\n\u002F\u002F Research AI trends, analyze findings, generate report\nmcp__claude-flow__swarm_init({ topology: \"mesh\", maxAgents: 6 })\n\u002F\u002F Spawn: 2 researchers, 2 analysts, 1 synthesizer, 1 documenter\n\u002F\u002F Parallel gather → Analyze patterns → Synthesize → Report\n```\n\n### Example 2: Full-Stack Application\n```javascript\n\u002F\u002F Build complete web application with testing\nmcp__claude-flow__swarm_init({ topology: \"hierarchical\", maxAgents: 8 })\n\u002F\u002F Spawn: 1 architect, 2 devs, 1 db engineer, 2 testers, 1 reviewer, 1 devops\n\u002F\u002F Design → Parallel implement → Test → Review → Deploy\n```\n\n### Example 3: Security Audit\n```javascript\n\u002F\u002F Comprehensive security analysis\nmcp__claude-flow__swarm_init({ topology: \"star\", maxAgents: 5 })\n\u002F\u002F Spawn: 1 coordinator, 1 code analyzer, 1 security scanner, 1 penetration tester, 1 reporter\n\u002F\u002F Parallel scan → Vulnerability analysis → Penetration test → Report\n```\n\n### Example 4: Performance Optimization\n```javascript\n\u002F\u002F Identify and fix performance bottlenecks\nmcp__claude-flow__swarm_init({ topology: \"mesh\", maxAgents: 4 })\n\u002F\u002F Spawn: 1 profiler, 1 bottleneck analyzer, 1 optimizer, 1 tester\n\u002F\u002F Profile → Identify bottlenecks → Optimize → Validate\n```\n\n## Troubleshooting\n\n### Common Issues\n\n**Issue**: Swarm agents not coordinating properly\n**Solution**: Check topology selection, verify memory usage, enable monitoring\n\n**Issue**: Parallel execution failing\n**Solution**: Verify task dependencies, check resource limits, implement error handling\n\n**Issue**: Memory persistence not working\n**Solution**: Verify namespaces, check TTL settings, ensure backup configuration\n\n**Issue**: Performance degradation\n**Solution**: Optimize topology, reduce agent count, analyze bottlenecks\n\n## Related Skills\n\n- `sparc-methodology` - Systematic development workflow\n- `github-integration` - Repository management and automation\n- `neural-patterns` - AI-powered coordination optimization\n- `memory-management` - Cross-session state persistence\n\n## References\n\n- [Claude Flow Documentation](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow)\n- [Swarm Orchestration Guide](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow\u002Fwiki\u002Fswarm)\n- [MCP Tools Reference](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow\u002Fwiki\u002Fmcp)\n- [Performance Optimization](https:\u002F\u002Fgithub.com\u002Fruvnet\u002Fclaude-flow\u002Fwiki\u002Fperformance)\n\n---\n\n**Version**: 2.0.0\n**Last Updated**: 2025-10-19\n**Skill Level**: Advanced\n**Estimated Learning Time**: 2-3 hours\n",{"name":5,"tags":48,"author":49,"version":50,"category":35,"description":7},[31,37,42,34,33,38,41],"Claude Flow Team","2.0.0","main","90d379e95fcc23dd9759654c345424e1752b0f3a","pocs\u002Fclaude-flow-fun\u002F.claude\u002Fskills\u002Fswarm-advanced",9,"https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground","https:\u002F\u002Fgithub.com\u002Fdiegopacheco","http:\u002F\u002Fdiego-pacheco.blogspot.com","Brazilian Hands-on Software Architect | 20+ years in Tech | Author | Father. Opinions are my own!","2026-11-15 01:01:48",{"source":9,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add diegopacheco\u002Fai-playground --skill swarm-advanced",{"tool":66,"command":67},"bunx","bunx skills add diegopacheco\u002Fai-playground --skill swarm-advanced",{"tool":69,"command":70},"pnpm","pnpm dlx skills add diegopacheco\u002Fai-playground --skill swarm-advanced","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fclaude-flow-fun\u002F.claude\u002Fskills\u002Fswarm-advanced\u002FSKILL.md",true,[74],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"LICENSE.upstream","LICENSE","许可证",1070,"https:\u002F\u002Fgithub.com\u002Fvox-foundation\u002Fvox\u002Fblob\u002Fmain\u002Fassets\u002Fskills\u002Fverification-before-completion\u002FLICENSE.upstream",[81,94,104,117,133,152],{"skillNo":82,"name":83,"nameZh":17,"description":84,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":43},"01M6WJ537DN520XY8MSW9ZV0RP","word-count","Counts the words, lines and characters of a text or a file.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Ftext-skills\u002Fword-count\u002FSKILL.md",[],[88,89,90,91,92,93],"count","word count","Word","characters","text","file",{"skillNo":95,"name":96,"nameZh":17,"description":97,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":43},"01M6WJ4Y2GT5SECWAKKYHGES4F","slugify","Turns a title or a sentence into a URL slug, lowercase words joined by hyphens with accents removed.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Ftext-skills\u002Fslugify\u002FSKILL.md",[],[96,101,102,103],"title","with","URL",{"skillNo":105,"name":106,"nameZh":17,"description":107,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":43},"01M6WJ4V9CWHT9NVCD441VK5MH","json-format","Validates a JSON file and pretty prints it with two space indentation, or reports where the JSON is invalid.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Fdev-skills\u002Fjson-format\u002FSKILL.md",[],[111,112,113,93,114,115,116,102],"json","format","json format","reports","invalid","it",{"skillNo":118,"name":119,"nameZh":17,"description":120,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":43},"01M6WJ4QMRKW8EFP71F4KS2DHE","commit-message","Writes a conventional commit message for the staged git changes.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002Fupstream-skills\u002Fdev-skills\u002Fcommit-message\u002FSKILL.md",[],[124,125,126,127,128,129,130,131,132],"commit","commit message","message","git","conventional commit","for","changes","staged","conventional commit message",{"skillNo":134,"name":135,"nameZh":17,"description":136,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":43},"01M6WJ4MAM2CJH0GWYXFBB9GQC","skills-gateway","Gateway and router to a catalog of skills that are not registered directly. Use it before any task a specialized skill could handle, such as text, JSON or git chores. It finds the right skill and loads its instructions.","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fskills-gateway-router\u002F.claude\u002Fskills\u002Fskills-gateway\u002FSKILL.md",[],[140,141,116,142,143,127,144,111,92,145,146,147,148,149,150,151],"skills gateway","gateway","task","loads","Bash","node","specialized","instructions","catalog","use","router","as",{"skillNo":153,"name":154,"nameZh":17,"description":155,"descriptionZh":17,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":43},"01M6M2PYJJQKMWGX7XT7ZJK0H3","decision-log","Record, list, show and supersede architecture decisions that persist across sessions in the shared agent infra state store. Use when the user says \"record this decision\", \"log an ADR\", \"what did we decide about\", \"list decisions\", or \"supersede decision\".","https:\u002F\u002Fgithub.com\u002Fdiegopacheco\u002Fai-playground\u002Fblob\u002Fmain\u002Fpocs\u002Fagent-skills-infra-poc\u002Fskills\u002Fdecision-log\u002FSKILL.md",[],[159,160,161,162,163,164,165,166,167,168,149,169,170,171,172,173,174,175,176,177],"decision log","log","decision","persist","architecture","state","adr","decide","decisions","list","show","infra","record","across","shared","store","about","supersede","sessions"]