The Junior Shipped It in a Day. Then He Couldn't Explain It
The agent can write code a junior cannot write yet. Make him explain it with the agent closed, and use the agent as a tutor before a typist.
"Why did I get the same reminder three times? Is your system ok?"
Nadia forwarded this to our team channel on a Tuesday at 08:15. Nadia leads sales, and this email came from a clinic owner she had onboarded the week before. Under it she wrote: "Third one this morning. Can someone look?"
We build appointment software for small practices. Physiotherapists, dentists, a few beauty studios. One of the most loved features is boring: 24 hours before an appointment, the patient gets a reminder email. Fewer no shows, happy practice owners.
The reminder job was brand new. Tobi built it the week before.
Shipped in a day
Tobi is our junior. Eight months with us, his first real job after university. He is smart, fast, and he grew up as a developer with an agent next to him. He never knew this job without one.
He took the reminder ticket on Monday morning and opened the pull request on Monday afternoon. Clean Kotlin, a scheduled job every five minutes, a query for appointments in the next 24 hours, a template, tests. The tests were green. I reviewed it, I saw nothing wrong, I approved it. So this is my bug too, let me say that first.
The code looked roughly like this:
@Scheduled(fixedDelay = 300_000)
fun sendReminders() {
reminderRepository.findDueAndNotSent().forEach { reminder ->
mailer.send(reminder)
reminderRepository.markSent(reminder.id)
}
}On a laptop, perfect. In production we run the backend on three instances. Every instance has its own scheduler. Every instance wakes up, reads the same reminders, sends them, and marks them as sent. Three instances, three emails.
When I wrote my message in the channel, Tobi already had the agent open. Ten minutes later he pinged me: "Fixed. I added a check if the reminder is already sent before sending."
I looked at the diff. He added an if (!reminder.sent) inside the loop. The reminders were read a few milliseconds before, by all three instances at the same moment. The check would almost never help.
I was a bit frustrated, honestly. Not with Tobi. With the speed. The bug came fast, the fix came fast, and both were wrong in the same quiet way.
"Explain it to me without the agent"
I did not fix it myself. That would take me twenty minutes, and Tobi would learn nothing except that the senior fixes things.
So I took a call with him and asked one question: "Our backend runs three times. Walk me through what happens at 09:00:00 on each instance."
He started well. Instance one wakes up, reads the due reminders. Then he stopped. "Instance two... also reads them?" Yes. "But the first one marks them as sent." When? "After sending." And how long does sending take? He was quiet for a moment, and then he said the thing that I respect him for: "I don't actually know how this runs in production. I never thought about it."
He knew Kotlin. He knew Spring. He knew how to get an agent to write a scheduled job in ten minutes. But nobody ever made him think about two copies of his code running at the same second. In my generation we learned this the painful way, with a cron job on two servers and an angry customer. He learned the painful way too, only faster.
The agent can write the code a junior cannot write yet. It cannot give him the picture in his head that tells him the code is wrong.
Meanwhile Nadia came to my desk. "I asked ChatGPT about it," she said, a little proud. "It says the job must be idempotent. Is that the problem?"
And here is the funny part: she was right. She did not know exactly what the word means, but she had the correct word. I told her yes, exactly that, and explained it in one sentence: if the same thing happens twice, the result must be the same as once. She said "like pressing the elevator button twice". Better than my explanation.
The agent as a tutor, not a typist
I did not want to ban the agent. That would be silly, and he would only use it in secret. I wanted him to use it differently for one hour.
So we wrote this prompt together:
Do not write or change any code.
Our Spring Boot service runs on 3 instances.
I will explain what my reminder job does when all 3 run at the same time.
Find the mistakes in my explanation. Ask me one question at a time.
At the end, show me 3 ways teams solve this, with the trade-offs.This was the agent at its best. It asked Tobi what happens if an instance crashes between send and markSent. It asked what happens during a deploy, when old and new instances overlap for a minute. That was where the third email came from, by the way. It did not lecture him. It let him find the holes himself.
Then it gave three options. A distributed lock with ShedLock, so only one instance runs the job. A database row lock with SELECT ... FOR UPDATE SKIP LOCKED. Or an atomic claim: update the row only if nobody has claimed it yet, and only the winner sends.
Tobi asked me which one. I asked him back which one he can explain to Nadia. He picked the atomic claim, and he wrote it himself, by hand:
// Claim first. Only one instance can win this update.
val claimed = jdbc.update(
"UPDATE reminder SET sent_at = now() WHERE id = ? AND sent_at IS NULL",
reminder.id
)
if (claimed == 1) {
mailer.send(reminder)
}Then he explained to me the trade-off without my help: if the instance dies after the claim and before the email, that reminder is lost. Never twice, sometimes zero. For a reminder email, we decided that is fine. For a payment it would not be. I was very happy he said that sentence himself.
After that, he gave the keyboard back to the agent for the test. A test that starts three threads, runs the job on all of them at once, and counts the emails. First run with his old code: three emails. With the new code: one. Then the agent suggested to run it a hundred times in a loop, because concurrency bugs like to hide. Good idea. Still one.
The fix went live at 15:00. Nadia wrote the clinic owner a short, honest email. The owner answered with a thumbs up and one question about invoices. Life goes on.
What I changed for our juniors
The bug was small. What I learned about how we teach was bigger. So we made a few rules, and the seniors follow them too.
- Explain the PR with the agent closed. Before I approve a pull request from a junior, he walks me through it in his own words. If he cannot explain one part, that part is not ready, even if the tests are green.
- Ask "what if this runs twice?" For every job, consumer and webhook handler, the author writes one line in the PR: what happens if it runs twice at the same time, and what happens if it crashes in the middle.
- Use tutor mode for new concepts. When a junior meets something new, like locking, transactions or caching, the first prompt is "do not write code, check my understanding". Code comes after.
- Let the agent write the nasty test. Juniors write the core logic by hand. The agent writes the test that tries to break it with threads, retries and weird timing. It is very good at that.
- Take the buzzword seriously. When a non technical colleague brings a word from ChatGPT, ask what she thinks it means. Sometimes, like with Nadia, it is exactly the right word.
I still think about the review I approved. I looked at clean code and green tests and my brain said "fine". The agent made Tobi fast. My job is to make sure he also gets the slow part, the picture in the head, because nobody can prompt that for him.
How do you teach juniors on your team, now that the agent can write everything they cannot yet understand?

If this was useful
Telc German B1 Exam Success Kit (20/80 Rule)
The 20% of German that keeps showing up in the telc B1 exam. Learn it first and walk in already knowing what to expect. €7.99