# Swarm Intelligence

> Swarm Intelligence Skill

- Skill: `alex-tgk/swarm-intelligence` (Agent Skill)
- Install (CLI): `npx skillmds@latest add alex-tgk/swarm-intelligence`
- Raw SKILL.md: https://api.skillmd.com/api/skills/alex-tgk/swarm-intelligence/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: alex-tgk (https://skillmd.com/u/alex-tgk)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/alex-tgk/swarm-intelligence

---

# Swarm Intelligence Skill

Deploy multi-agent swarms with cognitive diversity for complex problem-solving using ruvnet's swarm methodology.

## Skill Overview

This skill enables you to leverage swarm intelligence - coordinating multiple AI agents with different cognitive patterns to solve complex problems through distributed collaboration. Based on ruvnet's swarm methodology, it implements cognitive diversity principles where agents with different thinking styles work together.

## Usage

To activate this skill, simply invoke it when you need multiple perspectives on a complex problem:

```
/swarm
```

Or with a specific task:

```
/swarm analyze the authentication system architecture
```

## What This Skill Does

When activated, the skill will:

1. **Analyze your task** to determine cognitive patterns needed
2. **Decompose the problem** into parallelizable subtasks
3. **Deploy specialized agents** with different thinking styles:
   - **Convergent** (analytical, focused problem-solving)
   - **Divergent** (creative, exploratory ideation)
   - **Lateral** (unconventional, breakthrough thinking)
   - **Systems** (holistic, interconnected analysis)
   - **Critical** (evaluative, questioning)
   - **Abstract** (conceptual, theoretical)
4. **Execute agents in parallel** for efficient processing
5. **Synthesize results** into unified recommendations
6. **Report confidence levels** across cognitive dimensions

## When to Use This Skill

Use swarm intelligence when you need:

- **Multiple perspectives** on architectural decisions
- **Creative + analytical** thinking for feature design
- **Comprehensive analysis** of large codebases
- **Risk assessment** with both optimistic and critical views
- **Innovation** requiring breakthrough thinking
- **Complex debugging** needing various hypotheses
- **Trade-off analysis** benefiting from diverse viewpoints

## Example Use Cases

### Architecture Review
```
/swarm review the microservices architecture for scalability
```
Deploys: Systems Agent + Critical Agent + Abstract Agent + Convergent Agent

### Feature Design
```
/swarm design a real-time collaboration feature
```
Deploys: Divergent Agent + Systems Agent + Convergent Agent + Critical Agent

### Performance Optimization
```
/swarm optimize the database query performance
```
Deploys: Convergent Agents (2) + Lateral Agent + Systems Agent

### Debugging Complex Issues
```
/swarm debug the intermittent authentication failures
```
Deploys: Convergent Agents (2) + Lateral Agent + Systems Agent

## Swarm Patterns

The skill includes pre-configured swarm patterns:

### Pattern 1: Parallel Analysis
**Use for:** Large codebase analysis, multi-component review
**Agents:** 3-5 Convergent + 1 Systems
**Strength:** Comprehensive coverage with synthesis

### Pattern 2: Innovation Swarm
**Use for:** New features, breakthrough solutions
**Agents:** 2 Divergent + 1 Lateral + 1 Critical
**Strength:** Creative ideation with validation

### Pattern 3: Architecture Review
**Use for:** System design validation
**Agents:** Systems + Critical + Abstract + Convergent
**Strength:** Holistic evaluation with detail

### Pattern 4: Full-Spectrum
**Use for:** Critical decisions, complex trade-offs
**Agents:** All 6 cognitive patterns
**Strength:** Maximum cognitive diversity

### Pattern 5: Debugging Swarm
**Use for:** Complex bugs, unknown root causes
**Agents:** 2 Convergent + Lateral + Systems
**Strength:** Multiple hypotheses with impact analysis

## Cognitive Patterns Explained

### Convergent Thinking
**Style:** Analytical, focused, optimization-oriented
**Best for:** Algorithm analysis, performance optimization, data processing
**Output:** Precise solutions, quantitative analysis, step-by-step plans

### Divergent Thinking
**Style:** Creative, exploratory, ideation-focused
**Best for:** Feature brainstorming, UX design, alternative approaches
**Output:** Multiple options, creative solutions, novel ideas

### Lateral Thinking
**Style:** Unconventional, paradigm-breaking, pattern-disrupting
**Best for:** Stuck problems, innovation challenges, rethinking assumptions
**Output:** Breakthrough insights, unconventional solutions, new paradigms

### Systems Thinking
**Style:** Holistic, big-picture, interconnection-focused
**Best for:** Architecture, impact analysis, integration planning
**Output:** System maps, ripple effect analysis, integration strategies

### Critical Thinking
**Style:** Evaluative, questioning, risk-aware
**Best for:** Code review, security analysis, validation
**Output:** Risk assessments, flaw identification, challenge assumptions

### Abstract Thinking
**Style:** Conceptual, theoretical, pattern-oriented
**Best for:** API design, framework selection, design patterns
**Output:** Theoretical frameworks, pattern recommendations, abstractions

## How It Works

### 1. Task Analysis
The skill analyzes your request to determine:
- Complexity level (simple → critical)
- Required cognitive patterns
- Subtask decomposition
- Expected synthesis approach

### 2. Agent Deployment
Based on the analysis, the skill:
- Selects appropriate swarm pattern
- Configures each agent's specific task
- Launches agents in parallel
- Monitors execution

### 3. Result Synthesis
After agent execution, the skill:
- Identifies convergent findings (where agents agree)
- Explores divergent insights (unique perspectives)
- Resolves conflicts between agents
- Creates unified recommendations
- Assesses confidence levels

### 4. Output Delivery
You receive:
- **Synthesis Report** with integrated findings
- **Convergent Findings** (high-confidence areas)
- **Divergent Insights** (unique perspectives)
- **Confidence Assessment** by cognitive dimension
- **Recommendations** with rationale

## Configuration Options

Customize swarm behavior with options:

```
/swarm --pattern=innovation design new feature
```

Available patterns:
- `parallel-analysis` - Multi-component analysis
- `innovation` - Creative breakthrough
- `architecture` - System design review
- `full-spectrum` - All cognitive patterns
- `debugging` - Bug investigation
- `custom` - Specify agents manually

Specify agent count:
```
/swarm --agents=5 analyze codebase
```

Select specific cognitive patterns:
```
/swarm --cognitive=convergent,divergent,critical review PR
```

## Integration with Development Workflow

### Code Review
```
/swarm review this pull request
```
Automatic deployment: Critical + Systems agents

### Feature Planning
```
/swarm plan user notification system
```
Automatic deployment: Full-spectrum swarm

### Refactoring
```
/swarm refactor the authentication module
```
Automatic deployment: Architecture review pattern

### Performance
```
/swarm optimize rendering performance
```
Automatic deployment: Convergent + Lateral + Systems

## Best Practices

### 1. Match Complexity to Swarm Size
- Simple tasks: 2-3 agents
- Medium tasks: 3-5 agents
- Complex tasks: 5-8 agents
- Critical decisions: 6+ agents (full spectrum)

### 2. Ensure Cognitive Diversity
- Always have at least 2 different cognitive patterns
- Balance analytical and creative for design tasks
- Include Systems agent for architectural work
- Include Critical agent for production-critical decisions

### 3. Trust the Synthesis
- Disagreements reveal important trade-offs
- Convergence indicates robust solutions
- Unique insights from one agent may be breakthrough
- Low confidence warrants deeper investigation

### 4. Iterate When Needed
- Deploy follow-up swarms for unclear areas
- Use specialized swarms for deep-dives
- Meta-swarms for extremely complex tasks

## Limitations

- **Token Cost**: Swarms use significant tokens; optimize size
- **Not for Simple Tasks**: Single-agent work is more efficient for straightforward tasks
- **Synthesis Quality**: Depends on clear task definition
- **Coordination Overhead**: Very large swarms (>8 agents) have diminishing returns

## Output Format

Swarm outputs follow this structure:

```markdown
## Swarm Analysis: [Task Name]

### Task Breakdown
- Objective: [Goal]
- Cognitive Patterns: [List]
- Agents Deployed: [Count]

### Agent Reports
**Convergent Agent:**
[Findings]

**Divergent Agent:**
[Findings]

[... other agents ...]

### Synthesis Report

#### Convergent Findings
Areas where agents strongly agree:
1. [Finding with high confidence]
2. [Finding with high confidence]

#### Divergent Insights
Unique perspectives from different cognitive patterns:
1. [Insight from Agent X]
2. [Insight from Agent Y]

#### Conflict Resolution
Where agents disagreed and how we resolved:
1. [Conflict] → [Resolution rationale]

#### Unified Recommendation
[Integrated solution drawing from all perspectives]

### Confidence Assessment
- Analytical: [High/Medium/Low]
- Creative: [High/Medium/Low]
- Systems: [High/Medium/Low]
- Critical: [High/Medium/Low]

### Next Steps
[Recommended actions or follow-up swarms]
```

## Advanced Features

### Adaptive Swarm Intelligence
The skill learns from swarm performance:
- Tracks successful agent combinations
- Identifies cognitive patterns that provide breakthroughs
- Optimizes swarm size based on task complexity

### Meta-Swarm Coordination
For extremely complex tasks:
1. Planning swarm → determines approach
2. Execution swarms → parallel implementation
3. Synthesis swarm → integrates all results

### Hive-Mind Pattern Recognition
Identifies patterns across swarm executions:
- Common convergence points (robust solutions)
- Frequent divergence areas (complex trade-offs)
- Cognitive blind spots to watch for

## Examples

### Example 1: Feature Design Swarm

**Input:**
```
/swarm design a user notification system
```

**Output:**
```markdown
## Swarm Analysis: User Notification System Design

### Agent Deployments
- Divergent Agent: Brainstorm notification types and UX patterns
- Systems Agent: Analyze integration with existing architecture
- Convergent Agent: Design data model and delivery mechanisms
- Critical Agent: Identify risks and failure modes
- Abstract Agent: Recommend design patterns and abstractions

### Synthesis Report

#### Convergent Findings
1. Push notifications + email + in-app required (all agents agreed)
2. Queue-based architecture for reliability (convergent + systems)
3. User preference management essential (divergent + critical)

#### Divergent Insights
1. Divergent: Gamification with notification badges
2. Lateral: ML-based notification timing optimization
3. Abstract: Event sourcing pattern for audit trail

#### Unified Recommendation
Implement queue-based notification system with:
- Multi-channel delivery (push/email/in-app)
- User preference center with granular controls
- Event sourcing for audit trail
- Future: ML-based timing optimization (Phase 2)

#### Confidence: High
All agents converged on core architecture. Divergent insights
provide clear roadmap for future enhancements.
```

### Example 2: Performance Optimization Swarm

**Input:**
```
/swarm optimize slow database queries
```

**Output:**
```markdown
## Swarm Analysis: Database Query Optimization

### Agent Deployments
- Convergent Agent A: Profile queries and identify bottlenecks
- Convergent Agent B: Research optimization techniques
- Lateral Agent: Propose unconventional optimization approaches
- Systems Agent: Assess optimization impact on architecture

### Synthesis Report

#### Convergent Findings
1. N+1 query problem in user dashboard (both convergent agents)
2. Missing indexes on frequently queried columns
3. Inefficient ORM-generated queries

#### Divergent Insights
1. Lateral: Materialized views for complex aggregations
2. Lateral: Read replicas with eventual consistency
3. Systems: Caching layer to reduce database load

#### Unified Recommendation
1. Immediate: Add missing indexes, fix N+1 queries (2-5x improvement)
2. Short-term: Implement materialized views (10x for aggregations)
3. Medium-term: Add Redis caching layer (reduce DB load 60%)
4. Long-term: Read replicas for horizontal scaling

#### Confidence: Very High
Convergent agents identified clear bottlenecks. Lateral agent
provided progressive enhancement path. Systems agent validated
architectural compatibility.
```

## Tips for Success

1. **Be specific** - "review auth system" is better than "review code"
2. **State constraints** - Mention budget, time, compatibility needs
3. **Indicate priorities** - What matters most: speed, quality, cost?
4. **Request patterns** - Ask for specific swarm patterns when you know what you need
5. **Iterate** - Use follow-up swarms to dive deeper into specific areas

## Skill Composition

This skill works well with:
- **SPARC Skill** - Use swarms within SPARC phases
- **Code Review Skills** - Enhanced review with multiple perspectives
- **Architecture Skills** - Swarm-based architecture decisions
- **Debugging Skills** - Multi-hypothesis bug investigation

## Meta Information

**Skill Type:** Orchestration / Multi-Agent Coordination
**Based on:** ruvnet's Swarm Methodology
**Best for:** Complex, multi-faceted problems
**Token Usage:** Medium to High (scales with agent count)
**Execution:** Parallel agent deployment
**Output Quality:** High (due to cognitive diversity)

---

*Invoke this skill whenever you need the wisdom of crowds - distributed AI intelligence working together to solve complex problems through cognitive diversity.*

