Track 02 · Hướng dẫn
AGENTS.md, README dành cho agent
Giới thiệu định dạng AGENTS.md để đưa ngữ cảnh và chỉ dẫn của dự án cho agent lập trình.
Bài này giới thiệu AGENTS.md và cách viết một file AGENTS.md tối giản cho dự án của bạn.
AGENTS.md là gì
AGENTS.md là một định dạng mở, đơn giản để hướng dẫn agent lập trình.
Hãy coi AGENTS.md như một README dành cho agent: một nơi riêng, dễ đoán để cung cấp ngữ cảnh (context) và chỉ dẫn, giúp AI agent làm việc trên dự án của bạn.
Ví dụ tối giản
Dưới đây là ví dụ tối giản của một file AGENTS.md:
markdown
# Sample AGENTS.md file
## Dev environment tips
- Use `pnpm dlx turbo run where <project_name>` to jump to a package instead of scanning with `ls`.
- Run `pnpm install --filter <project_name>` to add the package to your workspace so Vite, ESLint, and TypeScript can see it.
- Use `pnpm create vite@latest <project_name> -- --template react-ts` to spin up a new React + Vite package with TypeScript checks ready.
- Check the name field inside each package's package.json to confirm the right name—skip the top-level one.
## Testing instructions
- Find the CI plan in the .github/workflows folder.
- Run `pnpm turbo run test --filter <project_name>` to run every check defined for that package.
- From the package root you can just call `pnpm test`. The commit should pass all tests before you merge.
- To focus on one step, add the Vitest pattern: `pnpm vitest run -t "<test name>"`.
- Fix any test or type errors until the whole suite is green.
- After moving files or changing imports, run `pnpm lint --filter <project_name>` to be sure ESLint and TypeScript rules still pass.
- Add or update tests for the code you change, even if nobody asked.
## PR instructions
- Title format: [<project_name>] <Title>
- Always run `pnpm lint` and `pnpm test` before committing.
Website
Repo của dự án còn có một website Next.js đơn giản tại https://agents.md/, giải thích mục tiêu của dự án và đưa thêm một số ví dụ.
Nguồn
- Dịch và biên tập từ agentsmd/agents.md · README.md, giấy phép MIT.