Skip to main content
The rf prompts command provides complete CRUD (Create, Read, Update, Delete) operations for managing prompt templates. Supports both interactive mode with editor integration and non-interactive mode for automation.

Commands Overview

CommandDescription
rf prompts listList all prompt templates
rf prompts get <name>View prompt content
rf prompts create <name>Create new prompt (interactive editor)
rf prompts update <name>Update existing prompt (interactive editor)
rf prompts delete <name>Delete prompt
rf prompts render <name> <vars>Render prompt with variables

Listing Prompts

# Interactive mode - shows menu
rf prompts

# List all prompts
rf prompts list

# Output:
# Available prompts:
# • system-prompt
# • customer-support
# • feedback-analyzer
# • onboarding-assistant

Getting Prompt Content

# View specific prompt
rf prompts get system-prompt

# Output:
# Prompt: system-prompt
# ---
# You are a helpful AI assistant.
# Your goal is to help users with their questions.
# Always be polite and professional.

Creating Prompts

Interactive Mode (Default)

Opens your default editor for content input:
rf prompts create support-bot
# → Opens editor (vim, nano, vscode, etc.)
# → Enter your prompt content
# → Save and close
# ✓ Prompt 'support-bot' created

Non-Interactive Mode

Perfect for scripts, CI/CD, and AI tools:
# With inline content
rf prompts create support-bot --content "You are a helpful support assistant"

# From file
rf prompts create support-bot --file ./prompts/support.txt

# Multi-line content
rf prompts create support-bot --content "You are a support assistant.
Always be helpful and polite.
Provide clear and concise answers."

Options

OptionAliasDescription
--content <text>-cPrompt content (non-interactive)
--file <path>-fRead content from file

Updating Prompts

Interactive Mode (Default)

Opens editor with current content:
rf prompts update support-bot
# → Opens editor with existing content
# → Make your changes
# → Save and close
# ✓ Prompt 'support-bot' updated

Non-Interactive Mode

# Update with new content
rf prompts update support-bot --content "Updated prompt content"

# Update from file
rf prompts update support-bot --file ./prompts/support-v2.txt

Deleting Prompts

# With confirmation
rf prompts delete support-bot
# ? Are you sure you want to delete prompt 'support-bot'? (y/N)

# Skip confirmation
rf prompts delete support-bot --yes
rf prompts delete support-bot -y

# Alternative alias
rf prompt delete old-prompt --yes

Rendering Prompts with Variables

If your prompts use template variables, you can test rendering:
# Render with variables (JSON format)
rf prompts render welcome-email '{"name": "John", "company": "ACME"}'

# Output:
# Welcome to ACME, John!
# We're excited to have you on board...
Example prompt with variables:
Hello {{name}},

Welcome to {{company}}! We're thrilled to have you join us.

Best regards,
The {{company}} Team

Prompt Templates Examples

System Prompt

rf prompts create system --content "You are a helpful AI assistant powered by RunFlow.

Your capabilities:
- Answer questions accurately
- Provide code examples
- Explain complex concepts simply
- Always be professional and helpful

Guidelines:
- Be concise but thorough
- Ask clarifying questions when needed
- Admit when you don't know something"

Customer Support

rf prompts create support --content "You are a customer support assistant for {{company}}.

Your role:
- Help customers resolve issues
- Answer product questions
- Escalate complex issues to human agents

Tone:
- Friendly and empathetic
- Professional and clear
- Patient and understanding

Always:
1. Greet the customer warmly
2. Listen to their concern
3. Provide step-by-step solutions
4. Ask if they need further help"

RAG (Knowledge Base) Prompt

rf prompts create rag-assistant --content "You are a knowledge base assistant.

Context from knowledge base:
{{context}}

User question:
{{question}}

Instructions:
- Answer based ONLY on the provided context
- If the answer isn't in the context, say 'I don't have that information'
- Cite sources when possible
- Be accurate and concise"

Code Review Assistant

rf prompts create code-review --file ./prompts/code-review.txt
File: prompts/code-review.txt
You are a senior software engineer reviewing code.

Review the following code and provide feedback on:
1. Code quality and best practices
2. Potential bugs or issues
3. Performance optimizations
4. Security concerns
5. Readability and maintainability

Be constructive and specific in your feedback.

Code to review:
{{code}}

Using with AI Tools

Non-interactive mode is designed for AI coding assistants:
# Cursor / Copilot can execute these directly
rf prompts create assistant --content "You are a helpful assistant"
rf prompts update assistant --content "Updated instructions"
rf prompts delete old-prompt --yes

Automation & Scripts

Use in bash scripts or CI/CD:
#!/bin/bash

# Deploy multiple prompts
prompts_dir="./prompts"

for file in "$prompts_dir"/*.txt; do
  name=$(basename "$file" .txt)
  rf prompts create "$name" --file "$file"
done

# Backup existing prompts
rf prompts list | while read -r prompt; do
  rf prompts get "$prompt" > "backups/$prompt.txt"
done

Integration with Agents

Prompts are typically used in your agent code:
import { Agent } from '@runflow-ai/core';

const agent = new Agent({
  name: 'Support Bot',
  instructions: await getPrompt('customer-support'), // Load from prompts
  model: 'gpt-4',
  // ... other config
});

Best Practices

1. Use Descriptive Names

# ✅ Good - clear purpose
rf prompts create customer-support-v2
rf prompts create rag-retrieval-prompt
rf prompts create sales-qualification

# ❌ Avoid - unclear names
rf prompts create prompt1
rf prompts create test
rf prompts create x

2. Version Your Prompts

rf prompts create support-bot-v1
rf prompts create support-bot-v2
rf prompts create support-bot-v3

# Keep old versions for rollback
rf prompts get support-bot-v1 > backup/support-v1.txt

3. Use Files for Complex Prompts

# For long, complex prompts
rf prompts create complex-assistant --file ./prompts/complex.txt

# Easier to:
# - Edit in your IDE
# - Version control
# - Review changes

4. Template Variables

Use consistent variable naming:
# Use lowercase with underscores
{{user_name}}
{{company_name}}
{{context}}

# Or camelCase
{{userName}}
{{companyName}}
{{contextData}}

Common Patterns

Environment-Specific Prompts

# Development prompts
rf switch dev
rf prompts create system --content "Development mode prompt..."

# Production prompts
rf switch prod
rf prompts create system --content "Production mode prompt..."

Prompt Library Management

# Export all prompts
mkdir prompt-library
rf prompts list | while read name; do
  rf prompts get "$name" > "prompt-library/$name.txt"
done

# Import prompts to new environment
for file in prompt-library/*.txt; do
  name=$(basename "$file" .txt)
  rf prompts create "$name" --file "$file"
done

Troubleshooting

Prompt Already Exists

rf prompts create existing-prompt --content "..."
# Error: Prompt 'existing-prompt' already exists
Solution: Use update instead or delete first:
rf prompts update existing-prompt --content "..."
# OR
rf prompts delete existing-prompt --yes
rf prompts create existing-prompt --content "..."

Editor Not Opening (Interactive Mode)

If the editor doesn’t open:
# Set your preferred editor
export EDITOR=nano
rf prompts create my-prompt

# Or use non-interactive mode
rf prompts create my-prompt --content "Your content here"

File Not Found

rf prompts create test --file ./prompts/missing.txt
# Error: File not found: ./prompts/missing.txt
Solution: Check the file path:
ls -la ./prompts/missing.txt
# Use correct path
rf prompts create test --file ./correct-path/file.txt

Aliases

You can use singular or plural form:
rf prompt list      # Same as rf prompts list
rf prompt create    # Same as rf prompts create
rf prompt delete    # Same as rf prompts delete

Next Steps