SteelReed

Search

Search posts, questions…

8. Senior Skills

Mentoring for senior engineers: teaching newcomers when AI writes their code

Senior-level mentoring multiplies the team, and when juniors learn alongside AI, a clean PR no longer proves understanding: onboarding, pairing, review as teaching, SBI feedback, delegating at the right level of guidance, docs that teach, handling disagreement, and the 'explain it' rule for AI-written code.

18 Nov 20268 min readSenior

–

1. The problem

Three months in, a junior opens 6 tidy PRs a week with green tests, because an agent writes most of it. At 2 a.m. a payment IPN is retried and a customer's booking is confirmed twice. The on-call is that junior: 3 hours without being able to explain the handler they merged.

2. Key idea

Mentoring is helping someone grow faster than they would alone. Working code used to signal learning; now AI produces working code the author doesn't need to understand.

Anthropic ran a randomised trial with 52 engineers learning the async library Trio: the AI group scored 50% on a comprehension test, the hand-coding group 67%, with the biggest gap on debugging questions. The issue isn't the tool but who does the struggling.

Signal Before AI With AI
Tidy PR, green tests fairly sure they understood only proves the agent writes well
Debugging incidents alone, explaining designs learned still the best signal

2.1 How much guidance?

Pick by the person's skill with this specific task, then reduce it. The same person can own REST APIs yet need step-by-step guidance with Kafka.

Approach Use when Don't use when
Do it yourself (then explain) security bugs, urgent incidents monthly recurring work: teaching once is cheaper
Pairing, junior at the keyboard hard debugging, a new module simple repetitive work
By hand first, no AI first time learning transactions, concurrency, idempotency boilerplate, mapping, test data
AI writes, the learner explains fundamentals in place, speed matters the learner can't debug that part yet

In reviews, at most 2–3 teaching points per PR, and ask before you tell. Praise in public, critique in private.

3. Worked example

SBI feedback
S: During Tuesday afternoon's deploy,
B: you merged the migration PR while CI was red and without an approval,
I: so staging was broken for two hours and QA had to stop testing.
Ask: What pressure were you under then?  Agree: how do we do it next time?
 
Delegation (propose, then I approve)
Outcome: no PENDING transaction older than 30 minutes goes unnoticed.
Constraints: respect the gateway's rate limit, never change a SUCCESS state.
When to ask: anything touching refunds, call me.
 
Questions when reviewing AI-written code
"If we delete this line, which test goes red?"  "What if the IPN arrives twice?"

SBI describes observable behaviour, not character ("you're careless"). A delegation always states the outcome, constraints and when to ask.

Onboarding and pairing
Milestone Work
Before day 1 Access, machine; a "good first issue" picked in advance
Days 1–2 Service running locally; read the C4 context diagram
Week 1 First PR (fix a log, add a test); one pairing session; watch a deploy
30 / 60 / 90 days 3–5 PRs and local debugging / one feature from ticket to production / first person asked about a module
  • Don't onboard with a week of reading the wiki: little sticks and broken setup stays hidden. If setup takes more than half a day, fix the setup docs.
  • Strong-style pairing: the senior navigates, the junior types; ideas must pass through someone else's hands into the computer. Think aloud ("I read the stack trace bottom-up because…").
  • Weekly 1:1s in the first month with three fixed questions: where are you stuck, what in the team is confusing, what do you want to learn next.

4. Working with AI

Delegate to AI: drafting onboarding docs from the README and runbooks, turning old incidents into debugging drills, playing a "questions-only tutor" for juniors.

Check when a mentee submits a PR with AI-written code:

  • They can explain every line and answer "if we delete this line, which test goes red?".
  • Edge cases are tested: timeouts, duplicate calls, nulls, bad data.
  • They've done the newly learned fundamentals by hand at least once.
  • The PR description says why this approach, not pasted AI text.

5. Exercises

Exercise 1: Review a PR "written by the agent, tests green"

Find the bug, write a teaching-style review comment, name a test.

JAVA
@Transactional
public void onIpn(IpnRequest req) {
    verifySignature(req);
    Payment p = payments.findByTxnRef(req.txnRef()).orElseThrow();
    p.markPaid(req.amount());
    bookings.confirm(p.bookingId());
}
Solution to Exercise 1
  • Bug: not idempotent. The gateway retries the IPN when it doesn't get a response, so the second call still runs markPaid and confirm. It also never compares req.amount() with the stored amount.
  • Comment: "If the gateway sends this IPN twice, 5 seconds apart, how many times does confirm run? Try writing a test that calls onIpn twice with the same txnRef."
  • Test: twice with the same txnRef, confirm runs exactly once; a mismatched amount is rejected. Fix: only PENDING may become PAID, or a unique constraint on the IPN processing record.
  • Mentoring: this is fundamental, so the junior writes the fix after explaining the IPN flow on paper.

Exercise 2: Read a mentee's signals

After 8 weeks: 31 merged PRs (team average 12), review rounds per PR up from 1.5 to 3, two on-call escalations, and in recent 1:1s they say "I'm fine". Diagnose and plan two weeks.

Solution to Exercise 2
  • Diagnosis: high output, low understanding. More review rounds and escalations show they can't fix or debug what they ship. "I'm fine" signals they don't feel safe asking.
  • Two weeks: a private SBI conversation about the numbers, not character, then ask where they're stuck. Two strong-style pairing sessions on those very incidents. Upcoming PRs carry 3 answers: why this approach, which test proves it, which log to check if it breaks.
  • Measure again: review rounds and one shadowed on-call shift.

Summary

  • Mentoring is part of a senior's job; measure it by what others can do alone.
  • A tidy PR doesn't prove understanding; debugging alone does.
  • First PR in production in week 1.
  • SBI feedback: observable behaviour, impact, then ask.
  • Pick guidance per task; hand over problems, don't do it for them.

Further reading: Effective code review.

Practice interview questions on this topic

All Behavioral questions →

Loading comments…
Next on the roadmapProblem solving like a senior: definitions, causal diagrams, 5 Whys and a checklist