Agent skill
streaming-output-mcp
Stream structured content to persistent SQLite storage with automatic session break recovery. Core principle: The content IS the state. Every stream_write is automatically persistent. Supports multi-format export (Markdown, HTML, JSON, YAML, CSV, Text) and 7 document templates. Commands: /stream-init, /stream-status, /stream-read, /stream-write, /stream-export. ALWAYS call stream_status after session breaks to check for resume_from and preserved_context.
Install this agent skill to your Project
npx add-skill https://github.com/ddunnock/claude-plugins/tree/main/skills/streaming-output-mcp
SKILL.md
Streaming Output MCP Skill
Agent instructions for using the streaming-output MCP to produce persistent, recoverable output.
Overview
This skill enables you to stream structured content to persistent SQLite storage with automatic session break recovery. Use it when producing reports, analysis results, task lists, or any structured output that needs to survive session interruptions.
Core Principle: The content IS the state. Every stream_write is automatically persistent.
Version 2.0 Features:
- 7 pre-built document templates (security-audit, code-review, sprint-retrospective, etc.)
- 6 export formats (Markdown, HTML, JSON, YAML, CSV, Plain Text)
- Document finalization with completion verification
- File export with path expansion
First Action Protocol
CRITICAL: Always follow this protocol at the start of any streaming task.
IF you have a document_id (from previous session or user):
1. Call stream_status(document_id) FIRST
2. Check for resume_from field
3. If preserved_context exists, READ IT and CONTINUE from that point
4. Do NOT restart blocks from scratch
IF you don't have a document_id:
1. Call stream_start() to create new document
2. Optionally use a template for structure
3. Begin writing blocks in sequence
Why This Matters
Session breaks happen. When they do:
- The MCP knows which blocks are incomplete
- Partial content may be preserved in
preserved_context - You should CONTINUE from the interruption point, not restart
Document Templates
Use templates for common document types with pre-defined structure:
| Template | Use Case | Pre-declared Blocks |
|---|---|---|
security-audit |
Security assessments | executive_summary, scope, findings, recommendations |
code-review |
PR/code reviews | summary, critical_issues, suggestions, approval_status |
sprint-retrospective |
Sprint retros | what_went_well, improvements, action_items |
technical-spec |
Technical specs | overview, requirements, architecture, implementation_plan |
adr |
Architecture decisions | context, decision, consequences, alternatives |
research-report |
Research docs | abstract, methodology, findings, conclusions |
task-list |
Task tracking | No pre-declared blocks (dynamic) |
To use a template:
{
"title": "Q4 Security Audit",
"template": "security-audit"
}
List available templates:
stream_templates({})
Tool Reference
stream_start
Initialize a new document.
// Minimal
{"title": "Code Review Report"}
// With template
{
"title": "Security Assessment",
"template": "security-audit"
}
// Custom structure
{
"title": "Custom Report",
"schema_type": "report",
"blocks": [
{"key": "summary", "type": "section"},
{"key": "findings", "type": "finding"}
]
}
stream_write
Write content to a block. Each write is atomic and SHA-256 verified.
{
"document_id": "doc_...",
"block_key": "summary",
"content": {
"title": "Executive Summary",
"body": "This audit identified 3 critical vulnerabilities..."
},
"block_type": "section"
}
Block Types:
| Type | When to Use | Required Fields |
|---|---|---|
section |
Narrative content | title, body |
task |
Actionable items | id, title, status |
finding |
Analysis results | id, severity, description |
decision |
ADR-style decisions | id, title, decision, rationale |
raw |
Arbitrary JSON | content |
Content Schemas:
// section
{"title": "...", "body": "..."}
// task
{"id": "T-001", "title": "...", "status": "pending|in_progress|complete", "assignee": "...", "notes": "..."}
// finding
{"id": "F-001", "severity": "critical|high|medium|low|info", "description": "...", "evidence": "...", "recommendation": "..."}
// decision
{"id": "ADR-001", "title": "...", "context": "...", "decision": "...", "rationale": "...", "alternatives": [...]}
stream_status
Check document state. Always call after session breaks.
// List recent documents
{}
// Check specific document with verification
{"document_id": "doc_...", "verify": true}
Response Fields:
{
"resume_from": "findings", // ← Start here
"preserved_context": {
"block_key": "findings",
"partial_content": "Found 3 SQL injection..."
},
"summary": {
"total": 5,
"complete": 2,
"pending": 3
}
}
stream_read
Read document content in various formats.
// As JSON
{"document_id": "doc_...", "format": "json"}
// As Markdown
{"document_id": "doc_...", "format": "markdown"}
// Specific blocks
{"document_id": "doc_...", "format": "markdown", "blocks": ["summary", "recommendations"]}
stream_export (NEW)
Export document to a file.
{
"document_id": "doc_...",
"format": "html",
"output_path": "~/Documents/report.html"
}
Supported Formats:
markdown- Clean Markdown with headershtml- Styled HTML with embedded CSSjson- Full structured datatext- Plain text without formattingyaml- YAML representationcsv- Tabular format (best for tasks/findings)
stream_finalize (NEW)
Mark document as complete after all blocks are written.
{"document_id": "doc_..."}
Returns verification of completion status.
stream_delete (NEW)
Delete a document and all its blocks.
{"document_id": "doc_..."}
stream_templates (NEW)
List available document templates.
{} // Returns all 7 templates with their structure
Recovery Workflow
Scenario 1: Session Break with Preserved Context
1. Call stream_status(document_id)
2. Response: resume_from: "analysis", preserved_context: "The security analysis..."
3. Action: Read preserved_context, CONTINUE from that point
4. Call stream_write("analysis", {complete_content}, repair=true)
Scenario 2: Session Break without Preserved Context
1. Call stream_status(document_id)
2. Response: resume_from: "analysis", no preserved_context
3. Action: Check complete blocks, re-analyze source, write fresh
Scenario 3: User Wants Previous Work
User: "Continue the security report from yesterday"
1. stream_status() - list recent documents
2. Identify by title/date
3. stream_status(document_id) - get details
4. Follow resume_from to continue
Anti-Patterns
DO NOT:
- Skip status check after session break
- Restart blocks from scratch when preserved_context exists
- Write multiple blocks without status checks
- Use wrong content structure for block type
- Forget
repair=truewhen continuing interrupted blocks
Workflow Examples
Example 1: Using a Template
1. stream_start(title="Q4 Security Audit", template="security-audit")
→ Creates doc with: executive_summary, scope, findings, recommendations
2. stream_write(doc_xxx, "executive_summary", {title: "...", body: "..."})
3. stream_write(doc_xxx, "scope", {title: "...", body: "..."})
4. stream_write(doc_xxx, "findings", {severity: "critical", ...})
5. stream_write(doc_xxx, "recommendations", {title: "...", body: "..."})
6. stream_finalize(doc_xxx)
→ Document finalized
7. stream_export(doc_xxx, format="html", output_path="~/reports/q4-audit.html")
→ Exported to file
Example 2: Resume After Interruption
User: "Continue the security report"
1. stream_status()
→ Lists recent docs, find "Security Audit"
2. stream_status("doc_xxx")
→ resume_from: "findings", preserved_context: {partial: "Scanned 45/120..."}
3. Read preserved_context, note endpoint 45
4. Continue from endpoint 46
5. stream_write(doc_xxx, "findings", {complete}, repair=true)
Example 3: Multi-Format Export
1. Complete document with stream_write calls
2. stream_read(doc_xxx, format="markdown")
→ Preview in chat
3. stream_export(doc_xxx, format="html", output_path="~/report.html")
→ HTML file for sharing
4. stream_export(doc_xxx, format="json", output_path="~/backup.json")
→ JSON backup for archival
Slash Commands
| Command | Purpose |
|---|---|
/stream-init |
Initialize a new document |
/stream-status |
Check document status and resume point |
/stream-read |
Read document content |
/stream-write |
Write content to a block |
/stream-export |
Export document to file |
Database Location
Documents are stored in: ~/.claude/streaming-output/streams.db
This SQLite database persists across sessions.
Export Format Examples
Markdown Output
# Document Title
*Status: finalized | Created: 2026-01-14*
## Executive Summary
Content here...
## Findings
- **[CRITICAL]** Finding 1
- **[HIGH]** Finding 2
HTML Output
Styled HTML with:
- Embedded CSS (no external dependencies)
- Severity badges for findings
- Status indicators
- Print-friendly formatting
CSV Output
block_key,type,title,severity,status
finding_1,finding,SQL Injection,critical,
task_1,task,Fix auth,in_progress,
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
streaming-output
Stream long-form content to markdown files with resume capability. Writes content incrementally with section markers, enabling recovery if context limits are hit. Use when generating long documents (over 1000 lines), B-SPEC or specification writing, multi-section reports, any task where context compaction may occur mid-generation, or when user explicitly requests streaming output. Commands: init, write, status, resume, finalize, repair.
fishbone-diagram
Create comprehensive Fishbone (Ishikawa/Cause-and-Effect) diagrams for structured root cause brainstorming. Guides teams through problem definition, category selection (6Ms, 8Ps, 4Ss, or custom), cause identification, sub-cause drilling, prioritization via multi-voting, and 5 Whys integration. Generates visual SVG diagrams and professional HTML reports. Use when brainstorming potential causes, conducting root cause analysis, facilitating quality improvement sessions, analyzing defects or failures, structuring team problem-solving, or when user mentions "fishbone", "Ishikawa", "cause and effect diagram", "6Ms", "cause analysis", or "brainstorming causes".
fmea-analysis
Conduct Failure Mode and Effects Analysis (FMEA) for systematic identification and risk assessment of potential failures in designs, processes, or systems. Supports DFMEA (Design), PFMEA (Process), and FMEA-MSR (Monitoring & System Response). Uses AIAG-VDA 7-step methodology with Action Priority (AP) risk assessment replacing traditional RPN. Use when analyzing product designs for potential failures, evaluating manufacturing process risks, conducting proactive risk assessment, preparing for APQP/PPAP submissions, investigating field failures, or when user mentions "FMEA", "failure mode", "DFMEA", "PFMEA", "severity occurrence detection", "RPN", "Action Priority", "design risk analysis", or needs to identify and prioritize potential failure modes with their causes and effects.
problem-definition
Guide RCCA/8D problem definition using 5W2H and IS/IS NOT analysis. Transforms scattered failure data into precise, measurable problem statements that bound investigation scope without embedding cause or solution. Use when defining problems for root cause analysis, writing D2 sections of 8D reports, analyzing nonconformances, investigating failures, or when user mentions problem definition, problem statement, RCCA, 8D, failure analysis, or corrective action.
kepner-tregoe-analysis
Conduct Kepner-Tregoe (KT) Problem Solving and Decision Making (PSDM) analysis using the four rational processes - Situation Appraisal, Problem Analysis, Decision Analysis, and Potential Problem Analysis. Use when performing structured root cause analysis, making complex decisions, evaluating alternatives with weighted criteria, conducting IS/IS NOT specification analysis, anticipating implementation risks, troubleshooting complex issues, or when user mentions "Kepner-Tregoe", "KT method", "IS/IS NOT", "situation appraisal", "decision analysis", "MUSTS and WANTS", "potential problem analysis", or needs systematic problem-solving methodology. Includes specification matrices, decision scoring, quality rubrics, and professional report generation.
requirements-dev
This skill should be used when the user asks to "develop requirements", "formalize needs", "write requirements", "create a specification", "build traceability", "quality check requirements", "INCOSE requirements", "requirements development", "reqdev", or mentions requirements engineering, needs formalization, verification planning, traceability matrix, or systems engineering requirements. Even for casual phrases like "I need to write some reqs" or "let's formalize the needs", trigger this skill.
Didn't find tool you were looking for?