Contents

"Learning to Code with AI" Series — Article 4/7
RSS
RSS sends new articles to the reader of your choice, without an algorithm or newsletter.
TL;DR
To learn, don’t systematically ask for the solution. Ask for a question, a hint, a comparison, or a review. The agent becomes truly useful when it adapts to your understanding and forces you to articulate your own reasoning.
The Best Teacher Doesn’t Always Write the Answer on the Board
A coding agent can quickly produce a complete implementation. That’s precisely why you should sometimes ask it not to.
If you’re stuck on retrieving metrics for our dashboard, the quickest request would be:
Write the function that retrieves the metrics and displays them in React.
You’ll likely get code. But the initial block will remain: where to fetch the data, how to represent its state, and how to handle an error?
A pedagogical approach starts by making this block visible.
Socratic Mode: The Agent Asks the Questions
I want to retrieve server metrics and display them in the dashboard.
Do not provide the solution or modify any files.
Ask me one question at a time to verify that I understand:
- where to make the call;
- how to represent loading, success, and error states;
- why a TypeScript response isn’t enough to validate the received data.
After each of my answers, correct only the major misunderstandings.
This method forces the junior developer to recall what they already know. It also shows precisely where uncertainty begins.
Asking for Progressive Hints
A complete answer is sometimes necessary. It shouldn’t be the first level of help.
I’m stuck on this error.
Don’t fix the code immediately.
Give me:
1. an orienting question;
2. if I’m still stuck, a conceptual hint;
3. only then, a small independent example;
4. only provide the correction to my file at my explicit request.
The agent then becomes a scaffolding system. Help increases only when personal attempts fall short.
Showing Your Attempt, Even If It’s Flawed
An imperfect first version is excellent pedagogical material:
export async function getMetrics() {
const response = await fetch('/api/metrics')
return response.json()
}
Instead of asking, “Improve this code,” ask:
Here’s my first attempt.
Start by rephrasing what my code actually does.
Then indicate:
- what’s correct;
- the two most significant risks;
- a question that helps me find the next modification myself.
Don’t write the final version yet.
The junior developer thus learns that fetch can fail, that an unsuccessful HTTP response must be handled, and that response.json() provides an external value requiring real validation.
Comparing Multiple Solutions
AI tends to present its first proposal as natural. Development, however, involves trade-offs.
For retrieving metrics, ask for two approaches: directly in a server page or via an intermediate route. Then demand a comparison based on concrete criteria: simplicity, exposure of secrets, caching, testability, and error handling.
The goal isn’t to choose the most sophisticated solution. It’s to understand why a solution fits the current context.
Explaining Vocabulary Through Code
Abstract explanations quickly become fragile. Ask the agent to connect each concept to the project:
Explain the difference between static typing and runtime validation.
Use the API response from our dashboard as an example.
Then show an error that TypeScript alone can’t prevent.
End with a short question to check my understanding.
A concept is truly learned when it can be recognized in another context, not when a definition has been memorized.
Turning Errors Into Exercises
After fixing a bug, ask the agent to create a variant:
Based on the error we just fixed, create a 10-minute exercise.
Change the context and names so I can’t copy the solution.
Provide only the instructions and success criteria.
If the initial problem involved an potentially missing value, the exercise might use a user profile or a payment response. The principle remains the same, but the junior developer must make the transfer themselves.
Ending Each Session With a Recap
At the end of a task, ask:
Ask me five short questions about the decisions made today.
Don’t reveal the answers before I attempt them.
Focus on transferable concepts, not file names.
Then write your own note: what you thought, what was wrong, how you verified it, and in what other case this knowledge could be useful.
When to Allow the Agent to Write Code
Pedagogical mode doesn’t mean you should type everything manually forever.
The agent can handle:
- a mechanical modification you understand;
- generating a validated skeleton;
- adding already defined test cases;
- a refactoring with explicit constraints;
- a repetitive task with verifiable results.
The level of autonomy should follow your ability to control. The more you understand the terrain, the more you can delegate execution without delegating decision-making.
The Sign That the Method Is Working
Over time, your prompts should become more precise and sometimes shorter. You’ll better understand the problem’s boundaries. You’ll spot unnecessary proposals faster. You’ll less often ask for everything to be regenerated.
The goal isn’t to become independent of AI. It’s to avoid becoming helpless without it.
In the next article, we’ll see how to concretely control what the agent produces using Git, diffs, and tests.
