stream-chain
Stream-JSON chaining for multi-agent pipelines, data transformation, and sequential workflows
What this skill does
# Stream-Chain Skill
Execute sophisticated multi-step workflows where each agent's output flows into the next, enabling complex data transformations and sequential processing pipelines.
## Overview
Stream-Chain provides two powerful modes for orchestrating multi-agent workflows:
1. **Custom Chains** (`run`): Execute custom prompt sequences with full control
2. **Predefined Pipelines** (`pipeline`): Use battle-tested workflows for common tasks
Each step in a chain receives the complete output from the previous step, enabling sophisticated multi-agent coordination through streaming data flow.
---
## Quick Start
### Run a Custom Chain
```bash
claude-flow stream-chain run \
"Analyze codebase structure" \
"Identify improvement areas" \
"Generate action plan"
```
### Execute a Pipeline
```bash
claude-flow stream-chain pipeline analysis
```
---
## Custom Chains (`run`)
Execute custom stream chains with your own prompts for maximum flexibility.
### Syntax
```bash
claude-flow stream-chain run <prompt1> <prompt2> [...] [options]
```
**Requirements:**
- Minimum 2 prompts required
- Each prompt becomes a step in the chain
- Output flows sequentially through all steps
### Options
| Option | Description | Default |
|--------|-------------|---------|
| `--verbose` | Show detailed execution information | `false` |
| `--timeout <seconds>` | Timeout per step | `30` |
| `--debug` | Enable debug mode with full logging | `false` |
### How Context Flows
Each step receives the previous output as context:
```
Step 1: "Write a sorting function"
Output: [function implementation]
Step 2 receives:
"Previous step output:
[function implementation]
Next task: Add comprehensive tests"
Step 3 receives:
"Previous steps output:
[function + tests]
Next task: Optimize performance"
```
### Examples
#### Basic Development Chain
```bash
claude-flow stream-chain run \
"Write a user authentication function" \
"Add input validation and error handling" \
"Create unit tests with edge cases"
```
#### Security Audit Workflow
```bash
claude-flow stream-chain run \
"Analyze authentication system for vulnerabilities" \
"Identify and categorize security issues by severity" \
"Propose fixes with implementation priority" \
"Generate security test cases" \
--timeout 45 \
--verbose
```
#### Code Refactoring Chain
```bash
claude-flow stream-chain run \
"Identify code smells in src/ directory" \
"Create refactoring plan with specific changes" \
"Apply refactoring to top 3 priority items" \
"Verify refactored code maintains behavior" \
--debug
```
#### Data Processing Pipeline
```bash
claude-flow stream-chain run \
"Extract data from API responses" \
"Transform data into normalized format" \
"Validate data against schema" \
"Generate data quality report"
```
---
## Predefined Pipelines (`pipeline`)
Execute battle-tested workflows optimized for common development tasks.
### Syntax
```bash
claude-flow stream-chain pipeline <type> [options]
```
### Available Pipelines
#### 1. Analysis Pipeline
Comprehensive codebase analysis and improvement identification.
```bash
claude-flow stream-chain pipeline analysis
```
**Workflow Steps:**
1. **Structure Analysis**: Map directory structure and identify components
2. **Issue Detection**: Find potential improvements and problems
3. **Recommendations**: Generate actionable improvement report
**Use Cases:**
- New codebase onboarding
- Technical debt assessment
- Architecture review
- Code quality audits
#### 2. Refactor Pipeline
Systematic code refactoring with prioritization.
```bash
claude-flow stream-chain pipeline refactor
```
**Workflow Steps:**
1. **Candidate Identification**: Find code needing refactoring
2. **Prioritization**: Create ranked refactoring plan
3. **Implementation**: Provide refactored code for top priorities
**Use Cases:**
- Technical debt reduction
- Code quality improvement
- Legacy code modernization
- Design pattern implementation
#### 3. Test Pipeline
Comprehensive test generation with coverage analysis.
```bash
claude-flow stream-chain pipeline test
```
**Workflow Steps:**
1. **Coverage Analysis**: Identify areas lacking tests
2. **Test Design**: Create test cases for critical functions
3. **Implementation**: Generate unit tests with assertions
**Use Cases:**
- Increasing test coverage
- TDD workflow support
- Regression test creation
- Quality assurance
#### 4. Optimize Pipeline
Performance optimization with profiling and implementation.
```bash
claude-flow stream-chain pipeline optimize
```
**Workflow Steps:**
1. **Profiling**: Identify performance bottlenecks
2. **Strategy**: Analyze and suggest optimization approaches
3. **Implementation**: Provide optimized code
**Use Cases:**
- Performance improvement
- Resource optimization
- Scalability enhancement
- Latency reduction
### Pipeline Options
| Option | Description | Default |
|--------|-------------|---------|
| `--verbose` | Show detailed execution | `false` |
| `--timeout <seconds>` | Timeout per step | `30` |
| `--debug` | Enable debug mode | `false` |
### Pipeline Examples
#### Quick Analysis
```bash
claude-flow stream-chain pipeline analysis
```
#### Extended Refactoring
```bash
claude-flow stream-chain pipeline refactor --timeout 60 --verbose
```
#### Debug Test Generation
```bash
claude-flow stream-chain pipeline test --debug
```
#### Comprehensive Optimization
```bash
claude-flow stream-chain pipeline optimize --timeout 90 --verbose
```
### Pipeline Output
Each pipeline execution provides:
- **Progress**: Step-by-step execution status
- **Results**: Success/failure per step
- **Timing**: Total and per-step execution time
- **Summary**: Consolidated results and recommendations
---
## Custom Pipeline Definitions
Define reusable pipelines in `.claude-flow/config.json`:
### Configuration Format
```json
{
"streamChain": {
"pipelines": {
"security": {
"name": "Security Audit Pipeline",
"description": "Comprehensive security analysis",
"prompts": [
"Scan codebase for security vulnerabilities",
"Categorize issues by severity (critical/high/medium/low)",
"Generate fixes with priority and implementation steps",
"Create security test suite"
],
"timeout": 45
},
"documentation": {
"name": "Documentation Generation Pipeline",
"prompts": [
"Analyze code structure and identify undocumented areas",
"Generate API documentation with examples",
"Create usage guides and tutorials",
"Build architecture diagrams and flow charts"
]
}
}
}
}
```
### Execute Custom Pipeline
```bash
claude-flow stream-chain pipeline security
claude-flow stream-chain pipeline documentation
```
---
## Advanced Use Cases
### Multi-Agent Coordination
Chain different agent types for complex workflows:
```bash
claude-flow stream-chain run \
"Research best practices for API design" \
"Design REST API with discovered patterns" \
"Implement API endpoints with validation" \
"Generate OpenAPI specification" \
"Create integration tests" \
"Write deployment documentation"
```
### Data Transformation Pipeline
Process and transform data through multiple stages:
```bash
claude-flow stream-chain run \
"Extract user data from CSV files" \
"Normalize and validate data format" \
"Enrich data with external API calls" \
"Generate analytics report" \
"Create visualization code"
```
### Code Migration Workflow
Systematic code migration with validation:
```bash
claude-flow stream-chain run \
"Analyze legacy codebase dependencies" \
"Create migration plan with risk assessment" \
"Generate modernized code for high-priority modules" \
"Create migration tests" \
"Document migration steps and rollback procedures"
```
### Quality Assurance Chain
Comprehensive code quality workflow:
```bash
claude-floRelated in workflow
absolute-work
IncludedEnd-to-end, phase-gated software development lifecycle for AI agents. Turns a ticket, task, plan, or migration into a validated design, a dependency-graphed task board, and verified code. Triggers on "build this end-to-end", "plan and build", "break this into tasks", "pick up this ticket", "grill me on this", "run this migration", "absolute-work this", or any multi-step development task. Relentlessly interviews to a shared design, writes a reviewed spec, decomposes into atomic tasks on a persistent markdown board, then peels tasks one safe wave at a time with test-first verification. Handles features, bugs, refactors, greenfield projects, planning breakdowns, and migrations.
absolute-simplify
IncludedAutonomously simplifies code in your working changes or targeted files. Detects staged or unstaged git changes, analyzes for simplification opportunities following clean code and clean architecture principles, applies improvements directly, runs tests to verify nothing broke, and shows a structured summary with reasoning. Triggers on "simplify this", "refactor this", "clean up my changes", "absolute-simplify", "simplify my code", "make this cleaner", "tidy this up", "reduce complexity", "flatten this", "remove dead code", or when code needs clarity improvements, nesting reduction, or redundancy removal. Language-agnostic at base with deep opinions for JS/TS/React, Python, and Go.
sentry-sdk-upgrade
IncludedUpgrade the Sentry JavaScript SDK across major versions. Use when asked to upgrade Sentry, migrate to a newer version, fix deprecated Sentry APIs, or resolve breaking changes after a Sentry version bump.
when-using-advanced-swarm-use-swarm-advanced
IncludedAdvanced swarm patterns with dynamic topology switching and self-organizing behaviors for complex multi-agent coordination
development-workflow
IncludedDetailed development workflow with modular patterns for git, review, testing, and deployment.
project-execution
IncludedExecutes implementation plans with progress tracking, checkpoint validation, and quality gates. Use after planning is complete and tasks are ready to implement.