SKILL.md คืออะไร
SKILL.md คือไฟล์ Markdown ที่ใช้กำหนด “Skill” หรือความสามารถเฉพาะทางให้ AI Agent
โดยปกติ AI จะรู้แค่ความรู้ทั่วไป แต่เมื่อเราสร้าง Skill ขึ้นมา AI จะสามารถ:
- เข้าใจกฎของโปรเจกต์
- ทำ Workflow ซ้ำๆ อัตโนมัติ
- ใช้มาตรฐานทีมได้ถูกต้อง
- ลดการ Prompt ซ้ำ
- เรียกใช้ความสามารถเฉพาะเมื่อจำเป็น
Anthropic อธิบายว่า Skills เป็น “modular capabilities” ที่ Agent โหลดเมื่อเกี่ยวข้องกับงานนั้นๆ
ทำไม SKILL.md สำคัญกว่า Prompt ธรรมดา
ก่อนมี Skills นักพัฒนามักใช้:
- Prompt ยาวๆ
CLAUDE.md.cursorrulesAGENTS.md
ปัญหาคือทุกอย่างถูกโหลดตลอดเวลา ทำให้:
- เปลือง context window
- AI สับสน
- ค่า token สูง
- ดูแลยาก
แต่ Skills ใช้แนวคิด “Progressive Disclosure”
AI จะโหลดเฉพาะ Skill ที่เกี่ยวข้องกับงานนั้นจริงๆ
ตัวอย่าง:
- งาน Laravel → โหลด Laravel Skill
- งาน Docker → โหลด Docker Skill
- งาน SEO → โหลด SEO Skill
ทำให้ Agent ฉลาดขึ้นโดยไม่ทำให้ Context บวม
โครงสร้างพื้นฐานของ SKILL.md
ตัวอย่างง่ายที่สุด:
---
name: laravel-api
description: Build Laravel REST APIs with repository pattern and service layer.
---
# Laravel API Skill
## Rules
- Use Repository Pattern
- Validate with FormRequest
- Use API Resources
- Use service classes for business logic
## Folder Structure
app/
├── Http/
├── Services/
├── Repositories/
## Best Practices
- Never query model directly in controller
- Keep controller thin
- Use transactions for critical operations
ตำแหน่งการเก็บ Skill
1. Project Skill
ใช้เฉพาะโปรเจกต์นั้น
.claude/skills/
ตัวอย่าง:
.claude/skills/laravel-api/SKILL.md
เหมาะกับ:
- Coding standards ของบริษัท
- Convention ภายในทีม
- Architecture เฉพาะระบบ
2. Global Skill
ใช้ได้ทุกโปรเจกต์
~/.claude/skills/
เหมาะกับ:
- Workflow ส่วนตัว
- Productivity tools
- DevOps helper
AI Agent ใช้ Skill ยังไง
AI จะอ่านจาก YAML Frontmatter
---
name: docker-debug
description: Debug docker container, compose issue and nginx reverse proxy problems
---
ส่วน description สำคัญมาก เพราะ AI ใช้มันค้นหาว่าควรโหลด Skill นี้หรือไม่
หากเขียนกว้างเกินไป เช่น:
description: help docker
Agent อาจไม่เรียกใช้เลย
แต่ถ้าเขียนละเอียด:
description: Debug Docker compose, container networking, reverse proxy, nginx and SSL problems
AI จะ match งานได้แม่นขึ้น
สิ่งที่ใส่ใน Skill ได้
Skill ไม่ได้มีแค่ Markdown
สามารถมี:
my-skill/
├── SKILL.md
├── scripts/
├── templates/
├── examples/
├── docs/
└── assets/
เช่น:
- shell script
- python helper
- template email
- architecture docs
- coding examples
ตัวอย่าง Skill ที่ควรมีในองค์กร
1. Coding Standards
- ใช้ TypeScript strict mode
- ห้าม any
- Controller ต้องบาง
- ใช้ repository layer
2. Deployment Skill
- Pull latest main
- Run migration
- Restart PM2
- Check nginx
3. UI/UX Skill
- ใช้ spacing 8pt
- Primary color = #0057FF
- Button radius = 12px
4. Security Skill
- Validate ทุก input
- Escape HTML
- Never expose API key
Skill vs CLAUDE.md ต่างกันยังไง
| Feature | CLAUDE.md | SKILL.md |
|---|---|---|
| โหลดตลอด | ✅ | ❌ |
| โหลดเมื่อจำเป็น | ❌ | ✅ |
| เหมาะกับ | Global rules | Workflow |
| Token cost | สูง | ต่ำ |
| Reusable | ปานกลาง | สูง |
| Share ข้าม agent | จำกัด | ดีมาก |
Skill ที่ดีควรเป็นยังไง
Anthropic แนะนำว่า Skill ควร:
- Focused
- มีขอบเขตชัด
- Trigger ชัดเจน
- มีตัวอย่าง
- ไม่กว้างเกินไป
ตัวอย่างที่ดี:
description: Analyze Prisma schema and generate optimized PostgreSQL indexes
ตัวอย่างที่ไม่ดี:
description: database helper
Agent Ecosystem กำลังใช้ SKILL.md เป็นมาตรฐาน
ปัจจุบัน SKILL.md เริ่มกลายเป็น Open Standard ของ AI Agent หลายระบบแล้ว
รองรับโดย:
- Claude Code
- Cursor
- Codex CLI
- Gemini CLI
- OpenClaw
- VS Code agents
- ChatGPT-compatible agents
แนวคิดคือ:
“Write once, use everywhere”
ความปลอดภัยของ Skill
Skill มีพลังมาก เพราะมันสามารถ:
- รัน script
- ควบคุม workflow
- เรียก tools
- สั่ง deployment
ดังนั้นควร:
- Review ทุก Skill ก่อนใช้งาน
- หลีกเลี่ยง third-party ที่ไม่รู้แหล่ง
- แยก permission
- จำกัด allowed-tools
- sandbox script สำคัญ
Best Practices สำหรับทีม Dev
1. แยก Skill ตาม Domain
ดี:
nextjs-apidocker-debugseo-content
ไม่ดี:
everything-helper
2. ใช้ Versioning
## Version History
- v1.0 Initial
- v1.1 Add Docker support
3. เขียน Examples
AI เข้าใจจากตัวอย่างได้ดีมาก
## Example
User: deploy production
Assistant:
1. pull latest
2. migrate
3. restart pm2
4. อย่าใส่ Prompt ยาวเกิน
Skill ควร modular
แยกเป็นหลาย Skill ดีกว่า Skill เดียว 5000 บรรทัด
ตัวอย่าง Workflow จริง
Developer พิมพ์
fix nginx docker issue
Claude Code จะ:
- อ่าน task
- Match description
- โหลด
docker-debug - ใช้ instruction ใน Skill
- วิเคราะห์และแก้ปัญหาอัตโนมัติ
นี่คือแนวคิดของ “context-aware agents”
อนาคตของ AI Agent จะขับเคลื่อนด้วย Skills
ก่อนหน้านี้ AI เป็นแค่ chatbot
แต่ตอนนี้ AI เริ่มกลายเป็น:
- teammate
- engineer
- operator
- automation worker
Skill คือวิธี “ติดตั้งความสามารถ” ให้ Agent แบบ modular
เหมือน App Store ของ AI Agent
และกำลังกลายเป็น Architecture หลักของระบบ Agent ยุคใหม่
สรุป
SKILL.md คือระบบสร้างความสามารถเฉพาะทางให้ AI Agent ที่กำลังกลายเป็นมาตรฐานใหม่ของวงการ
จุดเด่นสำคัญคือ:
- โหลดเมื่อจำเป็น
- ลด token cost
- reusable
- share ข้ามทีมได้
- portable ข้าม AI platform
- ทำ workflow ซับซ้อนอัตโนมัติได้
หากองค์กรเริ่มใช้ AI Agent จริงจัง การออกแบบ Skill Library ที่ดี จะกลายเป็น “สินทรัพย์ความรู้” สำคัญของบริษัทในอนาคต
และอาจสำคัญพอๆ กับ Source Code เองเลยทีเดียว