YouTube2Text

How Anthropic Reviews 30,000 Claude Code Changes a Day — Transcript

by Owain Lewis · 5,602 words · 820 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Today we're talking about how the
  2. 0:00Anthropic team does code review [music]
  3. 0:02at scale on products like Claude Code.
  4. 0:04In just 4 months, the Anthropic team
  5. 0:05went from merging 2,500 changes per day
  6. 0:07[music] to over 30,000, which is a 12x
  7. 0:10increase. And obviously, the traditional
  8. 0:12ways [music] we do code review are going
  9. 0:14to really struggle to keep up with
  10. 0:15AI-generated code. In this video, I'm
  11. 0:17going to show you the six levels of AI
  12. 0:18code reviews that the Anthropic team are
  13. 0:20using. I'll give you some live demos so
  14. 0:22you [music] can see exactly how to apply
  15. 0:23these ideas in your own workflow when
  16. 0:25building with tools like Claude Code or
  17. 0:26Codex.
  18. 0:26>> [music]
  19. 0:27>> If you're new to the channel, my name's
  20. 0:28Owen. I've been a software engineer for
  21. 0:29the past 20 years and I work with
  22. 0:30hundreds of engineers every single day,
  23. 0:32and code review is definitely one of the
  24. 0:33things I see teams really struggling
  25. 0:35with right now. I'll link all of the
  26. 0:37resources from the video, including the
  27. 0:38prompts, in the description below. So,
  28. 0:40let's get into it.
  29. 0:41All right. So, this is the article we're
  30. 0:43going to look at today, which is how the
  31. 0:44Claude Code team [music] does code
  32. 0:46review. And what's really interesting is
  33. 0:4790% of Claude Code's own code base is
  34. 0:50written by AI. I guess that's not
  35. 0:51surprising, but at the level of scale
  36. 0:54Anthropic are at, having this much
  37. 0:57AI-generated code obviously causes
  38. 0:58problems. And this is the same for most
  39. 1:00of us right now, because the problem
  40. 1:02with AI-generated code is we're not
  41. 1:03writing it, and so we don't understand
  42. 1:05it in the same way we would understand
  43. 1:06it if we had written it ourselves by
  44. 1:08hand. And we need to figure out how to
  45. 1:10deal with the increasing volume of code
  46. 1:13and the fact that we're more detached
  47. 1:14from the code than we used to be. A
  48. 1:16really interesting idea that I'm seeing
  49. 1:18in software teams, and I've been
  50. 1:19thinking about a lot myself lately, is
  51. 1:20the theory of constraints. So, even
  52. 1:23though we're using AI to generate more
  53. 1:24code, what I'm seeing is the software
  54. 1:25teams in general aren't actually
  55. 1:27producing more output or moving any
  56. 1:29faster. And this is the theory of
  57. 1:31constraints in action.
  58. 1:32The theory of constraints says that your
  59. 1:34system only moves as fast as the slowest
  60. 1:37part of the process. And even if you
  61. 1:39generate loads of code, AI agents can
  62. 1:41write code in minutes,
  63. 1:42if you can't review that code, or it
  64. 1:44takes a long time to review the code,
  65. 1:46then you're not really going to get much
  66. 1:47of a gain in terms of your productivity
  67. 1:49or your overall output. And I'm seeing
  68. 1:51this a lot lately. So, human code review
  69. 1:53has always been very slow. It's not
  70. 1:56uncommon for a code review change in a
  71. 1:58traditional software team to take
  72. 1:59multiple days. People are busy. They
  73. 2:01also have to get acquainted with
  74. 2:03whatever the code change is. They don't
  75. 2:04have much background on it. So, it just
  76. 2:06takes a really long time to get code
  77. 2:07review done in general.
  78. 2:10But, now if we're producing even more
  79. 2:11code, this problem is only going to get
  80. 2:13much worse. And so, just using the same
  81. 2:16methods we've always done, it just
  82. 2:17doesn't really make sense anymore
  83. 2:18because we're not going to be able to
  84. 2:19keep up with the rate of AI-generated
  85. 2:21code. So, code review has always had two
  86. 2:23jobs. So, the first job is to find and
  87. 2:24fix bugs before they ship into
  88. 2:26production. This is obvious. Every time
  89. 2:28you make a code change, there's pretty
  90. 2:30much always something that can be
  91. 2:31improved or fixed. Humans make mistakes.
  92. 2:34AI agents make mistakes. You can never
  93. 2:36trust the first output. And review just
  94. 2:39really raises the quality bar within a
  95. 2:41team.
  96. 2:42The other reason we do code review is to
  97. 2:44gain a shared understanding of what's
  98. 2:46going on. So, as our agents write the
  99. 2:48code, we still want to know what they're
  100. 2:49doing, right? We still want to
  101. 2:50understand the code base. We still don't
  102. 2:52want to lose track or lose sight of the
  103. 2:53high-level understanding of what's
  104. 2:55actually going on within our software.
  105. 2:57There are some great ideas in this
  106. 2:59article. So, this first comment is
  107. 3:00really insightful. So, we often think
  108. 3:02about did a human read the code? But,
  109. 3:04that's not actually very useful. The
  110. 3:06interesting thing is what could go wrong
  111. 3:07with this change? And which check is the
  112. 3:10right one to catch it? Would it be an
  113. 3:11automated check? Would it be a human
  114. 3:13review? And when you think about code
  115. 3:15review, it's really important to know
  116. 3:16that code review isn't just one level.
  117. 3:19We have like different levels of risk
  118. 3:20for a code review. So, if you're making
  119. 3:22a documentation change, obviously the
  120. 3:23risk of that going wrong is very, very
  121. 3:25low. If you make a mistake and you merge
  122. 3:27it, it's kind of fine, right? It doesn't
  123. 3:29make a difference. So, the blast radius
  124. 3:30of that change is very, very low. But,
  125. 3:32if you're making a change to your
  126. 3:33database or your payment infrastructure,
  127. 3:35if you put a bug into production, that
  128. 3:37could cause like a massive outage.
  129. 3:39Customers could not be able to access
  130. 3:41your services or your systems. And
  131. 3:43obviously the blast radius of that
  132. 3:44change is way higher. So, you always
  133. 3:47want to think about code review at
  134. 3:48different levels of risk. You don't want
  135. 3:50to think about every code change as
  136. 3:51being the same. Human time and attention
  137. 3:53is always going to be a bottleneck when
  138. 3:54it comes to software development, so we
  139. 3:56only want to apply human review where
  140. 3:59it's really needed. And this this idea
  141. 4:01kind of shows up throughout the article.
  142. 4:04So, obviously human attention is
  143. 4:05limited. So, if AI agents are generating
  144. 4:07hundreds of code changes, we can't
  145. 4:09reasonably expect a human to review
  146. 4:10every single one of those changes
  147. 4:12because humans just don't have the time
  148. 4:14or the attention to do that. A really
  149. 4:16great thing about code review is you can
  150. 4:17measure how effective your code review
  151. 4:19process is very very easily. So, you can
  152. 4:22see how long it takes from getting the
  153. 4:24change opened to getting it merged. You
  154. 4:26can also measure things like how often
  155. 4:28does the change go wrong? So, what's the
  156. 4:30revert rate or the defect rate of a code
  157. 4:32change? This is a really easy way to
  158. 4:34measure the quality of your code review
  159. 4:36process. So, if you are in a team, I
  160. 4:38think it's really interesting right now
  161. 4:39to start measuring these things so that
  162. 4:41you can see how your process is
  163. 4:43improving as you start adopting AI.
  164. 4:45We're going to walk through the six
  165. 4:46steps that Anthropic are using to review
  166. 4:48their code. We'll go in depth on each of
  167. 4:50these. So, at a high level, they have a
  168. 4:52local review. So, before they even open
  169. 4:54a code change for review, they make sure
  170. 4:56that it's reviewed locally first. So,
  171. 4:58they run a bunch of automated checks.
  172. 4:59They do testing, build checks, linting
  173. 5:01checks, type checking, and then they're
  174. 5:03using AI agents to review the code with
  175. 5:05a fresh context window.
  176. 5:07Then once they open the change,
  177. 5:09they'll run again a bunch of static
  178. 5:11automated checks to find obvious errors.
  179. 5:14Then they do a Claude code review. So,
  180. 5:16they use an AI agent or multiple AI
  181. 5:18agents to review the code. They run a
  182. 5:20security review,
  183. 5:21and they have this risk-based approval.
  184. 5:24I really love this idea and we'll talk
  185. 5:25about it more
  186. 5:27later in the video. But this idea here
  187. 5:28is that we classify the change as low
  188. 5:31risk, medium risk, or high risk. So, a
  189. 5:32low risk change you could auto merge.
  190. 5:34And then a medium risk change, you'd
  191. 5:36have one person review, and then a high
  192. 5:37risk change, you'd have two people
  193. 5:39review. I think this is a really smart
  194. 5:40strategy. And then they also have a way
  195. 5:43of rolling out their changes to internal
  196. 5:45teams so they can get feedback. And they
  197. 5:47gradually roll out their changes, and
  198. 5:49then if they do deploy into production,
  199. 5:51they have a way of rolling back if there
  200. 5:53are any errors, because in reality, code
  201. 5:55review is not perfect. If it was, we
  202. 5:57wouldn't have bugs in production, so you
  203. 5:59still want to assume that code review is
  204. 6:01flawed. It's not a perfect process,
  205. 6:03right? All right, so step one is to do a
  206. 6:05local review. A lot of people are
  207. 6:06probably already doing this, but once
  208. 6:08you've had your agent write the code,
  209. 6:09you want to ask a sub agent or a fresh
  210. 6:11agent to review the code base. This
  211. 6:13could be using Claude, or it could be
  212. 6:15using another agent like Codex. So, if
  213. 6:17you're using Claude code, you could ask
  214. 6:19the Codex agent to review the code or
  215. 6:21vice versa. So, this is obviously a best
  216. 6:23practice, and if you're working with AI,
  217. 6:26you should always review the code. Even
  218. 6:27though AI is capable and smart, just
  219. 6:29like a human, the first time you write a
  220. 6:32piece of code, whether you're an AI
  221. 6:33agent or a human, chances are there's
  222. 6:36going to be a bug or something that can
  223. 6:37be improved, right? No AI agent writes
  224. 6:40perfect code the first time, and so this
  225. 6:41is why code review is so important.
  226. 6:44Boris, who's the creator of Claude code,
  227. 6:46has said that this process of doing like
  228. 6:48an iteration locally will make the final
  229. 6:51result two to three times better, and I
  230. 6:53think that makes sense to me, because
  231. 6:55every time I look at an AI-generated
  232. 6:56code change, there's always some kind of
  233. 6:59problem. If you ask a sub agent to
  234. 7:01review your code, chances are they're
  235. 7:03going to find a problem. So, I think
  236. 7:05this step is really, really important. A
  237. 7:07really interesting idea that they talk
  238. 7:08about here that I've been using myself
  239. 7:11is this idea of a review.md file. So,
  240. 7:14the concept here is that if you think
  241. 7:15about a code review, you're not really
  242. 7:17reviewing a general change. You're
  243. 7:20normally focusing on specific areas. So,
  244. 7:22if you're building a payments
  245. 7:23application, you probably want to pay a
  246. 7:25lot of attention to security, and, you
  247. 7:27know, making sure authorization and
  248. 7:30things like that are correct. If you're
  249. 7:31working on a web application, maybe you
  250. 7:33want to spend a lot of time reviewing
  251. 7:34the UI. Maybe you want to spend a lot of
  252. 7:36time looking at database performance.
  253. 7:38So, every different application or every
  254. 7:40every software application you work on,
  255. 7:42you're going to want to focus on
  256. 7:43slightly different things.
  257. 7:45And that's the idea behind this
  258. 7:46review.md file. You can create this
  259. 7:48file, ask your agents to read it, and
  260. 7:50then they will focus on specific things
  261. 7:52that you want them to focus on.
  262. 7:54So, this is an example of a review.md
  263. 7:56file. So, we can tell the agent what's
  264. 7:59important to us when it does the code
  265. 8:00review. So, we can say how to present
  266. 8:03the findings. We can say, you know,
  267. 8:06don't look at the linting or formatting.
  268. 8:09Don't look at these particular folders.
  269. 8:11You know, don't include email addresses
  270. 8:14or user information in logs. Pay
  271. 8:16specific attention to that. So, this is
  272. 8:18a really great way of just focusing your
  273. 8:20agent to look at particular things when
  274. 8:22it's doing the code review. Like I said,
  275. 8:24all you need to do is have this file
  276. 8:26in your codebase, and then you can ask
  277. 8:28your agents to reference or read that
  278. 8:29file. Here's an example from my own
  279. 8:31project. So, this is a project that I'm
  280. 8:33working on a software factory, and you
  281. 8:35can see here that we're focusing on how
  282. 8:36to do the code review. So, we're saying
  283. 8:38here to focus on classifying the changes
  284. 8:41as low-risk, or medium-risk, or
  285. 8:42high-risk. And we're giving some
  286. 8:44guidance about what these things mean.
  287. 8:46And then we're also just giving it just
  288. 8:48general guidance on what to pay
  289. 8:50attention to in this specific codebase.
  290. 8:53Okay, so the next step is to do an AI
  291. 8:55review on every pull request. So, the
  292. 8:57idea here is that once you push your
  293. 8:58code change up to something like GitHub,
  294. 9:00you run an automated code review. You
  295. 9:02get an AI agent to review your code.
  296. 9:04There are so many different ways to do
  297. 9:05this. You could use a tool like Code
  298. 9:07Rabbit or Griptile. You could also use
  299. 9:10Code itself, or CodeX, which is what I
  300. 9:12use, to just run a basically a basic
  301. 9:15review of your code change. So, what I
  302. 9:17want to show you now is the two commands
  303. 9:18that you can run inside Code Code
  304. 9:21that are worth remembering. So, the
  305. 9:22first command we're going to do is
  306. 9:24{slash} code review. So, this is
  307. 9:26obviously just going to do a code
  308. 9:27review.
  309. 9:28And then the other command we can also
  310. 9:30run as well to be aware of is the
  311. 9:32{slash} security review command within
  312. 9:34Code Code. So, if you type {slash}
  313. 9:36security review,
  314. 9:38you can you can actually focus it on
  315. 9:40particular files. So, for example,
  316. 9:42review this particular file or the
  317. 9:43uncommitted changes. You can pass in
  318. 9:46some additional context as you do the
  319. 9:47{slash} command
  320. 9:48>> [music]
  321. 9:48>> to maybe focus it on a particular area
  322. 9:50or particular topic.
  323. 9:52So, the code review agent has come back
  324. 9:53already and it's detected a bunch of
  325. 9:55errors.
  326. 9:56So, as you can see, I added a I added an
  327. 9:58SQL vulnerability just to see if it
  328. 10:00caught it. So, you can see here we have
  329. 10:01some serious issues. So, SQL injection,
  330. 10:04um no auth on this particular endpoint,
  331. 10:07and then we have correctness as well.
  332. 10:10So, things that we need to fix like
  333. 10:12logical errors. This thing is never
  334. 10:14checked. Um and then also quality as
  335. 10:17well. So,
  336. 10:20you can then just ask the agent to
  337. 10:22obviously just go through and fix those.
  338. 10:24You probably want to run this a couple
  339. 10:25of times. You probably want to go
  340. 10:26through, have the agent fix these
  341. 10:27things, and then run it again. You can
  342. 10:29also focus the code review on a
  343. 10:31particular topic. So, maybe you want to
  344. 10:32focus on, you know, review documentation
  345. 10:35or something.
  346. 10:36Uh you can kind of focus the review on
  347. 10:38different things depending on what
  348. 10:39you're doing. So, we're getting back the
  349. 10:41feedback now from the code review agent.
  350. 10:44You can see here it's giving pretty good
  351. 10:45feedback. So, we've got a nine out of 10
  352. 10:47confidence on the SQL injection.
  353. 10:49And you can see here description. So,
  354. 10:51this is a much more thorough review than
  355. 10:53the just general code review. You'll
  356. 10:54notice we did pick this up as well in
  357. 10:56the regular review, but this is
  358. 10:58obviously gone into much more detail.
  359. 11:00So, you can see here
  360. 11:01uh listening on the loopback at a
  361. 11:03predictable port.
  362. 11:05Uh it's giving us quite a lot of, you
  363. 11:06know, useful feedback here. So, we've
  364. 11:08got some recommendations on the SQL
  365. 11:10statements.
  366. 11:12There's another vulnerability here with
  367. 11:13path traversal. So, you can see this is
  368. 11:16really useful. You're getting more
  369. 11:17detail from the security review. It's
  370. 11:18finding It's going much more in-depth.
  371. 11:20>> [music]
  372. 11:20>> And the general code review is also
  373. 11:22catching a lot of these errors, but it's
  374. 11:23not going in quite as much depth. So, I
  375. 11:25recommend running both of those at the
  376. 11:27same time. So, one suggestion I have
  377. 11:29that might help you to always remember
  378. 11:31to do this because in reality we get
  379. 11:33tired, we forget to do things. So, what
  380. 11:36I recommend doing is becoming more
  381. 11:38systematic in your development process.
  382. 11:40And so, what I mean by this is moving to
  383. 11:41more of a factory mindset where we take
  384. 11:44a task, we run it through the same
  385. 11:45series of steps every time in a really
  386. 11:48repeatable way. So, this is an example
  387. 11:50of a factory plugin that I've been
  388. 11:52building. But, you can see here I have
  389. 11:54different agents for different steps of
  390. 11:55the process. We have a implementer agent
  391. 11:58which will take the code change and then
  392. 12:00write the code. But, then we also have a
  393. 12:02review agent.
  394. 12:04We have a security review agent.
  395. 12:06We have a UX review agent. So, you
  396. 12:09reviewing the browser, uh reviewing like
  397. 12:11what the web app looks like using
  398. 12:13browser testing and things like that.
  399. 12:15We also have a triage
  400. 12:17agent and we have a classifier agent
  401. 12:19that will change the risk level on the
  402. 12:21ticket. It will add a label to the
  403. 12:23GitHub issue,
  404. 12:24uh depending on what kind of change it
  405. 12:26is. And what you can do is you can
  406. 12:28combine all of these into some kind of
  407. 12:29sequence
  408. 12:30so that you can pretty much just give a
  409. 12:32single command, pass in a task, and then
  410. 12:34have the agent run through all of these
  411. 12:36different steps every single time. And
  412. 12:38this is moving to the factory mindset
  413. 12:40where you're no longer ad hoc prompting
  414. 12:42these agents. You're becoming much more
  415. 12:44rigorous and systematic about your
  416. 12:46development process. And I think this is
  417. 12:47the key to really getting the quality
  418. 12:50when it comes to AI agents. You don't
  419. 12:51need to make this complicated. I don't
  420. 12:53think you need that many skills. I don't
  421. 12:55have a complex setup. I don't think you
  422. 12:57need to install loads of different
  423. 12:58complex skills at all anymore. As agents
  424. 13:00get smarter, you can keep your setup
  425. 13:02pretty minimal. But, what you do want to
  426. 13:04have is the repeatability and the
  427. 13:05predictability in your workflow or your
  428. 13:07process. So, we can test out this idea
  429. 13:10of being more rigorous within our
  430. 13:12development process to make sure we
  431. 13:13always run a security review or we
  432. 13:15always run a code review every time we
  433. 13:17make a change, always review the linting
  434. 13:19and the tooling that we need. So, the
  435. 13:21way you can do that is to build some
  436. 13:22kind of factory system. So, this This a
  437. 13:25plugin that I've been building called
  438. 13:26software factory. This is just a bunch
  439. 13:28of code code sub agents essentially that
  440. 13:30are chained together. So you can see
  441. 13:32here we can do a review.
  442. 13:34And we can optionally pass in some
  443. 13:36information. So this is basically making
  444. 13:38your process more systematic. You can
  445. 13:41basically pass in a task and then have
  446. 13:43the agent do the same thing every single
  447. 13:45time. So this review command is
  448. 13:46combining multiple different things. So
  449. 13:48it's combining a regular code review,
  450. 13:50but it's also running a security review.
  451. 13:52So rather than having to type all of
  452. 13:53these individual commands, rather than
  453. 13:55having to remember to prompt in a
  454. 13:57certain way, you can just basically have
  455. 13:59a single command that will take your
  456. 14:01change and remember to do all of the
  457. 14:03right steps every single time. So this
  458. 14:04is just making your process really
  459. 14:06repeatable. You could even just do this
  460. 14:08at a higher level, which is what I tend
  461. 14:10to do where I just pass in a task and
  462. 14:12then have the factory just run the
  463. 14:14entire change through a series of steps.
  464. 14:17Planning, building, testing, reviewing,
  465. 14:20etc. So you can kind of do it that way.
  466. 14:22So this is the idea from the Anthropic
  467. 14:24article. We classify this as medium
  468. 14:26risk. So we need to get one human
  469. 14:28approval. Another way you can do this is
  470. 14:30to run the entire pipeline. So rather
  471. 14:31than just having one command to review
  472. 14:32your code, you can literally just take a
  473. 14:34task and then run it through all of the
  474. 14:36series of steps every single time. So
  475. 14:37I'm going to take this ticket. So what
  476. 14:39I'm going to do is type software
  477. 14:40factory.
  478. 14:42And I'm actually just going to pass in
  479. 14:44the specific ticket here. So we're going
  480. 14:45to do Neo
  481. 14:47345. Let's do 345.
  482. 14:50And so what we can do here is just
  483. 14:52basically work on a task. And we're
  484. 14:54going to hand this off to lots of
  485. 14:55different sub as we go. So we're going
  486. 14:57to triage the ticket.
  487. 14:59And then we're going to basically build
  488. 15:00or write the code. We're then going to
  489. 15:02review the code using all of these
  490. 15:04different sub agents and all of these
  491. 15:05different tactics that we've talked
  492. 15:06about. So again, all I'm doing here is
  493. 15:09just passing in the task. And because
  494. 15:11I've encoded the workflow into the
  495. 15:13software factory or into the system, I
  496. 15:15don't really have to think about these
  497. 15:16steps. I'm just making sure that I'm
  498. 15:18doing them every single time, which is
  499. 15:20the really important thing when it comes
  500. 15:22to this kind of thing, cuz as I said,
  501. 15:24you will you will forget to do a code
  502. 15:25review or you will forget to run the
  503. 15:27security review command. But when you do
  504. 15:29it this way, the agent is always
  505. 15:31following the right steps. It's always
  506. 15:33doing the right thing. It's always
  507. 15:34running the classifier. So this is kind
  508. 15:36of the approach that I've been moving to
  509. 15:37myself when it comes to agentic coding.
  510. 15:41One of the things I'm doing personally,
  511. 15:42and I really like this idea, is this
  512. 15:44notion of a triage. Again, this is a
  513. 15:46software factory idea. But what I'm
  514. 15:48doing is that I'm building this change.
  515. 15:50I'm writing out the entire spec.
  516. 15:53So I'm taking a very rough problem
  517. 15:56description, like a very vague input,
  518. 15:58and then I'm I'm using an agent to
  519. 16:00triage the the original request and
  520. 16:03break it out into more of a spec. So you
  521. 16:05can see here, this is a very detailed
  522. 16:07breakdown now. We've added labels, and
  523. 16:10we've basically done a spec. So this is
  524. 16:12where we're using the software factory
  525. 16:13approach of we're taking a task, we're
  526. 16:16getting the agent to write a fairly
  527. 16:17detailed specification that we can then
  528. 16:19review if we want to.
  529. 16:21We can then have the agent build the
  530. 16:22code. We can then run all of the
  531. 16:23automated checks, the code review, and
  532. 16:26there's also often
  533. 16:28things like these acceptance checks as
  534. 16:29well. So when you run your code review,
  535. 16:31it's really important to reference these
  536. 16:33checks. So in your original plan, we've
  537. 16:36got a bunch of cases that we also want
  538. 16:38to test for. So when we do the code
  539. 16:39review, this is something else you want
  540. 16:41to pay attention to. Does the code do
  541. 16:43what it's meant to do? Does the code
  542. 16:44actually meet all of the requirements?
  543. 16:46All of the different acceptance checks
  544. 16:48that you came up with when you
  545. 16:50originally decided to build this. So
  546. 16:51this is just a really useful thing to
  547. 16:52think about. Having these acceptance
  548. 16:54checks, when you do your code review
  549. 16:56process, make sure that you're
  550. 16:57referencing those acceptance criteria,
  551. 17:00and you're going to make sure that the
  552. 17:01code actually does what it's meant to
  553. 17:02do.
  554. 17:03The third step is to do a security
  555. 17:06review. So this is actually built into
  556. 17:08Claude code. There's a {slash} security
  557. 17:10review command that you can use. And the
  558. 17:13idea here is we want to catch any,
  559. 17:14obviously like security vulnerabilities
  560. 17:17within the code base. I would say you
  561. 17:19want to run this maybe periodically. You
  562. 17:21don't want to run this every single time
  563. 17:22you make a code change. I would also
  564. 17:24suggest automating this because in
  565. 17:26reality, most of us are going to forget
  566. 17:28to run this command. So, there's a good
  567. 17:30article on this. So, this is the
  568. 17:31automated security review command, but
  569. 17:33you're looking for things like SQL
  570. 17:36injection risk, cross-site scripting,
  571. 17:38authentication authorization flaws,
  572. 17:40insecure data handling, you know, lack
  573. 17:42of validation, and vulnerable
  574. 17:44dependencies. Step four is using
  575. 17:46deterministic automated checks, things
  576. 17:48like linting, type checking. If you're
  577. 17:51not familiar, these are tools that you
  578. 17:52can run that will find obvious errors in
  579. 17:54your code. They've been around forever,
  580. 17:56and most developers are already using
  581. 17:58these things. A great way to do this is
  582. 18:00to ask your agents to configure these
  583. 18:02for your particular language. Depending
  584. 18:04on what language you're using, there'll
  585. 18:06be different tooling. So, what I would
  586. 18:08do is when I start a project, I would
  587. 18:09ask the agent to set this up for me,
  588. 18:11both locally and then also on GitHub.
  589. 18:13The agent will configure it all for you.
  590. 18:15So, type checking, make sure your code
  591. 18:17builds correctly. There are language
  592. 18:19specific formatters and things like that
  593. 18:21that you can run just every time you
  594. 18:23make a code change essentially. Step
  595. 18:25number five is human approval scaled by
  596. 18:27risk. This is my favorite part of the
  597. 18:29whole article, and I think this is such
  598. 18:30a smart way to think about code review.
  599. 18:32So, they use a classifier to decide
  600. 18:35whether a code change is high risk, low
  601. 18:36risk, or medium risk. And this is really
  602. 18:39important because you always want to
  603. 18:40think about the blast radius of a
  604. 18:41change. You don't want to have multiple
  605. 18:43people reviewing a documentation change,
  606. 18:45for example, because that would be a
  607. 18:46massive waste of people's time. If it's
  608. 18:48a small trivial change, I think it makes
  609. 18:51sense for have the agents auto merge
  610. 18:53that change. You kind of want to trust
  611. 18:55the agents at some point. But if it's a
  612. 18:58medium risk change, like a large
  613. 18:59feature, you can get one person to
  614. 19:01review that change. If it's a higher
  615. 19:03risk code change, like a database change
  616. 19:05or an infrastructure change, which would
  617. 19:06have a much higher blast radius, then
  618. 19:08you can have two people review that
  619. 19:10change. I think this is a pragmatic and
  620. 19:13smart way to think about code review.
  621. 19:15They also make sure that whoever made
  622. 19:17the change is on the hook for it. So,
  623. 19:18even though AI agents are writing the
  624. 19:20code, obviously we're still responsible
  625. 19:22for making sure that the code change is
  626. 19:24high quality. Step number six is about
  627. 19:26gradual release. So, essentially what
  628. 19:28they'll do is they'll roll out their
  629. 19:29change to internal teams first. This
  630. 19:31gives them a way of getting feedback on
  631. 19:33issues before it goes out to the public.
  632. 19:35Step seven is about fast detection and
  633. 19:37fast rollback. The idea here is that
  634. 19:40code review is not perfect. It doesn't
  635. 19:42matter how good your agents are. Doesn't
  636. 19:44matter how good your setup is. You're
  637. 19:46never going to catch every single
  638. 19:47possible error in a code review, right?
  639. 19:49You can only find certain types of
  640. 19:51errors once you deploy your change into
  641. 19:53production. Things like memory leaks,
  642. 19:55performance issues, it's very hard to
  643. 19:57detect them just by looking at the code
  644. 19:59itself. So, you always want to assume
  645. 20:01that your code review process is not
  646. 20:03perfect. And so, what they do is if they
  647. 20:05roll out a change that has a problem,
  648. 20:07they can roll it back really really
  649. 20:08quickly. They also do a periodic, you
  650. 20:12know, on-call review. They do an
  651. 20:13incident review. This is good practice
  652. 20:15within the team. So, every week you'll
  653. 20:16get together, you'll look at the last
  654. 20:18week's code changes, find problematic
  655. 20:20areas, and then improve your process to
  656. 20:22catch those areas in future. The
  657. 20:24Anthropic team take this further by
  658. 20:26essentially using past mistakes where
  659. 20:29you've gone through a code review
  660. 20:30process, you haven't caught the error.
  661. 20:32So, what they'll do is they'll use these
  662. 20:33as evals or feedback for future
  663. 20:35reviewers. So, if they've made a
  664. 20:37database change that got through the
  665. 20:39code review process, but actually caused
  666. 20:41an error in production, they will use
  667. 20:43that as a test or kind of context for an
  668. 20:45agent to pay specific attention to that
  669. 20:48next time. It's really important that
  670. 20:49humans still stay in the loop,
  671. 20:51obviously. So, humans have context that
  672. 20:53AI agents don't. Personally, I am quite
  673. 20:55comfortable now auto merging certain
  674. 20:57types of change. And I think as AI
  675. 20:59agents get better, this is starting to
  676. 21:01make more sense. We have to trust the
  677. 21:03agents a little bit at some point. But,
  678. 21:05there's still times where you do need a
  679. 21:07human in the loop. Obviously, anything
  680. 21:09that's risky, humans often have a lot
  681. 21:11more context. They can spot things that
  682. 21:13the AI agents can't, but then equally AI
  683. 21:15agents will spot things that human
  684. 21:16humans can't. So, you always want to
  685. 21:18combine these two things. The other
  686. 21:20thing which I think is really important
  687. 21:21when it comes to code review is you
  688. 21:22still need to understand at a high level
  689. 21:24what's going on with your code. So, even
  690. 21:27though the agents are writing the code,
  691. 21:28you still want to understand what's
  692. 21:30going on, what the change is doing, what
  693. 21:31the impact is, and how it affects the
  694. 21:33overall architecture of your system. One
  695. 21:35thing you can do that will really help
  696. 21:36you when it comes to code review and
  697. 21:38code changes is to ask your agents to
  698. 21:40write you an explainer. So, you can get
  699. 21:42the agent to write a HTML page with a
  700. 21:44diagram, explain to you what the change
  701. 21:46is, and it can help you really
  702. 21:48understand what the code change is and
  703. 21:50what the potential risk is. So, this is
  704. 21:51a really great technique if you want to
  705. 21:53understand or more easily get a feel for
  706. 21:56what the agent is doing.
  707. 21:58So, what I'm going to do here is even
  708. 21:59though this code change is running, I'm
  709. 22:01going to see if Claude can do this in
  710. 22:02the background. So, I'm going to say,
  711. 22:03"Generate me a HTML explainer showing
  712. 22:07what this change is and include
  713. 22:11a diagram to help me understand it."
  714. 22:16So, we can just ask Claude to generate
  715. 22:17these HTML explainer docs. Very useful
  716. 22:20technique to understand, especially if
  717. 22:22you're working on a larger code change,
  718. 22:24and especially if you're context
  719. 22:25switching or coming back later on.
  720. 22:27Having the agent generate some kind of
  721. 22:29visual diagram help you kind of remember
  722. 22:32what the change is, help you understand
  723. 22:34it a bit more uh in depth. So, this is
  724. 22:36the explainer that it generated. You can
  725. 22:38see here, you can obviously customize
  726. 22:39this to make it easier to understand.
  727. 22:41Often, I find it quite hard to
  728. 22:43understand some of the output from these
  729. 22:45agents nowadays. They're not very good
  730. 22:47at explaining things.
  731. 22:49But you can see here, we've got
  732. 22:50diagrams. You can kind of see the
  733. 22:51process of what's going on, and you can
  734. 22:53see a way to recreate it, and it's
  735. 22:55giving you kind of a just a way to kind
  736. 22:57of understand the change in more depth,
  737. 22:59basically. So, this is just a really
  738. 23:01useful technique to help you walk
  739. 23:03through the code change, internalize
  740. 23:05what's going on, and just have a better
  741. 23:06understanding. So, this is a recap of
  742. 23:08what they suggest. So, before you open a
  743. 23:10code change, make sure that you run a
  744. 23:12bunch of, you know, automatic formatting
  745. 23:14and linting. You can use a Claude code
  746. 23:16hook for this, or you could just have a
  747. 23:19like a pre-hook with Git, so it
  748. 23:21automatically reviews before you push
  749. 23:22your change. Run the {slash} code review
  750. 23:24command and the {slash} security review
  751. 23:26command locally,
  752. 23:28or use a fresh sub-agent. I always use a
  753. 23:30fresh sub-agent. I think that's a much
  754. 23:32better practice. So, generally that's
  755. 23:34what I'm I'm doing. And then also add a
  756. 23:36review.md file
  757. 23:38to move any specific things you want to
  758. 23:40focus on with your code review. Anytime
  759. 23:42you find like persistent problems, put
  760. 23:44them into your review.md file, so that
  761. 23:46the agent can focus on those in future.
  762. 23:48Once you push your change, you want to
  763. 23:49make sure that you've got an AI
  764. 23:50reviewer. I'm using Code X, and I
  765. 23:52sometimes use Code Rabbit and other
  766. 23:53tools. There's loads of different
  767. 23:54options here. Graptile is another great
  768. 23:56one.
  769. 23:57Um make sure you tune your review.md
  770. 23:59file, automatically run security
  771. 24:01reviews, and match the review effort to
  772. 24:04the risk. Again, I think this is one of
  773. 24:06the main takeaways to remember when it
  774. 24:08comes to code review. You don't want to
  775. 24:10spend as much time on routine changes.
  776. 24:12You want to use human judgment for it
  777. 24:13where it's really important. Higher
  778. 24:15risk, more important, more significant
  779. 24:17changes. You don't want to waste your
  780. 24:19human time and attention on really
  781. 24:20trivial code changes. Finally, make sure
  782. 24:23after you've merged, obviously, you
  783. 24:24know, start learning from these changes.
  784. 24:27Learn from what fails in your code
  785. 24:28review. Learn from what didn't work in
  786. 24:30your code review process, and then
  787. 24:32continually refine and improve it. So,
  788. 24:33my final takeaway from this article is
  789. 24:35to make sure that you're using multiple
  790. 24:37levels of code review. You can check
  791. 24:39quality at many different levels, and
  792. 24:42quality comes from iteration.
  793. 24:44Even if you're the best developer in the
  794. 24:46world, you're still going to make
  795. 24:47mistakes. So, you always need to check
  796. 24:50your work. You always need to refine it
  797. 24:51and iterate. Quality always comes from
  798. 24:53iteration. And it's the The thing with
  799. 24:55AI agents. It doesn't matter how smart
  800. 24:57the AI agents get, you always need to
  801. 24:59review the code because chances are
  802. 25:01there's something that can be improved.
  803. 25:03No one ever gets it right on the first
  804. 25:04try. So, this iterative approach to
  805. 25:07review, refining, and improving your
  806. 25:09code changes is the way that you get
  807. 25:11quality at scale. So, verification,
  808. 25:14automated checking, AI review, human
  809. 25:17review when it's needed, and making sure
  810. 25:19that you've got a good process to
  811. 25:20continually improve, monitor, and
  812. 25:22measure your code review process. I do
  813. 25:25recommend measuring and improving your
  814. 25:27code review process over time.
  815. 25:29Thanks again for watching. If you've got
  816. 25:30any questions, do let me know. I'll link
  817. 25:32all of the resources and the prompts in
  818. 25:34the description below.
  819. 25:35Thanks again, and I'll see you in the
  820. 25:36next one. Take care.

About this transcript

This page contains the full transcript of How Anthropic Reviews 30,000 Claude Code Changes a Day by Owain Lewis, generated from the public captions YouTube serves with the video. The transcript has 5,602 words across 820 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.