stream-formatter

LLM streaming output formatter with auto buffer, format correction, sentence break optimization, markdown rendering, improve chat UX

3,891 stars

Best use case

stream-formatter is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

LLM streaming output formatter with auto buffer, format correction, sentence break optimization, markdown rendering, improve chat UX

Teams using stream-formatter should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/stream-formatter/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/ayalili/stream-formatter/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/stream-formatter/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How stream-formatter Compares

Feature / Agentstream-formatterStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

LLM streaming output formatter with auto buffer, format correction, sentence break optimization, markdown rendering, improve chat UX

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# ✨ 流式输出格式化器
## 核心亮点
1. 🚀 **实时流式优化**:边输出边修复,不需要等待大模型返回完成,延迟<10ms
2. 📝 **自动格式修复**:自动修复Markdown格式错误、不完整的代码块、链接、列表等
3. 💬 **智能断句**:按完整句子输出,避免输出半个单词或半句话,大幅提升阅读体验
4. 🚫 **去重处理**:自动去除大模型重复输出的内容,避免混乱

## 🎯 适用场景
- 所有对话类Agent、聊天机器人
- 实时内容生成场景
- Markdown内容流式渲染
- 提升用户交互体验的所有场景

## 📝 参数说明
| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| action | string | 是 | 操作类型:init/process/reset |
| options | object | 否 | 初始化配置项 |
| chunk | string | 否 | process操作必填,大模型返回的流式块 |
| flush | boolean | 否 | process操作可选,是否强制输出所有缓冲区内容 |

## 💡 开箱即用示例
### 基础用法
```typescript
// 初始化
await skills.streamFormatter({ action: "init" });

// 处理流式输出
for await (const chunk of llm.streamResponse) {
  const result = await skills.streamFormatter({
    action: "process",
    chunk: chunk.text
  });
  if (result.output) {
    sendToUser(result.output); // 只输出完整的句子
  }
}

// 最后强制刷新缓冲区
const final = await skills.streamFormatter({
  action: "process",
  chunk: "",
  flush: true
});
if (final.output) {
  sendToUser(final.output);
}
```

### 自定义配置
```typescript
await skills.streamFormatter({
  action: "init",
  options: {
    buffer_size: 20,
    format_markdown: true,
    fix_incomplete_sentences: true
  }
});
```

## 🔧 技术实现说明
- 轻量级缓冲区设计,内存占用<1KB
- 支持中英文双语标点识别,断句准确率95%+
- 内置常见Markdown格式错误修复规则
- 零外部依赖,不影响流式输出性能

Related Skills

wechat-formatter

3891
from openclaw/skills

Render article markdown into WeChat-style HTML as an independent executor. Use when Codex needs公众号排版预览, WeChat HTML output, or a publishable HTML artifact generated from an article markdown draft.

citation-formatter

3891
from openclaw/skills

Use when formatting references for journal submission, converting between citation styles (APA, MLA, Vancouver, Chicago), generating bibliographies for manuscripts, or ensuring consistent reference formatting. Automatically formats citations and bibliographies in 1000+ academic styles. Ensures reference accuracy, completeness, and compliance with journal requirements. Supports batch conversion and integration with reference managers.

MuseStream Skill

3891
from openclaw/skills

AI music generation and streaming. Give the user a shareable player URL — music generates and plays continuously in their browser. All songs are saved to a local library.

amap-maps-streamableHTTP

3891
from openclaw/skills

Auto-generated skill for amap-maps-streamableHTTP tools via OneKey Gateway.

structs-streaming

3891
from openclaw/skills

Connects to the GRASS real-time event system via NATS WebSocket. Use when you need real-time game updates, want to react to events as they happen, need to monitor raids or attacks, watch for player creation, track fleet movements, or build event-driven tools. GRASS is the fastest way to know what's happening in the galaxy.

livestream-script-generator

3891
from openclaw/skills

直播带货脚本生成,话术设计、节奏把控、互动环节、促单技巧。适合直播主播、电商运营、MCN 机构。

---

3891
from openclaw/skills

name: article-factory-wechat

Content & Documentation

humanizer

3891
from openclaw/skills

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.

Content & Documentation

find-skills

3891
from openclaw/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

General Utilities

tavily-search

3891
from openclaw/skills

Use Tavily API for real-time web search and content extraction. Use when: user needs real-time web search results, research, or current information from the web. Requires Tavily API key.

Data & Research

baidu-search

3891
from openclaw/skills

Search the web using Baidu AI Search Engine (BDSE). Use for live information, documentation, or research topics.

Data & Research

agent-autonomy-kit

3891
from openclaw/skills

Stop waiting for prompts. Keep working.

Workflow & Productivity