---
title: "GitHub Copilot custom instructions: path และรูปแบบ · DotsAgent"
description: "ตำแหน่งของ .github/copilot-instructions.md รูปแบบและ frontmatter วิธีผสานไฟล์ระดับ global กับไฟล์ในโฟลเดอร์ย่อย และเครื่องมือที่อ่านไฟล์นี้ ตรวจสอบเมื่อ 2026-10-01"
url: https://dotsagent.io/th/instructions/files/github-copilot-instructions
---

.github/copilot-instructions.md

# GitHub Copilot custom instructions: ตำแหน่งไฟล์และวิธีที่เครื่องมืออ่าน

GitHub Copilot อ่านไฟล์ที่ใช้กับทั้ง repository คือ .github/copilot-instructions.md และไฟล์ .instructions.md ที่กำหนดตาม path นอกจากนี้ยังรองรับ AGENTS.md หรือไฟล์ CLAUDE.md หรือ GEMINI.md ที่ root เพียงไฟล์เดียว

## ตำแหน่งไฟล์

- .github/copilot-instructions.md ใช้กับทั้ง repository
- .github/instructions/**/NAME.instructions.md ใช้กับไฟล์ที่ตรงกับ applyTo
- AGENTS.md ในตำแหน่งใดก็ได้ใน repository โดยไฟล์ที่อยู่ใกล้ที่สุดจะมีผล
- ใช้ไฟล์ CLAUDE.md หรือ GEMINI.md ที่ root เพียงไฟล์เดียวแทนได้

## รูปแบบ

Markdown; ระบบจะไม่สนใจช่องว่างระหว่างคำสั่ง มีเฉพาะไฟล์ .instructions.md ที่รองรับ frontmatter: applyTo ใช้ระบุ glob หลายรายการคั่นด้วยจุลภาค และ excludeAgent รับค่า "code-review" หรือ "cloud-agent" Code review ยกเลิกขีดจำกัด 4,000 อักขระเมื่อ 2026-06-12 และ GitHub แนะนำให้แต่ละไฟล์มีความยาวไม่เกินประมาณ 1,000 บรรทัด

คีย์ Frontmatter: `applyTo``excludeAgent`

`.github/copilot-instructions.md`

```
# Copilot instructions

This is a Rails app with a React front end in app/javascript/.

## Build and test

- Install: `bundle install && yarn install`
- Test: `bin/rails test`
- Lint: `bin/rubocop`

## Conventions

- Put business logic in app/services/, not in controllers.
- Every migration must be reversible.
- Never commit credentials or edit config/master.key.
```

## ลำดับความสำคัญและการผสาน

ระบบจะส่งคำสั่งส่วนบุคคลก่อน ตามด้วยคำสั่งของ repository แล้วจึงเป็นคำสั่งขององค์กร และยังส่งชุดคำสั่งที่เกี่ยวข้องทั้งหมดไปด้วย หากไฟล์ที่กำหนดตาม path และไฟล์ที่ใช้กับทั้ง repository ตรงกันทั้งคู่ Copilot จะใช้ทั้งสองไฟล์ Code review อ่านคำสั่งจาก branch head ของ pull request

## เคล็ดลับ

- บน github.com ไฟล์ .instructions.md ที่กำหนดตาม path ใช้ได้เฉพาะกับ Copilot cloud agent และ Copilot code review
- เพิ่ม excludeAgent: "code-review" เพื่อไม่ให้ไฟล์มีผลกับการ review แต่ยังให้ cloud agent ใช้งานได้
- Copilot cloud agent ช่วยร่าง copilot-instructions.md ให้ได้ ควรเขียนให้ยาวประมาณสองหน้าและไม่ผูกกับงานใดงานหนึ่ง

สร้าง AGENTS.md และไฟล์กฎที่ตรงกันสำหรับเครื่องมือ 5 รายการจากแบบฟอร์มเดียว [เปิดตัวสร้าง AGENTS.md →](https://dotsagent.io/th/instructions)

## ไฟล์คำสั่งอื่น ๆ

[AGENTS.md](https://dotsagent.io/th/instructions/files/agents-md)

[CLAUDE.md](https://dotsagent.io/th/instructions/files/claude-md)

[GEMINI.md](https://dotsagent.io/th/instructions/files/gemini-md)

[.cursor/rules/*.mdc](https://dotsagent.io/th/instructions/files/cursor-rules)

[.devin/rules/*.md](https://dotsagent.io/th/instructions/files/windsurf-rules)

[.clinerules/](https://dotsagent.io/th/instructions/files/cline-rules)

[~/.openclaw/workspace/AGENTS.md](https://dotsagent.io/th/instructions/files/openclaw-workspace)

## แหล่งข้อมูล

1. [docs.github.com](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions)/en/copilot/how-tos/configure-custom-instructions/add-repository-instr
2. [docs.github.com](https://docs.github.com/en/copilot/reference/custom-instructions-support)/en/copilot/reference/custom-instructions-support
3. [docs.github.com](https://docs.github.com/en/copilot/tutorials/customize-code-review)/en/copilot/tutorials/customize-code-review
4. [github.blog](https://github.blog/changelog/2026-06-12-copilot-code-review-new-configurations-and-controls/)/changelog/2026-06-12-copilot-code-review-new-configurations-and-contr

แหล่งอ้างอิงอิสระสำหรับผู้สร้าง AI agent ไม่มีส่วนเกี่ยวข้องกับผู้ให้บริการที่กล่าวถึง

© 2026 DotsAgent · ตรวจสอบข้อมูลเมื่อ 1 ตุลาคม 2569
