Practice: Prompt engineering and context engineering
Generated by Claude through GigAI 0.1.11.10 on 2026-10-11.
Main tool: Prompt engineering · Practising with the Prompt Engineering Guide trains the underlying skill of writing, structuring and measuring prompts by hand, which carries over to every model and to every evaluation or tracing tool a customer team already uses. · Alternatives: Promptfoo runs prompt test suites from a config file; LangSmith and Langfuse add tracing, prompt versioning and hosted evaluations; DSPy optimizes prompts programmatically from examples and a metric instead of hand editing; Pydantic AI enforces typed, validated outputs in code; Jinja2 only templates the prompt text; vendor playgrounds and workbenches give a quick interactive editor without versioned test cases.
Every step links into the tool's own documentation; links were checked on 2026-10-11 · version 1
Setup (one time)
1. Pick one chat model you can reach from your laptop, such as a small open model in a local runner on CPU or a free tier chat interface, and fix its temperature and model version for the whole path.
Prompt changes can only be compared when the model and sampling settings stay constant. A small local model is enough because no step here needs a GPU or a paid cloud.
Explained in: Optimizing Prompts | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: You can send the same prompt twice with fixed settings and get an answer both times from the model you wrote down.
2. Create a prompt workbook folder with one plain text file per prompt version and one results sheet with columns for prompt version, input, output and pass or fail.
The discipline is empirical, so every version and every result has to be kept where it can be compared later. A folder and a sheet are enough before adopting an evaluation tool.
Explained in: LLMs for Classification | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: The folder exists with an empty results sheet and a naming rule for prompt versions that you have written at the top of the sheet.
3. Read the opening page on why context engineering exists and write down in your workbook the difference between the instructions you write and the context you assemble.
The later steps split the work into prompt wording and context selection. Having the two terms defined in your own words keeps each experiment focused on one of them.
Explained in: Why Context Engineering? | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: Your workbook has a two line definition of prompt engineering and of context engineering that you can use to label each later experiment.
Steps
1. Write a first prompt that explains a technical concept to a named audience, with a separate instruction, audience description and output format, following the concept explanation example.
This is the smallest complete prompt and shows the parts every production prompt is built from. Naming the parts makes later changes targeted instead of random.
Explained in: Explain Concepts with LLMs | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: The model returns an explanation in the format and length you asked for, and your file labels which sentence is instruction, which is audience and which is format.
2. Write a zero-shot sentiment classification prompt with a fixed label set and an explicit output indicator, and run it on ten short inputs you wrote yourself.
Classification makes the anatomy of a prompt measurable because each answer is right or wrong. A constrained label set is the first step toward output a program can parse.
Explained in: Sentiment Classification with LLMs | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: All ten outputs are exactly one of your allowed labels with no extra text, and each is recorded in the results sheet with pass or fail.
3. Create a few-shot version of the same classifier by adding labeled examples, then run it on the same ten inputs.
Examples are often the most effective way to pin down ambiguous behavior and format. Running the same inputs shows what the examples changed and what they did not.
Explained in: Few-Shot Sentiment Classification with LLMs | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: The results sheet shows the zero-shot and few-shot pass counts side by side for the same ten inputs.
4. Run an extraction prompt that pulls model names out of a paper abstract and returns them as a strict list, then feed it an abstract with no model names.
Production prompts usually feed code, so the output shape and the empty case matter as much as the happy path. Telling the model what to return when nothing is found prevents invented answers.
Explained in: Extract Model Names from Papers | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: The output parses as a list for a normal abstract and returns your defined empty value for the abstract with no model names.
5. Run a reasoning prompt that asks the model to work through intermediate steps before the final answer, and compare it with the same question asked directly.
Giving the model room to reason improves multi-step problems but costs tokens and latency. Seeing both outputs teaches when the trade is worth it.
Explained in: Indirect Reasoning with LLMs | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: You have both outputs saved and a one line note stating whether the stepwise version changed the final answer.
6. Create a two prompt chain over a long document where the first prompt extracts the relevant quotes and the second answers the question using only those quotes.
Chaining splits a hard task into steps that can each be inspected and fixed on their own. It is the simplest pattern behind most multi-step customer workflows.
Explained in: Prompt Chaining | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: The second prompt's answer cites only quotes produced by the first prompt, and you can point to the intermediate output in your workbook.
7. Write a query generation prompt that places a database schema in the context before the request, save it as version one, then save a second version with the schema trimmed to only the needed tables and compare both.
This is context selection in its plainest form: what the model sees decides whether the query is valid. Saving both versions makes the effect of the trimmed context a recorded comparison instead of a memory.
Explained in: Produce MySQL Queries using LLMs | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: Two saved prompt files and two generated queries are in the workbook with a note on which query is valid against the schema.
8. Configure a context layout for one agent step by ordering system instructions, tool descriptions, retrieved documents and conversation history into a single assembled window, following the context engineering guide.
Context engineering is deciding what occupies the window at each step and in what form. Writing the layout down exposes what is redundant, missing or in the wrong place.
Explained in: Context Engineering Guide | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: You have one assembled context file with labeled sections and a count of how many words each section uses.
9. Create the planner and searcher contexts for a small research task by following the deep research agent walkthrough, replacing live web search with three local text files as the documents to select from.
A multi-step agent forces a decision about what to carry forward between steps and what to drop. Local files stand in for search so the exercise runs on a laptop with no paid service.
Explained in: Context Engineering Deep Dive: Building a Deep Research Agent | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: Each step's saved context contains only the plan and the documents that step needs, and the final answer names which local file each claim came from.
10. Compare your saved prompt versions against a fixed set of twenty test inputs with a written success criterion, changing one thing per version, using the prompt optimization guidance.
Iteration without a fixed test set only moves failures around. Changing one thing at a time against stated criteria is what lets you hand a customer a prompt with evidence behind it.
Explained in: Optimizing Prompts | Prompt Engineering Guide (www.promptingguide.ai), checked 2026-10-11
Done when: The results sheet shows a pass rate per prompt version on the same twenty inputs, and the best version is marked along with the single change that produced it.