LearnThatStack Ace your next interview

AI in Engineering Teams

Team practices for shipping code with AI agents Checked Sep 2026 6 code snippets

The model

  • AI makes code cheap to write, not cheap to check. Verification is the bottleneck, so an AI-native process is built to reject wrong work early.
  • Whoever submits a change owns every line. "The AI wrote it" never answers a review question.
  • A spec and tests written first give the agent a contract. Without them you get plausible code you can't judge.
  • Set review depth by risk. Ask what a mistake would cost, whether you could undo it and whether anyone would notice.
  • Count outcomes like lead time, rework and escaped defects. Lines, commits and acceptance rate climb on their own once AI writes code.
Youowns the changeAgentdrafts the codeCheckstypes, tests, scansReviewerjudges by riskFORWARDspec + testssmall diffgreen + evidenceBACKred fix and rerunsent back unexplained
Drafting is cheap, so each step is there to send wrong work BACK early. Machines check what they can, and a person judges the rest.

AI-native workflow

how a team hands work to AI and stays in control

AI-native, not vibe coding

Say what makes a team AI-nativeSpecs and tests guide its agents. Risk gates limit them.
Judge whether AI adoption is workingDelivery quality, effort and defects, not tool adoption.
Define vibe codingAccepting AI code unread. Karpathy coined it in 2025.
Say when vibe coding is fineThrowaway prototypes, never code a team maintains.

TipAdding AI tools to an unchanged process isn't AI-native.

TrapIn an AI interview round, accepting unread code fails you.

Replace prompt-and-pray

Name the prompt-and-pray anti-patternSend a vague request, accept a big result, hope it works.
Start a task the healthy wayGoal, criteria, context and non-goals. Plan big work first.
Size each stepSmall batches. Read each diff and check it before the next.

TipWhen a result is wrong, fix the spec or context, then rerun.

TrapDon't let an agent run risky commands without your approval.

Review AI code

catch what fluent code hides

Review AI code at least as hard

Say why AI code needs a full reviewFluent code hides wrong assumptions and insecure patterns.
Read an AI-written diffRead all of it, and compare what it does with the requirement.
Know where to look hardestEdge cases, failures, auth, secrets and external calls.
Review the tests it wroteCheck them separately. They can repeat the code's mistake.

TrapAI can widen a change. Look for edits outside the task.

Catch a hallucinated API

Define a hallucinated APIAn invented method or option with a real-sounding name.
Catch one before it shipsThe compiler flags it. In dynamic code, run a quick test.
Check a package before you install itnpm view <package>Look at its registry entry, publisher and source.

TipCheck unfamiliar calls in the docs for your version.

TrapModels invent package names. Attackers register them.

Spot plausible-but-wrong code

Define plausible-but-wrong codeCode that compiles and looks right but breaks a subtle rule.
Give a classic exampleAn endpoint checks login but never who owns the record.
Say why experienced reviewers miss itFamiliar structure lulls them, and big diffs cause fatigue.
Build a taxonomy of AI-typical defectsGroup defects by cause, with a detection and a prevention.

TipStart from the requirement and try to prove the code wrong.

TrapClean style doesn't show the author knew the domain rules.

Review AI code for security

Catch authentication without authorizationWrite abuse and privilege tests.
Catch injection or sensitive data in logsUse taint analysis and redaction checks.
Catch agents with broad permissionsLeast privilege, plus human approval for risky actions.
Catch unsafe retries or exposed secretsThreat-model the change and test its failure paths.

TipReview what a change exposes, not whether AI wrote it.

TrapIn one study, AI users wrote less secure code, yet more often believed it secure.

Set trust per change

Ask what a mistake would costSecurity, money or irreversible steps need the most care.
Ask whether a failure would showDelayed or hidden failures need more review than obvious ones.
Ask whether it can be checked exactlyExact, independent checks earn trust. Subjective ones don't.

TipFamiliar patterns, small diffs and narrow permissions help.

TrapDon't give the model a fixed trust score. Rate each change.

Review at team scale

keep review ahead of what agents produce

When PR volume doubles

Set the pace after agents double PR volumeReview capacity sets it, not how much agents can generate.
Set what every PR must carryA small diff, acceptance criteria, test evidence and risks.
Take mechanical checks off reviewersAutomate format, type, dependency, secret and security checks.

TipTrack queue time, rework and escaped defects.

TrapSend back AI work its author can't explain.

Gate changes by risk tier

Gate a low-risk change, like docsAutomated checks and owner review.
Gate a medium-risk change, like domain logicFocused integration tests and domain review.
Gate a high-risk change, like auth or paymentsSecurity or architecture approval, then a staged rollout.
Keep the gates honestAudit a sample of merges. Tune gates by rework and incidents.

TipEvery tier blocks secrets, surprise packages and weakened tests.

TrapTier by what a change could break, not by who wrote it.

Beat the verification bottleneck

Cut what humans must checkCodemods, strong types, property tests and static analysis.
Rebuild the lifecycle around checkingAcceptance tests first, sandboxed agents, staged rollouts.

TipCap work in progress at your real review capacity.

TrapAsking reviewers to skim faster only hides the bottleneck.

Refuse AI slop PRs

Define an AI slop pull requestWork the author generated but never understood or checked.
Say why maintainers find it harmfulIt shifts the checking onto them, and polish hides defects.

TipSigns are vague claims, unrelated edits and weak tests.

TrapIf the author can't explain it, it isn't ready for review.

Disclose AI help

Decide whether to disclose AI helpFollow repo policy. Volunteer it when it helps reviewers.
Write the disclosure noteThe tool, what it drafted, your checks and any doubts.
Credit the tool the Linux kernel waygit commit --trailer "Assisted-by: <tool>"The kernel also bars AI agents from adding Signed-off-by.

TipIn a study of 281 open-source AI policies, most allowed AI help and nearly half required disclosure.

TrapDisclosure never moves ownership. You still own every line.

Tests as guardrails

tests the agent has to pass, not rewrite

Guide an agent with TDD

Start the loopReview one test and confirm it fails for the right reason.
Ask for the codeThe smallest implementation that makes that test pass.
Stop the agent weakening the testBlock test edits you haven't approved.
Grow the contractAdd edge cases and failure paths, then rerun the checks.

TipThe agent runs the test itself, so feedback comes fast.

TrapA green suite proves only the cases it tests.

Audit AI-written tests

Name the biggest risk in AI-written testsCode and tests share one wrong reading of the requirement.
Spot weak AI testsTautologies, heavy mocking, snapshots, no edge cases.
Make them worth trustingTake expected results from a spec. Read every assertion.

TrapHigh coverage can still miss realistic faults.

The test oracle problem

modeltestscode
same sourceBoth come from one model, so the tests share its misreading and pass.
specmodeltestscode
independentThe tests come from a reviewed spec, so a misread in the code fails them.
Define the test oracle problemDeciding what the correct expected result is.
Get expected results the model didn't inventA reviewed spec, an expert, an old version or a math rule.

TipMetamorphic tests check relations. Adding a search filter never adds results.

TrapMore tests can't fix an assumption they all share.

Test with properties

Define property-based testingCheck a rule on many generated inputs, not a few examples.
Name useful propertiesSerialize then parse returns the value. Sorting keeps every item.

TipThe tool shrinks each failure to a small counterexample.

TrapMore inputs can't fix a wrong invariant.

Debug with a model

evidence picks the cause, not a fluent story

Debug by hypothesis

Say what a talking rubber duck addsIt challenges assumptions, proposes causes and experiments.
Open a debugging chatObserved and expected behavior, and one testable hypothesis.
Pick the next experimentThe smallest safe one that tells the leading causes apart.
Fix the bug once evidence backs a causeWrite a test that reproduces it first, then fix it.

TipKeep facts, guesses and results apart in the chat.

TrapA fluent story can anchor you. Only evidence decides.

Read logs and stack traces with AI

Give it the right evidenceExact error, key frames, timing, environment, recent change.
Clean logs before you paste themRemove credentials, personal data and customer payloads.
Ask for a reading you can checkObservations with cited lines, then ranked causes to test.

TipFeed back each exact result, so each round narrows the cause.

TrapA whole log dump invites a diagnosis with no evidence.

Migrations & refactors

change thousands of files and prove it

Codemod or agent

Rename a deprecated function everywhereA codemod. Review its one rule and a sample of results.
Migrate tests whose setup differs per fileAn agent. Review each decision it makes.
Combine the twoAn agent drafts a codemod. Test it on a sample, then run it.
Preview a jscodeshift codemod without writing filesnpx jscodeshift -t transform.js src --dry --print

TipUse the most deterministic tool that can do the job.

TrapAgent output varies run to run. Review its edits separately.

Migrate in verified batches

Set the migration patternDefine the target. Migrate one area by hand and review it.
Check each batchgit grep -n "oldFunction("Run tests, types and static rules. Search for old usage left.
Finish safelyIntegration tests, realistic data and a tested rollback plan.

TipUse feature flags or dual reads for risky batches.

TrapTrack progress from the repo, not the agent's claims.

Docs & agent config

docs that people and agents can trust

Generate docs with AI

Check an AI summary or release noteIt can invent behavior. Check each claim against the code.
Check AI-written examplesThey can hold outdated syntax. Run them in CI.

TipGenerate API docs from schemas, and give pages owners.

TrapFluent AI text looks finished even when it's wrong.

Keep docs fresh

Stop docs drifting from the codeUpdate them in the same pull request as the code or config.
Catch broken docs automaticallyRun their commands, links and code samples in CI.
Find the pages a change affectsLet AI flag them, and have a person confirm.

TipGive key guides a review date. Delete ownerless pages.

TrapStale docs now mislead coding agents as well as people.

Write docs agents can use

Say what docs for AI must holdBoundaries, public contracts and why odd choices were made.
Give agents the commandsThe exact setup, build, test and operational commands.
Help retrieval tools find thingsStable terms, clear headings, maybe an llms.txt index.

TipGenerate the model-facing copy from the human docs.

TrapNever keep a key rule only in an image or meeting notes.

Policy, vendors & IP

the rules a company writes and enforces

Write an AI usage policy

Cover the toolsApproved vendors and their retention and training terms.
Cover the dataWhich data may go in a prompt, and rules for credentials.
Cover agents and peopleAgent permissions and sandboxing. Human ownership and review.
Roll AI out across 500 engineersBy repo risk tier. Pilot against a baseline, then expand.

TipEnforce it with managed settings, scanning and CI.

TrapPause adoption when generation outgrows safe review.

Manage licensing and IP risk

Name the IP risk in AI codeAI code can resemble licensed source, with no known origin.
Turn on public-code matchingIt blocks matches with public code, or cites the source.
Honor a customer contract's limitsTurn it into repo rules, like Copilot content exclusion.

TipScan licenses in CI, and take disputes to counsel.

TrapA vendor's assurances don't replace your own review.

Metrics & tech debt

measure outcomes AI can't inflate

Metrics that resist gaming

State Goodhart's lawA measure stops working once it becomes a target.
Pair each metric with a counter-metricLead time with review delay, defects with rework and reverts.
Name the metrics that stay meaningfulOutcomes. Delivery, quality, reliability, maintainability.
Never set targets for theseLines, prompts, commits, acceptance rate and PR count.

TipPublish how you use telemetry. Never rank individuals.

TrapA change after AI adoption doesn't prove AI caused it.

Control AI tech debt

Curb duplicationTrack it, and make assistants look for existing helpers first.
Spot churnWatch for early rewrites, reverts and deletions of new code.
Keep people able to run the codeFind code few people understand, and rotate people onto it.

TipClean up measured hotspots, and count deletion as progress.

TrapNever turn AI attribution into a performance score.

Skills, juniors & hiring

keep people able to work without the tool

Avoid skill atrophy

Keep your own reasoning sharpForm your own hypothesis before you ask the model.
Stay able to explain AI codeRead every AI diff, and explain its key behavior unaided.
Decide which skills to develop deeplyProblem framing, architecture, security, debugging and ops.
Decide what to delegateBoilerplate and mechanical work, where checks are strong.

TipPractice fundamentals by hand, and explain decisions to others.

TrapLosing the assistant should slow the team, not stop it.

Found this useful? Pass it on.
Pro · $10/mo

This sheet stays free. With Pro, you can:

  • Every answer on this sheet. Read the full answer to all 49 questions it links, not just the 7 free ones.
  • My sheet. The cards you star and the ones you miss in Quiz me, from every sheet, on one page to quiz and print.
  • PDFs. Download this sheet and My sheet, laid out for A4, with every question a link to its answer.
  • The rest of Pro. Every answer in the question library, and 1,000 AI credits a month.