Writing Prompts
The prompt defines a workflow’s behavior. It specifies the task, the process, constraints, and output format.
Prompt structure
A good prompt typically includes:
- Role definition — Who/what the workflow is
- Task description — What it should do
- Process steps — How to accomplish the task
- Output format — How to structure results
- Edge cases — Special situations to handle
- Constraints — What NOT to do
Example prompt
Here’s a well-structured prompt for a bill tracking workflow:
You are a bill tracking workflow. Your job is to identify bills and invoices
in incoming emails and organize them.
**PROCESS:**
1. Read the incoming email carefully
2. Determine if it's a bill, invoice, or payment notice
3. If it IS a bill:
- Extract: vendor name, amount due, due date
- Add the label "bills"
- If due within 7 days, also add label "bills-urgent"
4. If it's NOT a bill, take no action
**WHAT COUNTS AS A BILL:**
- Invoices with amounts due
- Utility bills (electric, gas, water, internet)
- Subscription renewal notices with payment required
- Credit card statements
- Rent or mortgage statements
**WHAT IS NOT A BILL:**
- Marketing emails about "payment methods" or "billing updates"
- Receipts for completed purchases (already paid)
- General account notifications
- Promotional offers
**OUTPUT:**
After processing, log a brief summary:
- If bill: "Bill from [Vendor]: $[Amount] due [Date]"
- If not bill: "Not a bill - no action taken"
**IMPORTANT:**
- Do NOT archive bills - only label them
- Do NOT send any emails
- When uncertain, err on the side of NOT labelingKey principles
Be specific
Bad: “Handle my emails”
Good: “When a new email arrives, check if it’s from a known contact. If yes, keep in inbox. If no, add the ‘unknown’ label and archive.”
Vague prompts produce inconsistent behavior. Specify exactly what you want.
Define edge cases
What happens when:
- The email doesn’t fit any category?
- Information is missing?
- The email is ambiguous?
**EDGE CASES:**
- If amount is unclear, add label "bills-review" for manual check
- If due date is missing, assume 30 days from email date
- If sender is unknown, still process if content clearly indicates a billSpecify output format
If your workflow generates output (summaries, reports), define the format precisely:
**FORMAT:**
Subject: Morning Briefing - [Today's Date]
**Today's Schedule**
You have [X] meetings today.
- **[Time]** - [Meeting Title]
[One line of context]
**Emails Needing Attention** ([X] emails)
- [Subject] from [Sender] - [What action is needed]Include constraints
Tell the workflow what NOT to do:
**NEVER DO THESE:**
- Never delete emails
- Never send emails to external addresses
- Never process emails from @town.com
- Never archive emails from my manager (manager@company.com)Use headers and structure
Structure makes prompts easier to read and follow:
**ROLE:**
You are an inbox filtering workflow.
**TRIGGER:**
This runs on every incoming email.
**PROCESS:**
1. First step
2. Second step
3. Third step
**RULES:**
- Rule one
- Rule twoCommon patterns
The classifier pattern
For workflows that categorize and route emails:
Classify incoming emails into categories and apply labels.
**CATEGORIES:**
- "receipts" - Purchase confirmations, order receipts
- "travel" - Flight, hotel, car rental confirmations
- "newsletters" - Subscribed newsletters and digests
- "alerts" - System alerts, monitoring notifications
- "personal" - Emails from known contacts
**PROCESS:**
1. Read the email
2. Determine the most appropriate category
3. Apply the corresponding label
4. Archive if not "personal"The reporter pattern
For workflows that generate summaries:
Generate a weekly summary of [topic].
**GATHER:**
1. Search for relevant emails from the past 7 days
2. Extract key information from each
**ANALYZE:**
- Identify patterns and trends
- Note anything unusual or urgent
**REPORT:**
Send a summary email with:
- Overview statistics
- Key highlights (3-5 bullet points)
- Items requiring attention
- Links to relevant emailsThe watcher pattern
For workflows that monitor and alert:
Monitor incoming emails for [condition] and alert when found.
**WATCH FOR:**
- [Specific patterns or keywords]
- [Sender domains]
- [Subject line patterns]
**WHEN DETECTED:**
1. Read the full email
2. Extract relevant details
3. Send me an alert email with:
- What was detected
- Key details
- Link to the original email
**FALSE POSITIVES:**
Do not alert for:
- [Common false positive 1]
- [Common false positive 2]Prompt variables
Your prompt has access to context that gets injected:
- Current time — For time-based decisions
- User email — Your email address
- Account info — Which Gmail account is active
- Trigger context — The email or event that triggered the run
You don’t need to specify these — they’re automatically available.
Testing your prompt
- Start with approval-required mode — Review what the workflow wants to do
- Use manual triggers — Test on specific emails
- Check the run logs — Inspect decisions and tool calls
- Iterate — Refine based on behavior
Common mistakes
Too vague: “Be helpful with emails”
Too long without structure: A wall of text is hard for the AI to parse
Missing edge cases: “Process bills” — but what if it’s uncertain?
No output format: Workflow generates inconsistent summaries
Conflicting instructions: “Archive all newsletters” + “Keep important emails” — what if a newsletter is important?
Best practices
Read stock workflow prompts. Export a stock workflow and study its prompt. These are tested and refined.
Use the builder. The Workflow Builder generates prompts based on your description. Use it as a starting point.
Test incrementally. Start small. Add constraints and edge cases as you see failures.
Log for debugging. Include instructions for the workflow to log its reasoning. Makes debugging easier.
Version your prompts. When you find a good prompt, save it. Note what changes you made and why.