AI 编程智能体指令里的“Write Clean Code”只是愿望,不是可执行指令
Original title: "Write Clean Code" Is a Hope, Not an Instruction
The title and summary in the selected language are awaiting translation.
针对 AI 编程智能体指令文件中常见的“写整洁代码”“用 TDD”“遵循 SOLID”等表述,作者指出这些说法本身没错,但都不是可自我执行的指令。智能体主要复用代码库中已有的模式,在好坏混杂的真实代码库里,这类指令只是表达愿望。作者主张改为展示好与坏的具体样例,并让智能体证明自己实际遵循了哪些模式、在哪里应用、如何验证结果。
Use TDD. Refactor carefully. Follow SOLID. Use design patterns. Write clean code. I've seen agent instruction files full of phrases like this. The problem isn't that any of it is wrong. It's that none of it is self-executing.
An AI coding agent mostly remixes what it already finds in the codebase. If the surrounding code has clear boundaries, strong tests, consistent naming, and good examples, you have a real chance of useful output. But most real codebases are mixed, some good patterns, some old shortcuts, some accidental complexity, a few "don't touch that" corners, and code that made sense three years ago and now quietly works against the team. Drop "write clean code" into that and you are not setting a standard. You are expressing a hope.
The concrete version works better. Show the agent what good looks like and what bad looks like. Show it which patterns matter in this repo and which to avoid. Then the part most teams skip, make it prove what it actually followed.
The reviewer should not have to guess whether the agent met the team's engineering standards. The agent should show what it looked at, what it applied, where it applied it, and how it verified the result. That is the difference between putting best practices in an instruction file and building them into the delivery workflow.
"Write clean code" is a hope. "Show me which pattern you followed, and prove it held" is an operating model.
Source: Johnny Butler · Agentic Engineering · world.hey.com