Docs

Custom Prompts

Create powerful, reusable prompts that combine variables, logic, and AI capabilities to automate complex workflows. Custom prompts transform repetitive tasks into single commands.

Understanding Custom Prompts

Custom prompts are:

  • Reusable templates with dynamic content
  • Smart expansions that can include AI processing
  • Workflow automation combining multiple operations
  • Context-aware responses based on variables

Basic Prompt Structure

Simple Template

prompts:
  greeting:
    trigger: "greet"
    template: "Hello {{name}}, welcome to {{company}}!"

With AI Integration

prompts:
  email_reply:
    trigger: "reply"
    template: "/email Write a friendly reply acknowledging {{topic}}"

Multi-line Template

prompts:
  meeting_notes:
    trigger: "notes"
    template: |
      Meeting Notes - {{date}}
      Attendees: {{attendees}}
      
      Topics Discussed:
      {{topics}}
      
      Action Items:
      /ai Generate action items from: {{discussion}}

Variables in Prompts

System Variables

Built-in variables available in all prompts:

{{date}} - Current date
{{time}} - Current time
{{day}} - Day of week
{{user}} - Your name
{{clipboard}} - Clipboard content
{{selection}} - Selected text
{{app}} - Current application

Custom Variables

Define your own variables:

variables:
  company: "Acme Corp"
  email: "john@acme.com"
  team: "Engineering"
  manager: "Sarah Chen"

Variable Modifiers

Transform variables with modifiers:

{{name|uppercase}} - JOHN DOE
{{date|short}} - 12/25/24
{{text|trim}} - Remove whitespace
{{list|first}} - First item
{{content|escape}} - Escape special chars

Advanced Prompt Features

Conditional Logic

prompts:
  smart_greeting:
    template: |
      {{#if morning}}
      Good morning {{name}}!
      {{else if afternoon}}
      Good afternoon {{name}}!
      {{else}}
      Good evening {{name}}!
      {{/if}}

Nested Prompts

Reference other prompts:

prompts:
  signature:
    template: |
      Best regards,
      {{name}}
      {{title}}
      
  email_with_sig:
    template: |
      {{message}}
      
      {{> signature}}

Lists and Iteration

prompts:
  task_list:
    template: |
      Today's Tasks:
      {{#each tasks}}
      - {{this.title}} ({{this.priority}})
      {{/each}}

AI Processing

prompts:
  improve_text:
    template: |
      /ai /model:smart Improve this text:
      {{selection}}
      
      Requirements:
      - Professional tone
      - Clear and concise
      - Maintain key points

Creating Prompt Libraries

Organization by Category

# email_prompts.yaml
prompts:
  email_formal:
    category: "email"
    trigger: "eml.formal"
    template: "..."
    
  email_casual:
    category: "email"
    trigger: "eml.casual"
    template: "..."

Importing Prompts

# main config
imports:
  - ./prompts/email_prompts.yaml
  - ./prompts/code_prompts.yaml
  - ./prompts/meeting_prompts.yaml

Sharing Prompts

Export and share with team:

agentastic prompts export --category email > team_email_prompts.yaml

Prompt Examples

Daily Standup

prompts:
  standup:
    trigger: "standup"
    template: |
      /memory:work /ai Generate my standup update:
      
      Yesterday: {{yesterday|/memory What did I complete?}}
      Today: {{today|/calendar What's scheduled?}}
      Blockers: {{blockers|None}}
      
      Format as bullet points.

Code Documentation

prompts:
  document_function:
    trigger: "docfunc"
    template: |
      /code Generate JSDoc for:
      {{selection}}
      
      Include:
      - Description
      - Parameters with types
      - Return value
      - Example usage

Client Email

prompts:
  client_update:
    trigger: "update"
    variables:
      project: "{{project_name}}"
      milestone: "{{current_milestone}}"
    template: |
      /email /formal Write project update email:
      
      - Project: {{project}}
      - Current milestone: {{milestone}}
      - Progress: {{progress}}
      - Next steps: {{next_steps}}
      - Timeline: On track

Meeting Scheduler

prompts:
  schedule_meeting:
    trigger: "sched"
    template: |
      /calendar /email Schedule {{type}} meeting:
      
      Duration: {{duration|1 hour}}
      Participants: {{participants}}
      Topic: {{topic}}
      
      Find time next week and send invites.

Prompt Configuration

Global Settings

prompt_settings:
  case_sensitive: false
  word_boundaries: true
  expansion_delay: 0
  allow_nested: true
  max_recursion: 5

Per-Prompt Settings

prompts:
  quick_reply:
    trigger: "qr"
    settings:
      priority: high
      enabled: true
      apps: ["Mail", "Outlook"]
      model: "fast"

Context Awareness

prompts:
  context_aware:
    trigger: "ctx"
    contexts:
      - app: "Xcode"
        template: "Generate Swift code comment"
      - app: "Mail"
        template: "Generate email signature"
      - default:
        template: "Generate appropriate content"

Dynamic Prompts

User Input

prompts:
  custom_email:
    trigger: "cemail"
    inputs:
      - name: "recipient"
        prompt: "Recipient name:"
        default: "there"
      - name: "topic"
        prompt: "Email topic:"
        required: true
    template: |
      @email Write email to {{recipient}} about {{topic}}

API Integration

prompts:
  weather_update:
    trigger: "weather"
    api:
      url: "https://api.weather.com/current"
      params:
        location: "{{city}}"
    template: |
      Current weather in {{city}}: {{api.temp}}°F, {{api.conditions}}

Script Execution

prompts:
  git_status:
    trigger: "gst"
    script: "git status --short"
    template: |
      @ai Summarize these git changes:
      {{script_output}}

Best Practices

Naming Conventions

# Good naming
email_reply_formal
meeting_notes_template
code_review_checklist

# Avoid
er
mnt
crc

Variable Validation

prompts:
  validated:
    variables:
      email:
        type: "email"
        required: true
      date:
        type: "date"
        format: "YYYY-MM-DD"
      priority:
        type: "enum"
        values: ["low", "medium", "high"]

Error Handling

prompts:
  safe_prompt:
    template: |
      {{#if error}}
      Error: {{error_message}}
      {{else}}
      {{content}}
      {{/if}}
    fallback: "Default content if error"

Testing Prompts

Test Mode

prompts:
  test_prompt:
    trigger: "test"
    test_data:
      name: "John Doe"
      company: "Test Corp"
    template: "Hello {{name}} from {{company}}"

Debugging

Enable debug mode:

prompt_settings:
  debug: true
  log_expansions: true
  show_variables: true

Performance Optimization

Caching

prompts:
  cached_data:
    cache: true
    cache_duration: 3600  # 1 hour
    template: |
      @api Expensive operation
      {{cached_result}}

Lazy Loading

prompts:
  lazy_load:
    lazy: true
    load_when: "app:Mail"
    template: "Email-specific prompt"

Troubleshooting

Prompt Not Working

  1. Check YAML syntax
  2. Verify trigger uniqueness
  3. Test variables exist
  4. Check app restrictions

Variable Issues

  1. Verify variable names
  2. Check case sensitivity
  3. Test with defaults
  4. Use debug mode

Performance Problems

  1. Simplify complex logic
  2. Reduce nesting depth
  3. Cache expensive operations
  4. Profile execution time

Integration Examples

With Memory

prompts:
  contextual:
    template: |
      @memory Recall our discussion about {{topic}}
      @ai Continue with new information: {{update}}

With Workflows

workflows:
  blog_post:
    steps:
      - prompt: "research_topic"
      - prompt: "create_outline"
      - prompt: "write_sections"
      - prompt: "final_review"

Next Steps

Custom prompts are the key to automation in Agentastic. Start simple and gradually build a library of powerful templates that transform your daily workflows!