---
title: "GitHub Copilot custom instructions: đường dẫn và định dạng · DotsAgent"
description: "Vị trí của .github/copilot-instructions.md, định dạng và frontmatter, cách hợp nhất các bản sao toàn cục và lồng nhau, cùng các tool đọc tệp này. Đã kiểm tra ngày 2026-10-01."
url: https://dotsagent.io/vi/instructions/files/github-copilot-instructions
---

.github/copilot-instructions.md

# GitHub Copilot custom instructions: vị trí và cách các tool đọc tệp

GitHub Copilot đọc một tệp áp dụng cho toàn bộ repository là .github/copilot-instructions.md, cùng với các tệp .instructions.md dành riêng cho từng đường dẫn. Công cụ này cũng tuân theo AGENTS.md hoặc một tệp CLAUDE.md hay GEMINI.md duy nhất ở thư mục gốc.

## Vị trí

- .github/copilot-instructions.md, áp dụng cho toàn bộ repository.
- .github/instructions/**/NAME.instructions.md, áp dụng cho các tệp khớp với applyTo.
- AGENTS.md ở bất kỳ vị trí nào trong repository; tệp gần nhất được ưu tiên.
- Một tệp CLAUDE.md hoặc GEMINI.md duy nhất ở thư mục gốc, dùng làm phương án thay thế.

## Định dạng

Markdown; khoảng trắng giữa các chỉ dẫn được bỏ qua. Chỉ các tệp .instructions.md mới có frontmatter: applyTo chứa các glob được phân tách bằng dấu phẩy, còn excludeAgent nhận giá trị "code-review" hoặc "cloud-agent". Từ 2026-06-12, code review không còn giới hạn 4,000 ký tự; GitHub khuyến nghị mỗi tệp có khoảng 1,000 dòng trở xuống.

Các khóa 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.
```

## Thứ tự ưu tiên và hợp nhất

Chỉ dẫn cá nhân được áp dụng trước, tiếp theo là chỉ dẫn của repository rồi đến tổ chức; mọi bộ chỉ dẫn phù hợp đều được gửi. Khi cả tệp dành riêng cho đường dẫn và tệp áp dụng toàn repository cùng khớp, Copilot sẽ dùng cả hai. Code review đọc chỉ dẫn từ nhánh head của pull request.

## Mẹo

- Trên github.com, các tệp .instructions.md dành riêng cho đường dẫn chỉ hoạt động với Copilot cloud agent và Copilot code review.
- Thêm excludeAgent: "code-review" để không dùng tệp trong các lượt review, nhưng vẫn để cloud agent sử dụng tệp đó.
- Copilot cloud agent có thể soạn thảo copilot-instructions.md cho bạn; hãy giới hạn tệp ở khoảng hai trang và tránh gắn nội dung với một tác vụ cụ thể.

Tạo AGENTS.md và các tệp rule tương ứng cho năm tool từ một biểu mẫu. [Mở trình tạo AGENTS.md →](https://dotsagent.io/vi/instructions)

## Các tệp hướng dẫn khác

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

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

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

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

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

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

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

## Nguồn

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

Tài liệu tham khảo độc lập dành cho những người xây dựng AI agent. Không liên kết với bất kỳ nhà cung cấp nào được nêu ở đây.

© 2026 DotsAgent · Dữ liệu được kiểm tra ngày 1 tháng 10, 2026
