Sub topic 3
Choosing a Role for the AI: Tutor, Reviewer or Generator
This chapter assumes you can write functions, conditionals and loops in Python, run a script and a simple test from a terminal, and have used a chat-based AI assistant. It gives you a way to decide, before each request, what job the AI is doing for you.
Why the role matters
The same assistant can teach you, check your work, or do the work for you. The AI does not choose among these. Your prompt does. If you don't choose, the default is usually the generator role, because a request like "write a median function" gets you finished code.
Finished code is fine when the task is not what you are trying to learn. It is a problem when the task is the practice. The previous chapters covered how skill grows through effortful practice and retrieval. A role is a decision about who does the effortful part.
The three roles
| Role | The AI does | You do | Best used for |
|---|---|---|---|
| Tutor | Asks questions, gives hints, explains concepts | Write the code and find the fix | Skills you are trying to build |
| Reviewer | Reads your finished attempt and gives feedback | Write first, then decide which feedback to apply | Improving working code, spotting missed cases |
| Generator | Writes code from your description | Specify, read, test and own the result | Boilerplate and tasks that are not your learning target |
Tutor
As a tutor, the AI holds back the answer. You ask for a question, a hint or an explanation of a concept. This is the most effortful role for you, which is why it builds the most skill. The prompt template in the Topic Spine does this: it asks for one guiding question first, then a hint, and a review only after you have fixed the problem.
Reviewer
As a reviewer, the AI sees code you wrote. It can point out unclear names, missing edge cases or a simpler approach. You get feedback on your own thinking, which is more useful than feedback on code you never wrote. Reviewer mode needs an attempt, so it fits naturally after the attempt-first workflow in the next chapter.
Generator
As a generator, the AI produces code for you. This is not forbidden. Generated code speeds up work such as parsing a CSV file or writing a repetitive test setup. The cost is that you skip the practice. If you use this role, you must read the code and verify it with tests you write, covered in later chapters.
Deciding which role to use
Ask two questions before you prompt.
- Is this task something I am trying to learn? If yes, start with the tutor role. If no, the generator role may be fine.
- Do I have an attempt yet? If yes, the reviewer role is available. If no, write one or use the tutor role.
flowchart TDThe diagram below shows the same decision.
Same task, three prompts
Suppose the task is a median function. Each role produces a different prompt.
- Tutor: "I want to write a function that returns the median of a list. Don't show code. Ask me a question that helps me plan the steps."
- Reviewer: "Here is my median function. Don't rewrite it. List any inputs where it could fail, and one readability improvement."
- Generator: "Write a Python median function that raises ValueError on an empty list."
The generator prompt returns something like this:
def median(values):
if not values:
raise ValueError("median() requires at least one value")
ordered = sorted(values)
mid = len(ordered) // 2
if len(ordered) % 2 == 1:
return ordered[mid]
return (ordered[mid - 1] + ordered[mid]) / 2
print(median([3, 1, 2]))
print(median([4, 1, 3, 2]))This prints 2 and 2.5. Getting this code took seconds. If your goal was to learn how to handle odd and even lengths, you have learned very little yet.
Common errors
- Staying in generator mode by habit because it is fastest.
- Asking for a tutor but accepting the first full solution the AI offers. State clearly that you do not want the solution, and repeat it if needed.
- Using the reviewer role without an honest attempt, for example pasting an AI-written answer and asking for a review.
- Treating roles as fixed. Switching is normal: tutor while stuck, reviewer once it works.
Exercise
You are practicing loops and need a function that counts how many words in a list start with a capital letter. You have not written anything yet. Which role should you start with, and what would you ask for?
Show answer
Start with the tutor role, because loops are the skill you are practicing and you have no attempt for a reviewer to look at. Ask for a guiding question or hint without code, for example "Ask me one question that helps me plan how to check each word." After you write a working version, switch to the reviewer role and ask for missed cases such as empty strings.