Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Examples

Real-world examples of using zo in your daily workflow.

Quick Examples

Basic Usage

# Simple question
zo 'What is the difference between TCP and UDP?'
 
# With model selection
zo /sonnet 'Explain Rust lifetimes'
 
# Using CLI flag
zo --model opus 'Complex reasoning task'

Code Review

# Review current changes
git diff | zo 'Review these changes for bugs'
 
# Review specific file
zo @src/main.rs 'Code review with focus on performance'
 
# Multiple files
zo @header.h @impl.c 'Are these in sync?'

Error Debugging

# Build errors
cargo build 2>&1 | zo /sonnet 'Explain these errors and how to fix'
 
# Test failures
npm test 2>&1 | zo 'Why are these tests failing?'
 
# Log analysis
tail -100 error.log | zo 'Find the root cause'

Data Analysis

# CSV analysis
cat sales.csv | zo 'Calculate total revenue by region'
 
# System diagnostics
df -h | zo 'Do I have disk space issues?'

Documentation

# Generate docs
zo @api.rs 'Generate API documentation in markdown'
 
# Explain code
zo @algorithm.py 'Explain this algorithm step by step'
 
# Create README
zo @main.go @types.go 'Generate README with usage examples'

File Output

# Create new files
zo 'Create a Python hello world in !hello.py'
zo 'Write a Rust HTTP server in !server.rs'
 
# Update existing files with diff approval
zo 'Add error handling to @!main.rs'
zo 'Refactor @!utils.py to use async'
 
# Multiple files at once
zo 'Create !README.md and !LICENSE with MIT license'
 
# Auto-approve with --yes flag
zo --yes 'Add type hints to @!script.py'

Featured Examples

Explore detailed examples for specific use cases:

Custom Model Examples

Code Reviewer Persona

# ~/.config/zo/config.toml
[[custom_models]]
name = "reviewer"
model = "anthropic/claude-sonnet-4.5"
system_prompt = "You are a senior code reviewer. Focus on bugs, performance, security, and best practices."
zo /reviewer @pull_request.diff 'Review this PR'

Teacher Persona

[[custom_models]]
name = "teacher"
model = "anthropic/claude-opus-4.5"
system_prompt = "You are a patient teacher. Explain from first principles with analogies and examples."
zo /teacher 'Explain how compilers work'

DevOps Expert

[[custom_models]]
name = "devops"
model = "anthropic/claude-sonnet-4.5"
system_prompt = "You are a DevOps expert. Focus on infrastructure as code, CI/CD, monitoring, and security."
zo /devops 'Design a CI/CD pipeline for a Node.js app'

Advanced Workflows

Git Commit Messages

# Generate commit message
git diff --cached | zo 'Generate a concise commit message'
 
# With custom model
git diff --cached | zo /writer 'Generate commit message'

PR Descriptions

git diff main...feature | zo 'Generate PR description with:
- Summary
- Changes made
- Testing done
- Breaking changes'

Code Refactoring

zo --chat 'Let us refactor @!legacy.js to modern JavaScript'
> Use async/await instead of callbacks
> Add TypeScript types
> Improve error handling
> exit

File Output Workflows

# Create files directly
zo 'Create a complete FastAPI app with !main.py, !models.py, and !requirements.txt'
 
# Update with interactive approval
zo 'Modernize @!old_code.py to Python 3 with type hints'
 
# Incremental refactoring in chat mode
zo --chat '@!legacy_code.py Let us modernize this'
> Add type hints
> Convert to async
> Add error handling
> exit
 
# Generate documentation files
zo '@src/main.rs @src/lib.rs "Generate API docs in !API.md'
 
# Create tests from implementation
zo '@app.py Generate comprehensive unit tests in !test_app.py'

Test Generation

zo @src/calculator.rs 'Generate comprehensive unit tests with edge cases'
 
# With file output
zo '@!lib.rs Create unit tests in !tests/lib_test.rs'

SQL Query Generation

zo @schema.sql 'Generate a query to find:
- Top 10 customers by lifetime value
- Include customer name, email, total orders, and revenue
- Order by revenue descending'

Dockerfile Optimization

zo @Dockerfile 'Optimize this for:
- Smaller image size
- Better layer caching
- Security best practices
- Multi-stage build'

Configuration Generation

zo 'Generate nginx config for:
- Reverse proxy to localhost:3000
- Gzip compression
- Static file caching
- Rate limiting'

Shell Function Examples

Add these to ~/.bashrc or ~/.zshrc:

Explain Command

explain() {
    echo "$*" | zo 'Explain this command and what it does'
}
 
# Usage
explain tar -xzf archive.tar.gz
explain find . -name '*.log' -mtime +7 -delete

Get Command Suggestions

howto() {
    zo 'How do I $* in bash/zsh? Give me the exact command'
}
 
# Usage
howto find all python files modified today
howto compress a directory with tar

Error Fixer

fix() {
    "$@" 2>&1 | zo 'Why did this command fail and how do I fix it?'
}
 
# Usage
fix cargo build
fix npm install

Code Generator

gen() {
    zo /coder "$*" | tee generated.txt
}
 
# Usage
gen implement binary search in Rust with tests
gen create Python script to parse JSON logs

Pipeline Examples

Log Analysis

# Error patterns
grep ERROR app.log | zo 'Summarize these errors and suggest fixes'
 
# Rate limiting
tail -1000 access.log | zo 'Are we getting attacked? Look for suspicious patterns'
 
# Performance issues
cat slow_query.log | zo 'Which queries need optimization?'

System Monitoring

# Memory usage
ps aux --sort=-%mem | head -20 | zo 'Which processes should I investigate?'
 
# Disk usage
du -sh * | sort -hr | head -20 | zo 'What is using my disk space?'
 
# Network connections
netstat -tuln | zo 'Are these ports properly secured?'

Data Processing

# CSV to JSON
cat data.csv | zo 'Convert to JSON format'
 
# Extract emails
cat document.txt | zo 'Extract all email addresses as a list'
 
# Parse logs
cat nginx.log | zo 'Extract unique IP addresses making POST requests'

Next Steps