The main problem is that the important rules are hard to spot among filler. Here's a rewrite:
# Project Guidelines
Next.js 15 (App Router) + TypeScript, managed with **pnpm**. Scripts are in `package.json`.
## Rules
- Run every package and script command through `pnpm` (`pnpm add`, `pnpm dlx`, `pnpm <script>`). The lockfile is `pnpm-lock.yaml`, and running another package manager corrupts it.
- Use precise types everywhere. For data whose shape you don't know yet, use `unknown` and narrow it with type guards or a schema. Never use `any`.
- Keep React components presentational. Put business logic in <!-- TODO: e.g. `src/lib/` or `src/server/` --> and call it from the component.
- Style with Tailwind utility classes only.
## Database (Prisma + PostgreSQL)
After any edit to `prisma/schema.prisma`, run both commands, in this order:
1. `pnpm prisma migrate dev --name <descriptive_name>`
2. `pnpm prisma generate`
If you skip step 2, the generated types go stale and the build fails in ways that are hard to trace back.
## Testing
Vitest. Put each test next to its source file as `<name>.test.ts`.
## Done means
You're finished only when both commands pass with zero errors on your final change:
- `pnpm lint`
- `pnpm test`
What I changed and why:
- Cut lines that don't change behavior. "Be careful and thorough" and "write good code that follows best practices" are things the agent already tries to do. They make the file longer and draw attention away from the rules that matter.
- Gave each rule one home. "Run tests" appeared twice and "use pnpm" was said twice in one bullet. When an instruction is repeated, it's hard to tell how important it is compared with the rest. Lint and test now live in a single Done means section at the end, where the agent checks whether it's finished.
- Said what to do, not just what to avoid. Rules like "Don't use npm or yarn", "Never use
any", and "Don't write CSS / inline / styled-components" put the banned thing front and center. Each rule now names what to use instead (pnpm,unknown+ narrowing, Tailwind classes). I kept "Never useany" as a hard limit, paired with the alternative. - Added the reasons agents can't figure out on their own. The lockfile damage and the stale Prisma types are why those rules exist. A rule that comes with its reason is less likely to be dropped as optional.
- Turned the Prisma steps into a numbered list instead of a paragraph ending in "Don't forget!!".
- Made "finished" checkable. "Run lint and test" became "both pass with zero errors". Before, an agent could run the tests, see failures, and still stop.
One thing for you to fill in: "Don't put business logic in components" probably gets ignored because the agent doesn't know where that logic should go. Replace the TODO with your real directory, such as src/lib/ or server actions in app/**/actions.ts.
Optional: if agents still use npm or skip lint, put it in a hook instead of the doc. A PreToolUse hook can block npm/yarn commands, and a Stop hook can run pnpm lint && pnpm test. I can set either one up with /update-config if you want.
Real run recorded with claude-code / claude-opus-5-5. Output is shown verbatim, unmodified.
它做什么
一份关于如何写任何"给代理读的文档"的指南。出发点是:同样的几个杠杆,就能让 skill、CLAUDE.md 或被链接的文档变得可预测,因为代理每次运行都应该走同样的流程。
工作方式
- 上下文指针: skill 的描述、AGENTS.md 里的一行字,其措辞决定了代理何时、多可靠地去读它背后的内容。
- 两种成本: 每新增一项,要么占用上下文(始终加载的文字),要么占用人的注意力(记得有哪些文档)。
- 信息层级: 步骤放主文件,参考资料放到指针后面,避免文档臃肿。
- 完成标准: 每一步以可检查的条件结束,避免代理提前收工。
- 精简: 每个意思只在一处写,删掉模型本来就会遵守的句子,用"要做什么"代替"禁止什么"。
- 另一份文件讲 skill 特有的取舍:frontmatter、仅用户可调用与模型可调用、路由类 skill。
适合场景
编写或精简 skill、CLAUDE.md、AGENTS.md。
需要了解
我们试用时,它改写了一份示例 CLAUDE.md,逐条解释了改动,并留下一个 TODO,而不是替你编一个目录名。
纯指令文件:没有脚本、不联网。 当你要求它修改某个文件时,代理可能会写入你项目里的那个文件。 压缩包里另有原仓库的 MIT 协议文件 LICENSE 和 agents/openai.yaml(供 Codex 使用的显示名)。