TheFocus.AI TheFocus.AI

One Shot Prompts

TUTOR WITH THEFOCUS.AI

Agent Integration

Copy this prompt into Claude, ChatGPT, or any external AI assistant. It points the assistant to the course instructions and links it to your student profile to track your progress and customize observations.

Please tutor me in this lesson using the following context. First, read the instructions at: https://courses.thefocus.ai/llms.txt My Student ID is: <none> The lesson markdown source is at: https://courses.thefocus.ai/run-ai-locally/02-prompting/05-one-shot-prompts.md

You are not enrolled yet. Enroll to generate a Student ID to track lesson completions and store learning notes.

05 — Spell #3: One-Shot Prompts

The Problem

When you chat with an AI, you’re having a conversation. You ask something. It responds. You clarify. It adjusts. This works great… until you need to do it again.

If you want to reproduce a result, you have two options:

  1. Find the old conversation and continue from there
  2. Recreate the entire conversation from scratch, trying to remember what you said

Neither is good. Conversations are ephemeral. There’s no record of exactly what worked.

The Solution: One-Shot Prompts

A one-shot prompt is a single, self-contained prompt that contains everything the model needs to produce the right answer. No follow-up questions. No clarifications. One message, one good result.

If the result isn’t good enough, instead of chatting to fix it, you go back to the original prompt and improve it.

The Loop

The one-shot workflow has four steps:

1. WRITE the prompt
2. RUN the prompt
3. EVALUATE the results
4. DECIDE if the prompt is good enough — if not, improve it and go to step 1

This is fundamentally different from chatting. In a chat, you have a back-and-forth. With one-shot prompts, you have a prompt-run-evaluate loop.

Why This Matters

Once you have a good one-shot prompt:

  • You can run it repeatedly and get consistent results
  • You can share it with others
  • You can version it (keep prompt_v1.txt, prompt_v2.txt)
  • You can test it against different models
  • You can automate it (we’ll do this in the next section)

How to Build a One-Shot Prompt

Start with Spell #1 (clarifying questions) to figure out what you want. Have the conversation. Answer the questions. When the model understands the task, ask it:

Can you summarize this entire conversation into a prompt that I could
feed into another model to generate the same result?

The model will produce a synthetic prompt — a dense, self-contained version of everything you discussed. Save this. This is your one-shot prompt.

Real Example: The Prompt Runner

After our clarifying question conversation about building a prompt runner, we asked the model to produce a one-shot prompt. Here’s what it generated (abbreviated):

Task: Act as a DevOps Engineer. Create a lightweight, zero-dependency automation system for macOS to perform regression testing on LLM outputs using Ollama.

Target Model: The system must specifically use the gemma4:26b model via the Ollama CLI.

Workflow Logic: The system should be a Shell Script (zsh) designed for macOS. It must take a single command-line argument: the path to a specific directory.

Inside that directory, the script must look for a file named prompt.txt. The script must feed the contents of prompt.txt into ollama run gemma4:26b. The resulting model response must be saved into a file named output.txt within that same directory.

Technical Constraint: Do NOT use Python or any external libraries. Use only native macOS tools (zsh, curl, or ollama CLI).

Notice how dense this is. Every decision from the conversation — bash, not Python; one directory at a time; overwrite, not version — is baked into the prompt. Feed this to a fresh chat, and the model should produce working code on the first try.

Saving and Running a One-Shot Prompt

Once you have a one-shot prompt, save it:

mkdir -p 2-runner
pbpaste > 2-runner/prompt.txt

(On Mac, pbpaste pastes from your clipboard.)

Then run it through the prompt runner (which we’ll build properly in the next section):

bash run_prompt.sh 2-runner

Output:

Running prompt in 2-runner using gemma4:26b...
Done! Output saved to 2-runner/output.txt

When It Doesn’t Work (The First Time)

The first one-shot prompt rarely works perfectly. That’s expected. Here’s the loop in action:

  1. Run the prompt → code has a bug
  2. Copy the error and the output files
  3. Go back to the original clarifying-questions chat
  4. Paste the error:
    When I ran this with the runner itself, I got these results and
    it didn't work. [error message here]
  5. Ask the model: “Based on everything we just did, can you update the original plan?”
  6. Get an improved one-shot prompt
  7. Save it as prompt.txt (overwriting the old one)
  8. Run again

Repeat until you get two successful runs in a row. That’s your quality threshold — when the prompt consistently produces working code.

The Evolution of a Prompt

Here’s how the prompt runner prompt evolved across iterations:

  • plan1.md — Initial specification. Gave bash script requirements but was too loose.
  • plan2.md — Added self-correction patterns. “Auto-create files if missing,” “handle encoding errors.” Still generated buggy code.
  • plan3.md — Added “Strict Syntax & Integrity” section. Explicitly forbade specific bugs we encountered. Better, but still had issues.
  • plan4.md (the “Master Prompt”) — Added “Defensive Coding & Anti-Hallucination” section. Explicitly forbade comma errors, walrus operators, and variable casing mistakes. This one worked.

Each iteration fixed a specific failure mode. The prompt got longer and more specific each time. By plan4, it was bulletproof.

What You’ve Learned

  • One-shot prompts make your work reproducible — one message, one result
  • The prompt-run-evaluate loop replaces conversational debugging
  • Synthetic prompts (generated from your conversations) are a fast way to get started
  • Improving a prompt is an iterative process — expect 3-4 rounds before it’s solid
  • A good one-shot prompt is a reusable asset you can share, version, and automate

Next: 03 Automation → — we’ll automate this entire loop.