You ask an AI to add a CSV export button. It produces convincing code, but the columns are wrong and nobody ran the export.
Rewriting the request may help. It may also leave the real problem untouched. The assistant could be missing the current data format, or it could lack a way to run the code and inspect the result.
Prompt engineering shapes the request. Context engineering chooses the information available while the model works. Harness engineering builds the surrounding software that supplies tools, manages execution and checks progress.
The boundaries overlap. These terms are useful when they help you identify what failed and choose a smaller, more effective fix.
Prompt engineering makes the job clear
A prompt tells the model what you want and what a useful answer looks like. It can include the audience, constraints, output format and examples.
Consider a fictional yoga studio’s booking app. “Add CSV export” leaves many decisions open. A more useful request would be:
Add an export for the bookings currently shown on screen. Include booking ID, class date, class name and booking status in that order. Exclude customer contact details. Keep the existing filters. Show the proposed approach before changing code.
Now the assistant has a concrete target. You can compare the result with the request instead of deciding afterward what “done” should have meant.
For a small writing or formatting task, clearer instructions may be the whole fix. You do not need an agent system to turn a paragraph into three bullet points.
If the immediate problem is wording a request, start with the free AI prompt templates and add the task-specific details above.
Context engineering supplies the right evidence
Context is the information the model can use for the current work. That may include your instructions, conversation history, selected files, tool results and reference material.
For the fictional export task, useful context would include the current booking type, the filter code, a sample row and the project’s existing CSV helper. A six-month-old design note could actively mislead the assistant.
Anthropic’s context engineering guide emphasizes selecting useful information as an agent works. More material is not automatically better. The aim is relevant evidence with enough room to reason about it.
Before another attempt, give the assistant a short source map:
- Current behavior: the screen and files that implement the booking list.
- Required output: one sample CSV with the expected columns.
- Constraints: the fields that must stay private.
- Authority: which current document wins if two files disagree.
This adds information the original request could not supply by wording alone. It also makes missing information easier to notice.
Harness engineering makes work executable and checkable
A harness is the software around the model. Depending on the system, it can manage tool access, approvals, files, repeated calls, tests, limits and saved progress.
Claude Code’s documentation provides one concrete example of an agentic loop with tools and permissions. Other products implement these pieces differently.
For our export task, a useful harness would let the assistant inspect approved files, make a scoped edit and run relevant checks. It would also provide a way to open the generated CSV and compare it with the sample.
“The code looks right” is weaker evidence than an actual export with the right headers and rows. Neither proves every possible case, so record what the check covered.
Longer jobs also need continuity. Anthropic’s work on long-running agent harnesses describes how structured progress records and incremental work can help an agent continue across sessions.
A harness should have stopping rules too. For this task, a sensible rule is to stop after a failed verification, report the failure and avoid widening the change to unrelated screens.
Diagnose the failure before adding complexity
These clues are starting points, not a perfect classification:
- Wrong format or unclear scope: improve the prompt and show one acceptable example.
- Wrong facts or outdated assumptions: improve the context and identify the current source.
- No evidence that the work ran: improve the tools and verification around the model.
- Changes beyond your request: tighten both the instructions and enforceable permissions.
For example, if the CSV has the wrong column order, fix the expected-output example first. If it includes bookings hidden by a filter, inspect which code and state the assistant used. If it claims success without creating a file, require an actual export check.
A brief you can reuse
Fill in these fields before handing off a task. They work for writing and research as well as code:
Goal: Produce [specific deliverable] for [reader or user].
Sources: Use [current files or links]. Treat [named source] as authoritative when sources conflict.
Limits: Work only within [scope]. Ask before [specific consequential action].
Done: Check [observable result] against [example or criterion].
Handoff: Report what changed, what you checked and anything still uncertain.
A written instruction is not an access control. If the task must never send emails or modify production data, configure the tools and permissions accordingly.
The free AI prompts page has practical templates for checking a plan and asking for better evidence. Start with one unreliable task, identify the missing piece and improve that piece before building a bigger workflow.



