2026-05-12
Tutorial: Good Prompting
The single highest-leverage thing you can do when working with AI agents is
to write a good prompt. This tutorial covers what goes into one, a simple
framework to remember the parts, and — most importantly — how a project's
agent documentation can give you most of those parts for free.
What Makes a Good Prompt?
Vague prompts produce vague results. A well-structured prompt gives the AI
clear instructions about what to do, how to do it, who it's for, and how to
verify success.
The industry-standard framework for this is CO-STAR, developed by data
scientist Sheila Teo (winner of Singapore's GPT-4 Prompt Engineering
competition). It has six components:
| Letter | Component | What It Defines |
|---|---|---|
| C | Context | Background, situation, constraints |
| O | Objective | The specific task or goal |
| S | Style | Structural approach (technical, conversational, academic) |
| T | Tone | Emotional quality (formal, urgent, encouraging) |
| A | Audience | Who will read or use the output |
| R | Response | Exact format, structure, length of the output |
A variant called CO-STAR+ adds a seventh component:
| + | E | Examples | Few-shot samples showing what you want |
Grounding
Grounding anchors LLM outputs to verifiable, external data — documents,
codebases, examples, or specific context — rather than relying solely on
training data. It prevents hallucinations, improves accuracy, and ensures
responses are relevant and actionable.
In CO-STAR+, the E (Examples) component is the primary grounding technique:
few-shot samples show the model the exact format, style, and reasoning you
want. But C (Context) and O (Objective) also ground the response by
narrowing scope to a specific situation and goal.
In the PROMPT framework, grounding lives in M (Material) — providing
trusted source material (documents, API specs, constraints) — and T (Test)
— concrete verification criteria to validate the output against reality. A
well-grounded prompt combines context, examples, and testable expectations so
the model acts as a precise, data-driven assistant rather than a creative
storyteller.
Another Framework for Use With Agent Documentation: P.R.O.M.P.T.
CO-STAR is thorough, but in my own projects, I keep agent documentation co-resident with
the repositories (I'll create an article and open a repository for bootstrapping this one day).
This framework is simply P.R.O.M.P.T.
| Letter | Stands For | Question to Ask Yourself |
|---|---|---|
| P | Persona | Who is the AI acting as? (senior engineer, tutor, editor) |
| R | Request | What exactly do you want done? (the objective) |
| O | Outline | How should the output look? (format, structure, length) |
| M | Material | What context does the AI need? (background, constraints, references) |
| P | Preference | What's the style, tone, and audience level? |
| T | Test | How will you (or the AI) verify success? (examples, checks, tests) |
P.R.O.M.P.T. covers the same ground as CO-STAR+ but uses a single word
you're already thinking about when you sit down to write one.
How A Project's Docs Can Fill In Most of P.R.O.M.P.T.
Here's the key insight: good prompting is mostly about transferring context
from your head to the AI. In projects with agent documentation, that context already lives in
structured documentation. Your prompt can be much shorter because the
scaffolding is already baked in.
My projects use the Diátaxis framework — four
documentation modes (tutorial, how-to, explanation, reference), plus
supplementary directories for agents, personas, and metadata. Each one maps
directly to a P.R.O.M.P.T. component:
| PROMPT | Filled by these docs | What it gives the AI |
|---|---|---|
| Persona | CLAUDE.md, docs/11-agents/, docs/13-personas/ |
Role, conventions, coding style, user archetypes |
| Material | docs/01-explanation/, docs/04-reference/, docs/12-metadata/ |
Architecture, API specs, project metadata |
| Preference (Audience) | docs/13-personas/ |
Who the output is for — developer, PM, operator, evaluator |
That means your prompt shrinks from six items to three:
| Remaining | Why you still need to provide it |
|---|---|
| Request | The AI can't read your mind — tell it what to do |
| Outline | Every task has a different desired output format |
| Test | This is the single highest-leverage thing you can provide |
Let's see this in action.
Before and After
Before (no docs, vague prompt):
"Add a timer endpoint to the API."
After (leveraging docs, using P.R.O.M.P.T.):
Request: Add a
POST /api/timers/startendpoint.Outline: DRF viewset + serializer + test. Follow existing patterns.
Test:
pytest— write a test that starts a timer and asserts the response.
Runpytest -k test_start_timerto verify.(The AI already knows from CLAUDE.md + docs: Django, DRF serializers,
fat models/thin views,services.pypattern, auth required, pytest
fixtures. Your prompt doesn't need to repeat any of that.)
Even shorter — after you've built trust:
Once you and the AI have a shared understanding of the conventions, you can
drop the Outline too:
"Add a
POST /api/timers/startendpoint. Write a test and verify it passes."
The AI pulls Persona from CLAUDE.md, Material from the codebase and docs,
and Preference from the project's existing patterns. You only supply the
Request and a Test to verify.
Putting It All Together
When writing a prompt for this project:
- Check what the docs already cover. Read
CLAUDE.md, skim the relevant
docs/(or in my case,agent-docs/) section — you'll often find you can skip half the prompt. - State the Request clearly. This is the one thing the AI cannot guess.
- Specify the Outline if the output format isn't obvious from context.
- Always include a Test. A command to run, an assertion to check, a
screenshot to compare. This is the single highest-leverage practice
across all AI coding tools.
When writing a prompt for any project:
Run through P.R.O.M.P.T.:
- Persona — role for the AI
- Request — what to do
- Outline — output format
- Material — context and constraints
- Preference — style, tone, audience
- Test — verification criteria
Skip any component the project's docs already provide. Over time, you'll
develop intuition for what each project needs.
References
- Teo, S. (2023). How I Won Singapore's GPT-4 Prompt Engineering Competition. Towards Data Science.
https://towardsdatascience.com/how-i-won-singapores-gpt-4-prompt-engineering-competition-34c195a93d41
— Original article introducing the CO-STAR framework, developed by GovTech Singapore's Data Science & AI team. - Diátaxis: A systematic approach to technical documentation authoring.
https://diataxis.fr/
Next Steps
- How-to: Write Effective Prompts
- Read
CLAUDE.mdto see what conventions are already set for this project - Browse
docs/13-personas/to understand your audience archetypes - Browse
docs/12-metadata/for project-level context you can reference - Anthropic's Prompting Best Practices
- Create a Prompt Notebook — Generate a printable Kindle Scribe notebook template for CO-STAR or PROMPT using the open-source Kindle Scribe Notebook Generator.
Written by Paul B. Monday (pmonday@parallelhours.io) — published at parallelhours.io. Created with OpenCode Zen (Big Pickle model).
© 2026 Paul B. Monday