Bot TutorialsGrok BotChatGPTClaudeGeminiCopilotPerplexityMore botsGuides

Scripts & templates

Copy, paste, change the [brackets]. MODEL_NAME: use a current name from the provider's models page.

Prompt template: any task

TASK: [what you want done]
AUDIENCE: [who reads it]
CONTEXT: [facts it needs; paste them, don't make it guess]
FORMAT: [length, bullets/table, tone]
RULES: If you don't know something, write UNKNOWN. Cite a source URL for every number.
CHECK: At the end, list anything you assumed.

Covers the four things most weak prompts leave out: audience, context, format and a self-check.

Prompt template: verify a claim

Here is a claim: "[paste]".
1) Find the primary source (official site, law, filing). Give the URL.
2) Quote the exact sentence that supports or contradicts it.
3) Verdict: SUPPORTED / CONTRADICTED / NOT FOUND. Do not guess.

Forces a quote you can Ctrl+F on the source page.

Prompt template: summarize a document

Summarize the attached document for [audience] in [N] bullets.
Then list every date, dollar amount and deadline with its page number.
Do not add anything that is not in the document.

Page numbers make every fact checkable.

Custom instructions example

About me: I run a small business in Oregon. I'm not technical.
How to answer: plain English, short paragraphs, the answer first.
Always: give a source link for prices, laws and dates. Say "I'm not sure" instead of guessing.
Never: invent numbers, quotes or links. Never claim a task is done without a link or ID I can check.

Paste into ChatGPT Custom Instructions, Claude profile preferences, or a Gemini Gem.

Agent standing rules (Grok Bot or any agent)

Standing rules:
- Ask before sending email, posting, buying, or deleting anything.
- Tell me before creating any new scheduled job, with how often it runs.
- When you say something is done, include the link, ID or screenshot.
- If a tool fails twice, stop and tell me instead of retrying.

Cuts surprise actions and wasted runs.

Routine recipe: weekly job audit

Every Monday 8 AM: list every scheduled job/routine you run for me, its schedule, last run time, last result, and whether it produced anything I used. Recommend which to turn off. Do not change anything.

One cheap weekly run that catches jobs silently burning usage or silently dead.

Routine recipe: morning brief

Every weekday 7 AM: read my calendar for today and unread email from the last 12 hours. Send me 5 bullets: meetings, anything needing a reply, deadlines. Link each item. Do not reply to anyone.

Read-only, so no approval risk.

OpenAI API: curl

curl https://api.openai.com/v1/responses \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_NAME", "input": "Write one sentence about flood safety."}'

Responses API (platform.openai.com/docs). Pick MODEL_NAME from OpenAI's models page. Keep the key in an environment variable, never in code you share.

OpenAI API: Python

from openai import OpenAI
client = OpenAI()  # reads OPENAI_API_KEY
r = client.responses.create(model="MODEL_NAME", input="Write one sentence about flood safety.")
print(r.output_text)

pip install openai

Anthropic API: curl

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "MODEL_NAME", "max_tokens": 300,
       "messages": [{"role": "user", "content": "Write one sentence about flood safety."}]}'

Messages API (docs.anthropic.com). max_tokens is required and caps the cost of each reply.

Anthropic API: Python

import anthropic
client = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY
m = client.messages.create(model="MODEL_NAME", max_tokens=300,
    messages=[{"role": "user", "content": "Write one sentence about flood safety."}])
print(m.content[0].text)

pip install anthropic

Gemini API: curl

curl "https://generativelanguage.googleapis.com/v1beta/models/MODEL_NAME:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contents": [{"parts": [{"text": "Write one sentence about flood safety."}]}]}'

Gemini API (ai.google.dev). Get a key in Google AI Studio.

xAI (Grok) API: curl

curl https://api.x.ai/v1/chat/completions \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "MODEL_NAME", "messages": [{"role": "user", "content": "Write one sentence about flood safety."}]}'

xAI API (docs.x.ai) is OpenAI-compatible, so the OpenAI SDK works with base_url https://api.x.ai/v1.

JavaScript: call any OpenAI-compatible API

const r = await fetch("https://api.x.ai/v1/chat/completions", {
  method: "POST",
  headers: { "Authorization": `Bearer ${process.env.XAI_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ model: "MODEL_NAME", messages: [{ role: "user", content: "Hello" }] })
});
console.log((await r.json()).choices[0].message.content);

Node 18+. Run server-side only: an API key in browser code is public.

Python: cap spend with a token budget

# Stop a loop before it runs away. Usage fields come back on every API response.
budget, used = 200_000, 0
for prompt in prompts:
    r = client.responses.create(model="MODEL_NAME", input=prompt)
    used += r.usage.total_tokens
    if used > budget:
        print("Budget hit, stopping at", used); break

Also set a hard monthly limit in the provider's billing settings.

Related: FAQGrok Bot lessonsChatGPT lessonsClaude lessonsGemini lessonsCopilot lessonsPerplexity lessonsCatch made-up answersStop burning creditsWhich bot for whatFiles safelyScripts & templatesWorkflowsMore bot lessons

Next tutorial: AI bot FAQ →