Fabric AI CLI Tool by Daniel Miessler: Complete Guide
Fabric is an open-source command-line tool created by security researcher and technologist Daniel Miessler that makes AI capabilities accessible directly from your terminal. The core idea is elegant: instead of writing custom prompts for every task, Fabric provides a curated library of patterns — carefully engineered system prompts for specific use cases. Pipe text to Fabric, pick a pattern, and get structured, useful output.
What Is Fabric?
Fabric’s philosophy is to augment human thinking by making LLM capabilities as frictionless as using standard Unix tools. It integrates seamlessly into shell pipelines:
# Summarize a YouTube video
fabric -y "https://youtube.com/watch?v=..." --pattern summarize
# Extract wisdom from an article you're reading
pbpaste | fabric --pattern extract_wisdom
# Analyze a piece of code
cat mycode.py | fabric --pattern explain_code
# Create a mind map structure from a document
cat report.pdf | fabric --pattern create_markmap
This Unix-native design means Fabric works with any text source: clipboard, files, command output, or any other data you can pipe.
Installation
Fabric is primarily distributed as a Go binary, with a Python pip package also available.
Method 1: Go Binary (Recommended)
# Requires Go 1.21+
go install github.com/danielmiessler/fabric@latest
# Verify installation
fabric --version
If you don’t have Go installed:
# macOS
brew install go
go install github.com/danielmiessler/fabric@latest
# Linux (Ubuntu/Debian)
sudo apt install golang-go
go install github.com/danielmiessler/fabric@latest
The binary ends up in ~/go/bin/fabric. Add ~/go/bin to your PATH:
echo 'export PATH="$PATH:$HOME/go/bin"' >> ~/.bashrc
source ~/.bashrc
Method 2: Python pip
pip install fabric-ai
Note: The pip version may lag behind the Go version in features. The Go binary is preferred.
Initial Setup
On first run, Fabric launches an interactive setup wizard:
fabric --setup
This will prompt you to:
- Enter your OpenAI, Anthropic, or other API key
- Set a default model (e.g.,
gpt-4o,claude-opus-4-5) - Configure YouTube transcript API access (optional)
Configuration is stored in ~/.config/fabric/.env.
The Patterns Library
Fabric ships with dozens of pre-built patterns, all stored as markdown files containing system prompts. Browse them at the Fabric GitHub repo.
Essential Patterns
summarize — Create a clean summary with key points:
cat article.txt | fabric --pattern summarize
extract_wisdom — Extract ideas, quotes, facts, and recommendations from content:
# Perfect for long articles, podcast transcripts, or lectures
cat transcript.txt | fabric --pattern extract_wisdom
Output format for extract_wisdom:
SUMMARY:
[2-3 sentence summary]
IDEAS:
- [key idea 1]
- [key idea 2]
QUOTES:
- "[notable quote]"
FACTS:
- [interesting fact]
RECOMMENDATIONS:
- [actionable recommendation]
explain_code — Get a plain-English explanation of any code:
cat complex_function.py | fabric --pattern explain_code
find_hidden_message — Analyze persuasion techniques in writing:
cat political_speech.txt | fabric --pattern find_hidden_message
create_markmap — Generate a hierarchical mind map in Markmap format:
cat book_notes.txt | fabric --pattern create_markmap > mindmap.md
write_essay — Write a well-structured essay from notes or an outline:
echo "Topic: The ethics of AI in hiring decisions" | fabric --pattern write_essay
analyze_claims — Evaluate arguments and rate their validity:
cat opinion_piece.txt | fabric --pattern analyze_claims
create_quiz — Generate comprehension questions from educational content:
cat lecture_notes.txt | fabric --pattern create_quiz
YouTube Transcript Analysis
One of Fabric’s killer features is its built-in YouTube transcript integration. Instead of copying transcripts manually, Fabric can fetch them automatically:
# Summarize a YouTube video
fabric -y "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --pattern summarize
# Extract wisdom from a long lecture or conference talk
fabric -y "https://www.youtube.com/watch?v=..." --pattern extract_wisdom
# Create study notes from an educational video
fabric -y "https://www.youtube.com/watch?v=..." --pattern create_study_guide
This requires yt-dlp and internet access. Fabric fetches the transcript (via auto-generated or uploaded captions) and pipes it through the pattern.
# Install yt-dlp if not present
pip install yt-dlp
Switching Models
Use the --model flag to override the default model for a specific call:
# Use a cheaper model for simple summaries
cat short_article.txt | fabric --pattern summarize --model gpt-4o-mini
# Use Claude Opus for deep analysis
cat complex_paper.txt | fabric --pattern extract_wisdom --model claude-opus-4-5
# Use a local Ollama model (no API costs)
cat notes.txt | fabric --pattern summarize --model ollama:llama3.1:8b
Creating Custom Patterns
Creating your own pattern is straightforward — it’s just a markdown file with a system prompt.
Pattern Structure
# Create a new pattern directory
mkdir -p ~/.config/fabric/patterns/my_pattern
# Create the system prompt file
cat > ~/.config/fabric/patterns/my_pattern/system.md << 'EOF'
# IDENTITY and PURPOSE
You are an expert at analyzing job postings and extracting key requirements.
# STEPS
1. Read the job posting carefully
2. Identify the must-have technical skills
3. Identify the nice-to-have skills
4. Estimate the experience level required
5. Identify any red flags or concerns
# OUTPUT SECTIONS
## REQUIRED SKILLS
[bullet list of hard requirements]
## PREFERRED SKILLS
[bullet list of nice-to-haves]
## EXPERIENCE LEVEL
[junior/mid/senior and reasoning]
## RED FLAGS
[any concerns about the posting]
# OUTPUT INSTRUCTIONS
- Be specific and use the exact technologies mentioned
- Don't add skills not mentioned in the posting
- Keep each point concise (max 10 words)
EOF
Now use it like any built-in pattern:
pbpaste | fabric --pattern my_pattern
Sharing Patterns
Patterns are just markdown files, so sharing is trivial:
# Export a pattern to share
cat ~/.config/fabric/patterns/my_pattern/system.md
# Import someone else's pattern
mkdir -p ~/.config/fabric/patterns/their_pattern
curl -o ~/.config/fabric/patterns/their_pattern/system.md "https://..."
Practical Shell Workflows
The real power of Fabric is in chaining it with other Unix tools:
# Daily reading digest: process multiple articles
for url in $(cat reading_list.txt); do
curl -s "$url" | fabric --pattern extract_wisdom >> daily_digest.md
done
# Analyze all Python files in a project for potential issues
find . -name "*.py" -exec sh -c 'echo "=== {} ===" && cat "{}" | fabric --pattern find_logical_fallacies' \;
# Transcribe a local audio file and summarize it
# (requires whisper for transcription)
whisper meeting.mp3 --output_format txt
cat meeting.txt | fabric --pattern summarize
# Get wisdom from your clipboard
alias wisdom='pbpaste | fabric --pattern extract_wisdom'
Choosing the Right Pattern
| Task | Pattern |
|---|---|
| Quick summary | summarize |
| Deep learning from content | extract_wisdom |
| Code understanding | explain_code |
| Mind map creation | create_markmap |
| Essay writing | write_essay |
| Persuasion analysis | find_hidden_message |
| Study preparation | create_quiz |
| Argument evaluation | analyze_claims |
| Security analysis | analyze_threat_report |
Keeping Fabric Updated
# Update to the latest version
go install github.com/danielmiessler/fabric@latest
# Update the patterns library
fabric --update
Fabric represents a practical, Unix-philosophy approach to AI integration. It’s not trying to be an all-in-one AI app — it’s a sharp tool that does one thing extremely well: make LLM-powered text analysis a natural part of terminal workflows. For developers, writers, researchers, and anyone who spends time at the command line, it’s well worth adding to your toolkit.