Sub topic 1
What the Assistant Sees: Your Prompt Is Its Only View of the Task
Prerequisites
Assume you have basic programming experience, can run code and tests, and have used a chat-based or editor-integrated assistant. This chapter uses Python examples, but the method applies to other languages.
What the Assistant Sees
An assistant can use only the information available in the conversation and any files or tools explicitly provided to it. It cannot see your unstated goals, project conventions, dependency versions, or error history.
A vague request leaves important decisions open. The assistant must guess the language, input rules, allowed libraries, and desired response. Those guesses may produce code that looks reasonable but does not fit your project.
Start with a Specific, Testable Goal
State one result that you can check. Include the operation, the input, and the expected output or behavior.
“Write a function to clean up titles” is underspecified. A stronger goal names the language, function signature, and transformation:
Write a Python 3.10 function slugify(text: str) -> str.
Convert an article title to a lowercase URL slug.
Replace each run of non-alphanumeric characters with one hyphen.
Remove leading and trailing hyphens.
Use only the standard library.This goal is testable because each rule can become an assertion. It also limits the assistant’s choices. If the result must fit an existing module, state that requirement too.
Add the Context the Assistant Cannot See
Add facts that change the implementation:
- The language and version.
- The framework and relevant dependencies.
- The existing function or surrounding code.
- The error message and the input that caused it.
- Performance, compatibility, or deployment requirements.
- What the assistant must not change.
Keep context relevant. A complete project dump can hide the important details. Include the smallest code sample that shows the interface and the problem.
Exercise
What is missing from the request “Fix this parser”?
Show answer
It lacks the goal, language and version, relevant code, failing input, observed error, and definition of the correct result.