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

.clinerules/

# Cline Rules (.clinerules/): ตำแหน่งไฟล์และวิธีที่เครื่องมืออ่าน

Cline Rules คือไฟล์ Markdown ใน .clinerules/ ซึ่ง Cline จะใช้ร่วมกับ global rules และ AGENTS.md คุณเพิ่ม frontmatter ของ paths เพื่อจำกัด rule ให้มีผลเฉพาะกับไฟล์ที่ตรงกันได้

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

- Workspace: .clinerules/*.md หรือ .cline/rules/*.md โดยระบบจะค้นหาทั้งสองตำแหน่ง
- Global: Documents\Cline\Rules บน Windows, ~/Documents/Cline/Rules บน macOS และ Linux รวมถึง ~/.cline/rules และ ~/Cline/Rules
- ตรวจพบไฟล์ที่ใช้ร่วมกันระหว่างเครื่องมือโดยอัตโนมัติ: AGENTS.md, ~/.agents/AGENTS.md, .cursorrules และ .windsurfrules

## รูปแบบ

ไฟล์ Markdown ซึ่งตั้งชื่อเรียงลำดับตัวเลขได้ เช่น 01-coding.md และจะมี YAML frontmatter หรือไม่ก็ได้ อาร์เรย์ paths ที่มี glob จะเปิดใช้กฎเมื่อมีรูปแบบใดรูปแบบหนึ่งตรงกับไฟล์ในบริบท หากไม่มี frontmatter กฎจะทำงานตลอด ส่วน paths: [] หมายถึงกฎจะไม่ทำงาน และหาก YAML ไม่ถูกต้อง ระบบจะเปิดใช้กฎไว้โดยปริยาย

คีย์ Frontmatter: `paths`

`.clinerules/`

```
---
paths:
  - "src/components/**"
  - "src/hooks/**"
---

# Components and hooks

- Function components only.
- Hook names start with use and the files live in src/hooks/.
- Split any component that grows past 200 lines.
- Add a test next to each new hook.
```

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

ระบบจะรวมกฎจาก workspace และกฎส่วนกลางเข้าด้วยกัน โดยให้กฎจาก workspace มีผลเหนือกว่าเมื่อขัดแย้งกัน คุณเปิดหรือปิดแต่ละกฎได้แยกกัน

## เคล็ดลับ

- คำว่าอยู่ในบริบทหมายถึงเส้นทางที่มีการกล่าวถึง แท็บที่เปิดอยู่หรือมองเห็นได้ ไฟล์ที่แก้ไข และการแก้ไขที่ยังค้างอยู่
- เนื่องจาก YAML ที่ไม่ถูกต้องจะทำให้ระบบเปิดใช้กฎไว้โดยปริยาย การพิมพ์ผิดใน paths จึงทำให้กฎทำงานตลอด โปรดตรวจสอบหลังแก้ไข
- สร้างกฎได้จากแผง Rules ใน VS Code หรือใช้คำสั่ง slash /newrule

สร้าง 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)

[.github/copilot-instructions.md](https://dotsagent.io/th/instructions/files/github-copilot-instructions)

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

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

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

1. [docs.cline.bot](https://docs.cline.bot/features/cline-rules)/features/cline-rules

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

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