AGENTS.md 簡介講義:給 Codex 的簡單專案規則

這份講義的目標

AGENTS.md 是放在 Codex 專案最上層的文字檔。它的用途很簡單:告訴 Codex 在這個專案中應該怎麼工作。

這份講義只討論最簡單的 Codex project。假設你的 project 裡只有目前要處理的檔案,目標是讓 Codex 知道基本工作規則。

AGENTS.md 是什麼

當你用 Codex 開啟一個 project 時,Codex 會在這個 project 裡讀取、建立或修改檔案。AGENTS.md 就是寫給 Codex 的專案規則。

它可以說明:

AGENTS.md 不需要寫得很長。能讓 Codex 少猜一點,就是有用的規則。

最簡單的 Codex AGENTS.md

下面是一份非常簡單的版本。它只描述 Codex 在目前 project 裡的基本工作方式。

# AGENTS.md

## 專案

這是一個簡單的 Codex project。

## 語言

- 預設使用繁體中文。
- 使用清楚、適合初學者的說明。

## 工作規則

- 編輯前先閱讀相關檔案。
- 做小範圍、聚焦的修改。
- 除非使用者要求,不要重寫整份檔案。
- 除非使用者明確要求,不要刪除檔案。
- 進行大範圍修改前先詢問使用者。

## 輸出

- 除非使用者指定其他位置,新檔案都放在這個 project 資料夾。
- 使用清楚的檔名。
- 完成後說明修改了什麼。

## 驗證

- 檢查編輯或新增的檔案是否存在。
- 檢查內容是否符合使用者的要求。
- 如果有無法檢查的項目,要告訴使用者。
# AGENTS.md

## Project

This is a simple Codex project.

## Language

- Use Traditional Chinese by default.
- Use clear and beginner-friendly wording.

## Working Rules

- Read the relevant file before editing it.
- Make small and focused changes.
- Do not rewrite the whole file unless the user asks.
- Do not delete files unless the user clearly asks.
- Ask before making broad changes.

## Output

- Keep new files in this project folder unless the user asks for another location.
- Use clear filenames.
- Explain what changed after finishing.

## Verification

- Check that edited or created files exist.
- Check that the content matches the user's request.
- Tell the user if something could not be checked.

這份規則適合大多數練習。它的重點不是限制 Codex,而是讓 Codex 知道:要先看檔案、改小一點、不要亂刪、完成後要回報。

可以怎麼改

你可以依自己的專案,把上面的規則稍微改成更明確的版本。例如:

不要一開始就寫太多規則。規則越多,越難看懂,也越不容易維護。

範例一:簡單文字修改專案

這個範例適合用在只有一兩個文字檔的專案,例如改講稿、改說明文字或整理課堂筆記。

# AGENTS.md

## 專案

這是一個簡單的文字修改專案。

## 語言

- 使用繁體中文。
- 文字要清楚自然。
- 避免太正式或太技術性的說法。

## 工作規則

- 編輯前先閱讀檔案。
- 除非使用者要求改變,否則保留原本意思。
- 做聚焦的修改。
- 除非範例明顯無關,否則不要移除範例。

## 驗證

- 檢查修改後的文字是否容易閱讀。
- 檢查標題和清單是否仍然合理。
- 編輯後摘要主要變更。
# AGENTS.md

## Project

This is a simple writing project.

## Language

- Use Traditional Chinese.
- Keep the wording clear and natural.
- Avoid overly formal or technical language.

## Working Rules

- Read the file before editing it.
- Keep the original meaning unless the user asks to change it.
- Make focused edits.
- Do not remove examples unless they are clearly unrelated.

## Verification

- Check that the revised text is readable.
- Check that headings and lists still make sense.
- Summarize the main changes after editing.

範例二:簡單程式練習專案

這個範例適合用在一個小程式練習,例如一個 Python 檔、一個 JavaScript 檔,或一個簡單網頁。

# AGENTS.md

## 專案

這是一個小型程式練習專案。

## 語言

- 用繁體中文說明修改內容。
- 程式註解要短而有用。

## 工作規則

- 修改前先閱讀現有程式碼。
- 優先使用初學者能理解的簡單程式碼。
- 除非使用者要求,不要新增套件。
- 不要修改無關的程式碼。

## 驗證

- 可以的話,執行基本檢查。
- 如果程式無法執行,說明原因。
- 回報修改的檔案和已檢查的項目。
# AGENTS.md

## Project

This is a small coding practice project.

## Language

- Explain changes in Traditional Chinese.
- Keep code comments short and useful.

## Working Rules

- Read the existing code before changing it.
- Prefer simple code that beginners can understand.
- Do not add new libraries unless the user asks.
- Do not change unrelated code.

## Verification

- Run a basic check when possible.
- If the code cannot be run, explain why.
- Report the changed file and what was checked.

範例三:簡單資料整理專案

這個範例適合用在一個小型資料檔,例如整理一份 CSV、表格內容或貼上的名單。

# AGENTS.md

## 專案

這是一個簡單的資料整理專案。

## 語言

- 使用繁體中文。
- 清楚說明假設。

## 工作規則

- 不要編造缺少的資料。
- 不要暴露私人個人資料。
- 保留原始資料的意思。
- 大量更動列或欄之前先詢問。

## 驗證

- 可以的話,檢查資料列數。
- 檢查重要欄位是否仍然存在。
- 摘要缺少或異常的值。
# AGENTS.md

## Project

This is a simple data cleanup project.

## Language

- Use Traditional Chinese.
- Explain assumptions clearly.

## Working Rules

- Do not invent missing data.
- Do not expose private personal information.
- Keep the original data meaning.
- Ask before changing many rows or columns.

## Verification

- Check the number of rows if possible.
- Check that important columns are still present.
- Summarize any missing or unusual values.

課堂練習:建立自己的 AGENTS.md

Problem Statement

請在你的 Codex project 最上層建立一份簡單的 AGENTS.md。這份文件只需要描述這個 project 的基本工作規則,不需要規劃其他資料夾,也不需要寫成完整技術文件。

MVP Requirements

Suggested Prompt

可以直接對 Codex 說:

為這個 Codex project 建立一份簡單的 AGENTS.md。
保持適合初學者。
使用繁體中文說明。
只聚焦在這個簡單的 Codex project。
Create a simple AGENTS.md for this Codex project.
Keep it beginner-friendly.
Use Traditional Chinese explanations.
Focus only on this simple Codex project.

檢查清單

完成後,確認你的 AGENTS.md:

AGENTS.md 與 Skill 的差別

AGENTS.md 是這個 project 的工作規則。它回答的是:「Codex 在這個 project 裡應該怎麼做事?」

Skill 是可重複使用的任務流程。它回答的是:「遇到某一類任務時,Codex 應該照什麼步驟做?」

可以先學會寫 AGENTS.md。等到某個任務會一直重複出現,再考慮把它整理成 Skill。

AGENTS.md Introductory Handout: Simple Project Rules for Codex

Goals of This Handout

AGENTS.md is a text file placed at the top level of a Codex project. Its purpose is simple: tell Codex how it should work in this project.

This handout focuses only on the simplest Codex project. Assume your project contains only the files you are currently working on, and the goal is to give Codex a few basic working rules.

What AGENTS.md Is

When you open a project with Codex, Codex can read, create, or edit files inside that project. AGENTS.md is the project rule file written for Codex.

It can describe:

AGENTS.md does not need to be long. Any rule that helps Codex guess less is useful.

The Simplest Codex AGENTS.md

Here is a very simple version. It only describes how Codex should work in the current project.

# AGENTS.md

## 專案

這是一個簡單的 Codex project。

## 語言

- 預設使用繁體中文。
- 使用清楚、適合初學者的說明。

## 工作規則

- 編輯前先閱讀相關檔案。
- 做小範圍、聚焦的修改。
- 除非使用者要求,不要重寫整份檔案。
- 除非使用者明確要求,不要刪除檔案。
- 進行大範圍修改前先詢問使用者。

## 輸出

- 除非使用者指定其他位置,新檔案都放在這個 project 資料夾。
- 使用清楚的檔名。
- 完成後說明修改了什麼。

## 驗證

- 檢查編輯或新增的檔案是否存在。
- 檢查內容是否符合使用者的要求。
- 如果有無法檢查的項目,要告訴使用者。
# AGENTS.md

## Project

This is a simple Codex project.

## Language

- Use Traditional Chinese by default.
- Use clear and beginner-friendly wording.

## Working Rules

- Read the relevant file before editing it.
- Make small and focused changes.
- Do not rewrite the whole file unless the user asks.
- Do not delete files unless the user clearly asks.
- Ask before making broad changes.

## Output

- Keep new files in this project folder unless the user asks for another location.
- Use clear filenames.
- Explain what changed after finishing.

## Verification

- Check that edited or created files exist.
- Check that the content matches the user's request.
- Tell the user if something could not be checked.

These rules fit most practice tasks. The point is not to restrict Codex; the point is to tell Codex to read files first, keep edits small, avoid deleting things casually, and report back after finishing.

How You Can Modify It

You can adjust the rules above to fit your own project. For example:

Do not write too many rules at the beginning. The more rules you add, the harder they are to read and maintain.

Example 1: Simple Text Editing Project

This example fits a project with only one or two text files, such as revising a script, editing explanatory text, or organizing class notes.

# AGENTS.md

## 專案

這是一個簡單的文字修改專案。

## 語言

- 使用繁體中文。
- 文字要清楚自然。
- 避免太正式或太技術性的說法。

## 工作規則

- 編輯前先閱讀檔案。
- 除非使用者要求改變,否則保留原本意思。
- 做聚焦的修改。
- 除非範例明顯無關,否則不要移除範例。

## 驗證

- 檢查修改後的文字是否容易閱讀。
- 檢查標題和清單是否仍然合理。
- 編輯後摘要主要變更。
# AGENTS.md

## Project

This is a simple writing project.

## Language

- Use Traditional Chinese.
- Keep the wording clear and natural.
- Avoid overly formal or technical language.

## Working Rules

- Read the file before editing it.
- Keep the original meaning unless the user asks to change it.
- Make focused edits.
- Do not remove examples unless they are clearly unrelated.

## Verification

- Check that the revised text is readable.
- Check that headings and lists still make sense.
- Summarize the main changes after editing.

Example 2: Simple Programming Practice Project

This example fits a small programming practice project, such as one Python file, one JavaScript file, or a simple web page.

# AGENTS.md

## 專案

這是一個小型程式練習專案。

## 語言

- 用繁體中文說明修改內容。
- 程式註解要短而有用。

## 工作規則

- 修改前先閱讀現有程式碼。
- 優先使用初學者能理解的簡單程式碼。
- 除非使用者要求,不要新增套件。
- 不要修改無關的程式碼。

## 驗證

- 可以的話,執行基本檢查。
- 如果程式無法執行,說明原因。
- 回報修改的檔案和已檢查的項目。
# AGENTS.md

## Project

This is a small coding practice project.

## Language

- Explain changes in Traditional Chinese.
- Keep code comments short and useful.

## Working Rules

- Read the existing code before changing it.
- Prefer simple code that beginners can understand.
- Do not add new libraries unless the user asks.
- Do not change unrelated code.

## Verification

- Run a basic check when possible.
- If the code cannot be run, explain why.
- Report the changed file and what was checked.

Example 3: Simple Data Organization Project

This example fits a small data file, such as cleaning a CSV, spreadsheet content, or a pasted roster.

# AGENTS.md

## 專案

這是一個簡單的資料整理專案。

## 語言

- 使用繁體中文。
- 清楚說明假設。

## 工作規則

- 不要編造缺少的資料。
- 不要暴露私人個人資料。
- 保留原始資料的意思。
- 大量更動列或欄之前先詢問。

## 驗證

- 可以的話,檢查資料列數。
- 檢查重要欄位是否仍然存在。
- 摘要缺少或異常的值。
# AGENTS.md

## Project

This is a simple data cleanup project.

## Language

- Use Traditional Chinese.
- Explain assumptions clearly.

## Working Rules

- Do not invent missing data.
- Do not expose private personal information.
- Keep the original data meaning.
- Ask before changing many rows or columns.

## Verification

- Check the number of rows if possible.
- Check that important columns are still present.
- Summarize any missing or unusual values.

Class Practice: Create Your Own AGENTS.md

Problem Statement

Create a simple AGENTS.md at the top level of your Codex project. This file only needs to describe the basic working rules for this project. It does not need to plan other folders or become a full technical document.

MVP Requirements

Suggested Prompt

You can say this directly to Codex:

為這個 Codex project 建立一份簡單的 AGENTS.md。
保持適合初學者。
使用繁體中文說明。
只聚焦在這個簡單的 Codex project。
Create a simple AGENTS.md for this Codex project.
Keep it beginner-friendly.
Use Traditional Chinese explanations.
Focus only on this simple Codex project.

Checklist

After finishing, check that your AGENTS.md:

Difference Between AGENTS.md and Skills

AGENTS.md is the working rule file for this project. It answers: "How should Codex work inside this project?"

A Skill is a reusable task workflow. It answers: "When this type of task appears, what steps should Codex follow?"

Learn to write AGENTS.md first. When a task keeps repeating, then consider turning it into a Skill.