fabric
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFabric
Fabric
Fabric is an open-source AI prompt orchestration framework by Daniel Miessler. It provides a library of reusable AI prompts called Patterns — each designed for a specific real-world task — wired into a simple Unix pipeline with stdin/stdout.
Fabric是由Daniel Miessler开发的开源AI提示词编排框架。它提供了一套名为Patterns的可复用AI提示词库——每个Pattern都针对特定的实际任务设计——并通过简单的Unix标准输入/输出管道实现工作流。
When to use this skill
何时使用该工具
- Summarize or extract insights from YouTube videos, articles, or documents
- Apply any of 250+ pre-built AI patterns to content via Unix piping
- Route different patterns to different AI providers (OpenAI, Claude, Gemini, etc.)
- Create custom patterns for repeatable AI workflows
- Run Fabric as a REST API server for integration with other tools
- Process command output, files, or clipboard content through AI patterns
- Use as an AI agent utility — pipe any tool output through patterns for intelligent summarization
- 对YouTube视频、文章或文档进行总结或提取洞察
- 通过Unix管道将250+预构建AI Pattern应用于内容
- 为不同Pattern分配不同的AI服务商(OpenAI、Claude、Gemini等)
- 为可重复的AI工作流创建自定义Pattern
- 将Fabric作为REST API服务器运行,以便与其他工具集成
- 通过AI Pattern处理命令输出、文件或剪贴板内容
- 作为AI Agent实用工具使用——将任意工具输出通过Pattern进行智能总结
Instructions
使用说明
Step 1: Install Fabric
步骤1:安装Fabric
bash
undefinedbash
undefinedmacOS/Linux (one-liner)
macOS/Linux (one-liner)
macOS via Homebrew
macOS via Homebrew
brew install fabric-ai
brew install fabric-ai
Windows
Windows
winget install danielmiessler.Fabric
winget install danielmiessler.Fabric
After install — configure API keys and default model
After install — configure API keys and default model
fabric --setup
undefinedfabric --setup
undefinedStep 2: Learn the core pipeline workflow
步骤2:了解核心管道工作流
Fabric works as a Unix pipe. Feed content through stdin and specify a pattern:
bash
undefinedFabric以Unix管道方式运行。通过标准输入传入内容并指定Pattern:
bash
undefinedSummarize a file
总结文件内容
cat article.txt | fabric -p summarize
cat article.txt | fabric -p summarize
Stream output in real time
实时流式输出结果
cat document.txt | fabric -p extract_wisdom --stream
cat document.txt | fabric -p extract_wisdom --stream
Pipe any command output through a pattern
将任意命令输出通过Pattern处理
git log --oneline -20 | fabric -p summarize
git log --oneline -20 | fabric -p summarize
Process clipboard (macOS)
处理剪贴板内容(macOS)
pbpaste | fabric -p summarize
pbpaste | fabric -p summarize
Pipe from curl
通过curl获取内容并处理
curl -s https://example.com/article | fabric -p summarize
undefinedcurl -s https://example.com/article | fabric -p summarize
undefinedStep 3: Discover patterns
步骤3:探索Pattern
bash
undefinedbash
undefinedList all available patterns
列出所有可用Pattern
fabric -l
fabric -l
Update patterns from the repository
从仓库更新Pattern
fabric -u
fabric -u
Search patterns by keyword
通过关键词搜索Pattern
fabric -l | grep summary
fabric -l | grep code
fabric -l | grep security
Key patterns:
| Pattern | Purpose |
|---------|---------|
| `summarize` | Summarize any content into key points |
| `extract_wisdom` | Extract insights, quotes, habits, and lessons |
| `analyze_paper` | Break down academic papers into actionable insights |
| `explain_code` | Explain code in plain language |
| `write_essay` | Write essays from a topic or rough notes |
| `clean_text` | Remove noise and formatting from raw text |
| `analyze_claims` | Fact-check and assess credibility of claims |
| `create_summary` | Create a structured, markdown summary |
| `rate_content` | Rate and score content quality |
| `label_and_rate` | Categorize and score content |
| `improve_writing` | Polish and improve text clarity |
| `create_tags` | Generate relevant tags for content |
| `ask_secure_by_design` | Review code or systems for security issues |
| `capture_thinkers_work` | Extract the core ideas of a thinker or author |
| `create_investigation_visualization` | Create a visual map of complex investigations |fabric -l | grep summary
fabric -l | grep code
fabric -l | grep security
关键Pattern:
| Pattern | 用途 |
|---------|---------|
| `summarize` | 将任意内容总结为要点 |
| `extract_wisdom` | 提取洞察、引用、习惯和经验教训 |
| `analyze_paper` | 将学术论文拆解为可落地的洞察 |
| `explain_code` | 用通俗语言解释代码 |
| `write_essay` | 根据主题或草稿撰写文章 |
| `clean_text` | 去除原始文本中的噪音和格式 |
| `analyze_claims` | 事实核查并评估主张的可信度 |
| `create_summary` | 创建结构化的Markdown格式总结 |
| `rate_content` | 对内容质量进行评分 |
| `label_and_rate` | 对内容进行分类和评分 |
| `improve_writing` | 润色文本并提升清晰度 |
| `create_tags` | 为内容生成相关标签 |
| `ask_secure_by_design` | 审查代码或系统的安全问题 |
| `capture_thinkers_work` | 提取思想家或作者的核心观点 |
| `create_investigation_visualization` | 为复杂调查创建可视化图谱 |Step 4: Process YouTube videos
步骤4:处理YouTube视频
bash
undefinedbash
undefinedSummarize a YouTube video
总结YouTube视频
fabric -y "https://youtube.com/watch?v=VIDEO_ID" -p summarize
fabric -y "https://youtube.com/watch?v=VIDEO_ID" -p summarize
Extract key insights from a video
提取视频中的关键洞察
fabric -y "https://youtube.com/watch?v=VIDEO_ID" -p extract_wisdom
fabric -y "https://youtube.com/watch?v=VIDEO_ID" -p extract_wisdom
Get transcript only (no pattern applied)
仅获取字幕(不应用Pattern)
fabric -y "https://youtube.com/watch?v=VIDEO_ID" --transcript
fabric -y "https://youtube.com/watch?v=VIDEO_ID" --transcript
Transcript with timestamps
获取带时间戳的字幕
fabric -y "https://youtube.com/watch?v=VIDEO_ID" --transcript-with-timestamps
undefinedfabric -y "https://youtube.com/watch?v=VIDEO_ID" --transcript-with-timestamps
undefinedStep 5: Create custom patterns
步骤5:创建自定义Pattern
Each pattern is a directory with a file inside . The body should follow this structure:
system.md~/.config/fabric/patterns/bash
mkdir -p ~/.config/fabric/patterns/my-pattern
cat > ~/.config/fabric/patterns/my-pattern/system.md << 'EOF'每个Pattern都是目录下的一个子目录,其中包含文件。文件内容需遵循以下结构:
~/.config/fabric/patterns/system.mdbash
mkdir -p ~/.config/fabric/patterns/my-pattern
cat > ~/.config/fabric/patterns/my-pattern/system.md << 'EOF'IDENTITY AND PURPOSE
IDENTITY AND PURPOSE
You are an expert at [task]. Your job is to [specific goal].
Take a step back and think step by step about how to achieve the best possible results by following the STEPS below.
You are an expert at [task]. Your job is to [specific goal].
Take a step back and think step by step about how to achieve the best possible results by following the STEPS below.
STEPS
STEPS
- [Step 1]
- [Step 2]
- [Step 1]
- [Step 2]
OUTPUT INSTRUCTIONS
OUTPUT INSTRUCTIONS
- Only output Markdown.
- [Format instruction 2]
- Do not give warnings or notes; only output the requested sections.
- Only output Markdown.
- [Format instruction 2]
- Do not give warnings or notes; only output the requested sections.
INPUT
INPUT
INPUT:
EOF
Use it immediately:
```bash
echo "input text" | fabric -p my-pattern
cat file.txt | fabric -p my-pattern --streamINPUT:
EOF
创建后即可立即使用:
```bash
echo "input text" | fabric -p my-pattern
cat file.txt | fabric -p my-pattern --streamStep 6: Multi-provider routing and advanced usage
步骤6:多服务商路由与高级用法
bash
undefinedbash
undefinedRun as REST API server (port 8080 by default)
以REST API服务器模式运行(默认端口8080)
fabric --serve
fabric --serve
Use web search capability
使用网页搜索功能
fabric -p analyze_claims --search "claim to verify"
fabric -p analyze_claims --search "claim to verify"
Per-pattern model routing in ~/.config/fabric/.env
在~/.config/fabric/.env中为特定Pattern指定模型
FABRIC_MODEL_PATTERN_SUMMARIZE=anthropic|claude-opus-4-5
FABRIC_MODEL_PATTERN_EXTRACT_WISDOM=openai|gpt-4o
FABRIC_MODEL_PATTERN_EXPLAIN_CODE=google|gemini-2.0-flash
FABRIC_MODEL_PATTERN_SUMMARIZE=anthropic|claude-opus-4-5
FABRIC_MODEL_PATTERN_EXTRACT_WISDOM=openai|gpt-4o
FABRIC_MODEL_PATTERN_EXPLAIN_CODE=google|gemini-2.0-flash
Create shell aliases for frequently used patterns
为常用Pattern创建Shell别名
alias summarize="fabric -p summarize"
alias wisdom="fabric -p extract_wisdom"
alias explain="fabric -p explain_code"
alias summarize="fabric -p summarize"
alias wisdom="fabric -p extract_wisdom"
alias explain="fabric -p explain_code"
Chain patterns
链式调用Pattern
cat paper.txt | fabric -p summarize | fabric -p extract_wisdom
cat paper.txt | fabric -p summarize | fabric -p extract_wisdom
Save output
保存输出结果
cat document.txt | fabric -p extract_wisdom > insights.md
undefinedcat document.txt | fabric -p extract_wisdom > insights.md
undefinedStep 7: Use in AI agent workflows
步骤7:在AI Agent工作流中使用
Fabric is a powerful utility for AI agents — pipe any tool output through patterns for intelligent analysis:
bash
undefinedFabric是AI Agent的强大实用工具——可将任意工具输出通过Pattern进行智能分析:
bash
undefinedAnalyze test failures
分析测试失败结果
npm test 2>&1 | fabric -p analyze_logs
npm test 2>&1 | fabric -p analyze_logs
Summarize git history for a PR description
总结Git历史用于PR描述
git log --oneline origin/main..HEAD | fabric -p create_summary
git log --oneline origin/main..HEAD | fabric -p create_summary
Explain a code diff
解释代码差异
git diff HEAD~1 | fabric -p explain_code
git diff HEAD~1 | fabric -p explain_code
Summarize build errors
总结构建错误
make build 2>&1 | fabric -p summarize
make build 2>&1 | fabric -p summarize
Analyze security vulnerabilities in code
分析代码中的安全漏洞
cat src/auth.py | fabric -p ask_secure_by_design
cat src/auth.py | fabric -p ask_secure_by_design
Process log files
处理日志文件
cat /var/log/app.log | tail -100 | fabric -p analyze_logs
undefinedcat /var/log/app.log | tail -100 | fabric -p analyze_logs
undefinedREST API server mode
REST API服务器模式
Run Fabric as a microservice and call it from other tools:
bash
undefined将Fabric作为微服务运行,供其他工具调用:
bash
undefinedStart server
启动服务器
fabric --serve --port 8080
fabric --serve --port 8080
Call via HTTP
通过HTTP调用
curl -X POST http://localhost:8080/chat
-H "Content-Type: application/json"
-d '{"prompts":[{"userInput":"Summarize this","patternName":"summarize"}]}'
-H "Content-Type: application/json"
-d '{"prompts":[{"userInput":"Summarize this","patternName":"summarize"}]}'
undefinedcurl -X POST http://localhost:8080/chat
-H "Content-Type: application/json"
-d '{"prompts":[{"userInput":"Summarize this","patternName":"summarize"}]}'
-H "Content-Type: application/json"
-d '{"prompts":[{"userInput":"Summarize this","patternName":"summarize"}]}'
undefinedBest practices
最佳实践
- Run before first use and regularly to get the latest community patterns.
fabric -u - Use for long content to see results progressively instead of waiting.
--stream - Create shell aliases () for your most-used patterns.
alias wisdom="fabric -p extract_wisdom" - Use per-pattern model routing to optimize cost vs. quality for each task type.
- Keep custom patterns in — they persist across updates.
~/.config/fabric/patterns/ - For YouTube, transcript extraction works best with videos that have captions enabled.
- Chain patterns with Unix pipes for multi-step processing workflows.
- Follow the IDENTITY → STEPS → OUTPUT INSTRUCTIONS structure when creating custom patterns.
- 首次使用及定期运行以获取最新的社区Pattern。
fabric -u - 处理长内容时使用参数,可逐步查看结果而非等待全部完成。
--stream - 为常用Pattern创建Shell别名(如)。
alias wisdom="fabric -p extract_wisdom" - 使用Pattern专属模型路由,针对不同任务类型优化成本与质量。
- 将自定义Pattern保存在目录下——它们会在更新后保留。
~/.config/fabric/patterns/ - 对于YouTube视频,提取字幕功能在视频开启字幕时效果最佳。
- 通过Unix管道链式调用Pattern,实现多步骤处理工作流。
- 创建自定义Pattern时遵循“身份与目标 → 步骤 → 输出说明”的结构。