홈 / Skills / 개발 생산성 / Writing for Agents 에이전트용 문서 작성
개발 생산성

Writing for Agents 에이전트용 문서 작성

Matt PocockMITSkill 언어: 영어
라이선스 확인됨스크립트 없음
데모실행 기록 · claude-opus-5-5 · 2026년 10월
Can you improve this CLAUDE.md for our repo? Agents keep ignoring parts of it. ```markdown # Project Guidelines This is a Next.js 15 app using the App Router with TypeScript. We use pnpm as our package manager. The scripts are in package.json. ## Important Rules - Please always make sure to be very careful and thorough when making changes. - Don't use npm or yarn. Don't use npm or yarn under any circumstances, always use pnpm. - Never ever use the `any` type. - Run `pnpm lint` and `pnpm test` before you finish. - Don't put business logic in React components. - Make sure you write good code that follows best practices. ## Database We use Prisma with PostgreSQL. The schema is at prisma/schema.prisma. When you change the schema you need to run `pnpm prisma migrate dev --name <name>` and you also need to run `pnpm prisma generate` afterwards, otherwise the types will be out of date and things won't compile. Don't forget to run prisma generate!! ## Testing We use Vitest. Tests live next to the code in `*.test.ts` files. Run `pnpm test`. Please don't forget to run tests before finishing. ## Style Use Tailwind for styling. Don't write CSS files. Don't use inline styles. Don't use styled-components. ```
Skill: writing-for-agents

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:

  1. 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.
  2. 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.
  3. 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 use any" as a hard limit, paired with the alternative.
  4. 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.
  5. Turned the Prisma steps into a numbered list instead of a paragraph ending in "Don't forget!!".
  6. 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, 링크된 문서를 예측 가능하게 만들 수 있다는 것입니다. 에이전트는 실행할 때마다 같은 과정을 밟아야 하기 때문입니다.

작동 방식

  1. 컨텍스트 포인터: skill 설명이나 AGENTS.md의 한 줄의 표현이, 그 뒤의 내용에 언제 얼마나 확실하게 도달할지를 정합니다.
  2. 두 가지 비용: 무언가를 추가할 때마다 컨텍스트(항상 불러오는 글)나 사람의 주의(어떤 문서가 있는지 기억하기) 중 하나를 씁니다.
  3. 정보 계층: 단계는 본문에, 참고 자료는 포인터 뒤에 두어 문서가 비대해지지 않게 합니다.
  4. 완료 기준: 각 단계를 확인할 수 있는 조건으로 끝내 에이전트가 일찍 멈추지 않게 합니다.
  5. 가지치기: 의미마다 출처는 한 곳, 모델이 어차피 따르는 문장은 삭제, '하지 말 것'보다 '할 것'을 적습니다.
  6. 또 다른 파일은 skill 고유의 선택을 다룹니다. frontmatter, 사용자 전용과 모델 호출 가능의 차이, 라우터 skill.

이럴 때 좋습니다

skill, CLAUDE.md, AGENTS.md를 쓰거나 다듬을 때.

알아 둘 점

저희 테스트에서는 샘플 CLAUDE.md를 다시 쓰고 변경 사항을 하나씩 설명했으며, 디렉터리 이름을 지어내는 대신 TODO를 남겼습니다.

참고 및 위험

지시문만 담긴 파일로, 스크립트가 없고 네트워크에 연결하지 않습니다. 파일 수정을 요청하면 에이전트가 프로젝트의 해당 파일에 쓸 수 있습니다. 패키지에는 원본 저장소의 MIT 라이선스(LICENSE)와 agents/openai.yaml(Codex용 표시 이름)도 들어 있습니다.