Skip to main content

Example Tools

CmdForge comes with 28 pre-built tools. This document shows their configurations and usage.

Quick Install

# Install all example tools (from the CmdForge directory)
python examples/install.py
cmdforge refresh

# Or install from anywhere
curl -sSL https://gitea.brrd.tech/rob/cmdforge/raw/branch/main/examples/install.py | python3

Text Processing Tools

summarize

Condense long documents to key points.

name: summarize
description: Condense long documents to key points
arguments:
- flag: --length
variable: length
default: "3-5 bullet points"
steps:
- type: prompt
prompt: |
Summarize the following text into \{length\}. Be concise and capture the key points:

\{input\}
provider: opencode-pickle
output_var: response
output: "\{response\}"

Usage:

cat article.txt | summarize
cat book.txt | summarize --length "10 bullet points"

translate

Translate text to any language.

name: translate
description: Translate text to any language
arguments:
- flag: --lang
variable: lang
default: Spanish
steps:
- type: prompt
prompt: |
Translate the following text to \{lang\}. Only output the translation, nothing else:

\{input\}
provider: claude-haiku
output_var: response
output: "\{response\}"

Usage:

echo "Hello, world!" | translate --lang French
cat readme.md | translate --lang Japanese

fix-grammar

Fix grammar and spelling errors.

name: fix-grammar
description: Fix grammar and spelling errors
arguments: []
steps:
- type: prompt
prompt: |
Fix all grammar, spelling, and punctuation errors in the following text. Only output the corrected text, no explanations:

\{input\}
provider: opencode-deepseek
output_var: response
output: "\{response\}"

Usage:

echo "teh cat sat on teh mat" | fix-grammar
cat draft.txt | fix-grammar > fixed.txt

simplify

Rewrite text for easier understanding.

name: simplify
description: Rewrite text for easier understanding
arguments:
- flag: --level
variable: level
default: "5th grade reading level"
steps:
- type: prompt
prompt: |
Rewrite the following text for a \{level\}. Keep the meaning but use simpler words and shorter sentences:

\{input\}
provider: opencode-pickle
output_var: response
output: "\{response\}"

Usage:

cat legal_document.txt | simplify
cat technical.md | simplify --level "non-technical reader"

tone-shift

Change the tone of text.

name: tone-shift
description: Change the tone of text
arguments:
- flag: --tone
variable: tone
default: professional
steps:
- type: prompt
prompt: |
Rewrite the following text in a \{tone\} tone. Keep the core message but adjust the style:

\{input\}
provider: opencode-deepseek
output_var: response
output: "\{response\}"

Usage:

cat angry_email.txt | tone-shift --tone "calm and professional"
cat casual_note.txt | tone-shift --tone formal

eli5

Explain like I'm 5.

name: eli5
description: Explain like I'm 5
arguments: []
steps:
- type: prompt
prompt: |
Explain this like I'm 5 years old. Use simple words and fun analogies:

\{input\}
provider: opencode-pickle
output_var: response
output: "\{response\}"

Usage:

echo "What is quantum computing?" | eli5
cat whitepaper.txt | eli5

tldr

One-line summary.

name: tldr
description: One-line summary
arguments: []
steps:
- type: prompt
prompt: |
Give a one-line TL;DR summary of this text:

\{input\}
provider: opencode-grok
output_var: response
output: "\{response\}"

Usage:

cat long_article.txt | tldr
curl -s https://example.com | tldr

expand

Expand bullet points to paragraphs.

name: expand
description: Expand bullet points to paragraphs
arguments: []
steps:
- type: prompt
prompt: |
Expand these bullet points into well-written paragraphs:

\{input\}
provider: opencode-pickle
output_var: response
output: "\{response\}"

Usage:

cat notes.txt | expand
echo "- Fast\n- Reliable\n- Easy to use" | expand

Developer Tools

explain-error

Explain error messages and stack traces.

name: explain-error
description: Explain error messages and stack traces
arguments: []
steps:
- type: prompt
prompt: |
Explain this error/stack trace in plain English. What went wrong and how to fix it:

\{input\}
provider: claude-haiku
output_var: response
output: "\{response\}"

Usage:

cat error.log | explain-error
python script.py 2>&1 | explain-error

explain-code

Explain what code does.

name: explain-code
description: Explain what code does
arguments:
- flag: --detail
variable: detail
default: moderate
steps:
- type: prompt
prompt: |
Explain what this code does at a \{detail\} level of detail:

{input}

provider: opencode-pickle
output_var: response
output: "\{response\}"

Usage:

cat script.py | explain-code
cat complex.js | explain-code --detail "very detailed"

review-code

Quick code review with suggestions.

name: review-code
description: Quick code review with suggestions
arguments:
- flag: --focus
variable: focus
default: "bugs, security, and improvements"
steps:
- type: prompt
prompt: |
Review this code focusing on \{focus\}. Be concise and actionable:

{input}

provider: claude-sonnet
output_var: response
output: "\{response\}"

Usage:

cat pull_request.diff | review-code
cat auth.py | review-code --focus "security vulnerabilities"

gen-tests

Generate unit tests for code.

name: gen-tests
description: Generate unit tests for code
arguments:
- flag: --framework
variable: framework
default: pytest
steps:
- type: prompt
prompt: |
Generate comprehensive unit tests for this code using \{framework\}. Include edge cases:

{input}

provider: claude-haiku
output_var: response
output: "\{response\}"

Usage:

cat utils.py | gen-tests
cat api.js | gen-tests --framework jest

docstring

Add docstrings to functions/classes.

name: docstring
description: Add docstrings to functions/classes
arguments:
- flag: --style
variable: style
default: Google style
steps:
- type: prompt
prompt: |
Add \{style\} docstrings to all functions and classes in this code. Output the complete code with docstrings:

{input}

provider: opencode-deepseek
output_var: response
output: "\{response\}"

Usage:

cat module.py | docstring
cat functions.py | docstring --style "NumPy style"

commit-msg

Generate commit message from diff.

name: commit-msg
description: Generate commit message from diff
arguments:
- flag: --style
variable: style
default: conventional commits
steps:
- type: prompt
prompt: |
Generate a concise \{style\} commit message for this diff. Just the message, no explanation:

\{input\}
provider: opencode-pickle
output_var: response
output: "\{response\}"

Usage:

git diff --staged | commit-msg
git diff HEAD~1 | commit-msg --style "simple"

Data Tools

json-extract

Extract structured data as validated JSON.

name: json-extract
description: Extract structured data as validated JSON
arguments:
- flag: --fields
variable: fields
default: any relevant fields
steps:
- type: prompt
prompt: |
Extract \{fields\} from this text as a JSON object. Output ONLY valid JSON, no markdown, no explanation:

\{input\}
provider: opencode-deepseek
output_var: raw_json
- type: code
code: |
import json
import re
text = raw_json.strip()
text = re.sub(r'^```json?\s*', '', text)
text = re.sub(r'\s*```$', '', text)
try:
parsed = json.loads(text)
validated = json.dumps(parsed, indent=2)
except json.JSONDecodeError as e:
validated = f"ERROR: Invalid JSON - {e}\nRaw output: {text[:500]}"
output_var: validated
output: "\{validated\}"

Usage:

echo "Price $49.99, SKU ABC-123" | json-extract --fields "price, sku"
cat invoice.txt | json-extract --fields "total, date, items"

sql-from-text

Generate SQL from natural language.

name: sql-from-text
description: Generate SQL from natural language
arguments:
- flag: --dialect
variable: dialect
default: PostgreSQL
steps:
- type: prompt
prompt: |
Generate a \{dialect\} SQL query for this request. Output only the SQL, no explanation:

\{input\}
provider: claude-haiku
output_var: response
output: "\{response\}"

Usage:

echo "get all users who signed up last month" | sql-from-text
echo "count orders by status" | sql-from-text --dialect MySQL

Advanced Multi-Step Tools

log-errors

Extract and explain errors from large log files.

name: log-errors
description: Extract and explain errors from large log files
arguments: []
steps:
- type: code
code: |
import re
lines = input.split('\n')
result = []
for i, line in enumerate(lines):
if re.search(r'\b(ERROR|CRITICAL|FATAL|Exception|Traceback)\b', line, re.I):
result.extend(lines[i:i+5])
extracted = '\n'.join(result[:200])
output_var: extracted
- type: prompt
prompt: |
Analyze these error log entries. Group by error type, explain likely causes, and suggest fixes:

\{extracted\}
provider: claude-haiku
output_var: response
output: "\{response\}"

Usage:

cat huge_app.log | log-errors
zcat archived.log.gz | log-errors

diff-focus

Review only the added/changed code in a diff.

name: diff-focus
description: Review only the added/changed code in a diff
arguments: []
steps:
- type: code
code: |
lines = input.split('\n')
result = []
for i, line in enumerate(lines):
if line.startswith('@@') or line.startswith('+++') or line.startswith('---'):
result.append(line)
elif line.startswith('+') and not line.startswith('+++'):
result.append(line)
extracted = '\n'.join(result)
output_var: extracted
- type: prompt
prompt: |
Review these added lines of code. Focus on bugs, security issues, and improvements:

\{extracted\}
provider: claude-haiku
output_var: response
output: "\{response\}"

Usage:

git diff | diff-focus
git diff HEAD~5 | diff-focus

Pipeline Recipes

CmdForge tools chain together like Unix commands:

Development Workflows

# Quick PR review: extract changes, review, summarize
git diff main | diff-focus | review-code --focus "bugs and security" | tldr

# Explain and fix an error in one pipeline
python script.py 2>&1 | explain-error | tee error_analysis.txt

# Generate tests for changed files only
git diff --name-only | grep '\.py$' | xargs cat | gen-tests > new_tests.py

# Create release notes from commits
git log v1.0..v1.1 --oneline | changelog | translate --lang French > RELEASE_FR.md

Data Processing

# Extract, transform, analyze
curl -s api.example.com/data | json-extract --fields "users, revenue" | json2csv | csv-insights

# Process multiple files
for f in reports/*.txt; do
cat "$f" | json-extract --fields "total, date"
done | json2csv > summary.csv

Text Processing Pipelines

# Translate technical docs for international team
cat API.md | simplify --level "non-technical" | translate --lang Spanish > API_ES.md

# Process customer feedback
cat feedback.txt | summarize --length "10 points" | tone-shift --tone analytical

Shell Functions

Add to ~/.bashrc for common workflows:

# Review recent changes
review-recent() {
git diff HEAD~"${1:-1}" | diff-focus | review-code | tldr
}

# Quick translate with summary
translate-summary() {
cat "$1" | summarize | translate --lang "${2:-Spanish}"
}

# Generate commit message and commit
auto-commit() {
msg=$(git diff --staged | commit-msg)
echo "Commit message: $msg"
read -p "Commit? [y/N] " confirm
[[ $confirm == [yY] ]] && git commit -m "$msg"
}