Claude Skills — ทำให้ Claude เป็น 'นักเฉพาะทาง' ในงานของคุณ ด้วยโฟลเดอร์เดียว
Skills คือฟีเจอร์ใหม่ของ Claude ที่ให้นักพัฒนาห่อ workflow + reference + script ไว้เป็น 'package' ที่ Claude เรียกใช้เองเมื่อจำเป็น — ลด context bloat, รียูสได้ทุก project, distribute เป็น plugin ได้
Developer Knowledge
Uplift Engineering

AI-generated
ทุกคนที่ใช้ Claude Code มาสักพักจะรู้สึก pattern เดิม ๆ ว่าเราเอา prompt เดียวกัน (เช่น "เขียน PR description ตามแบบของบริษัท", "ทำ migration ตาม checklist 8 ขั้นนี้") แปะซ้ำทุก session จน CLAUDE.md โต 600 บรรทัดและกินบริบทไปครึ่งหนึ่ง
ตั้งแต่ Oct 2025 Anthropic ปล่อยฟีเจอร์ Agent Skills ออกมา — ห่อความรู้ของคุณเป็น "package" ที่ Claude หยิบมาใช้เองเฉพาะตอนต้องใช้ ไม่กิน context ตอนไม่จำเป็น และ distribute ข้ามทีมได้
บทความนี้คือ primer สำหรับนักพัฒนาที่อยากเริ่มเขียน skill ของตัวเองวันนี้
Skill คืออะไร (ในประโยคเดียว)
Skill คือ โฟลเดอร์บน filesystem ที่มีไฟล์ SKILL.md (พร้อม YAML frontmatter) + ไฟล์ supporting อื่น ๆ (markdown reference, script, asset) ที่ Claude โหลดเมื่อจำเป็น ตามที่ task ตรงกับ description ของ skill นั้น
หน่วยของ skill คือโฟลเดอร์ตรง ๆ ไม่ใช่ binary หรือ DSL พิเศษ:
my-skill/
├── SKILL.md # entrypoint (required, มี YAML frontmatter)
├── reference.md # โหลดเมื่อจำเป็น
└── scripts/
└── helper.py # Claude สั่ง bash รันได้, code ไม่เข้า context
ต่างจาก prompt / CLAUDE.md / MCP server ยังไง?
| อยู่ที่ไหน | โหลดเมื่อ | ให้ Claude... | |
|---|---|---|---|
| Prompt | turn ปัจจุบัน | ทุก turn | คำสั่ง one-shot |
| CLAUDE.md | repo root / ~/.claude/ | อยู่ใน system prompt เสมอ | facts/rules แบบนิ่ง |
| MCP server | process ที่รันอยู่ | tools list อยู่ใน context ทุกตอน | tools ใหม่ (function ผ่าน protocol) |
| Skill | โฟลเดอร์บน disk | metadata เท่านั้น, body โหลดตอน trigger | know-how + script bundled |
จุดสำคัญ: Skill ไม่ใช่ tool ใหม่. มันคือ "ห่อความรู้" บอก Claude ว่า "task แบบนี้ต้องทำตามขั้นตอนนี้ มี script ตัวช่วยด้วย" — Claude ยังใช้ tool เดิมของตัวเอง (Bash, Read, Edit, ...) แต่มี playbook ชัดเจน
ทำไมต้องมี Skill — design problem ที่มันแก้
ref: Best practices
3 ปัญหาที่ doc พูดตรง ๆ:
- Context bloat — ถ้าแปะ "คู่มือเขียน PR" 800 บรรทัดทุก session, context หาย + คู่มือล้าสมัยได้ง่าย. Skill โหลดแค่ metadata (~100 tokens) ตอน startup, body โหลดเฉพาะเมื่อ task ตรง
- Repeated instructions — ทีมเขียน checklist เดียวกันแปะใน chat ทุกคน. ถ้ารวมเป็น skill ก็ commit ไว้ใน repo จบ
- CLAUDE.md โตเกินไป — ถ้า CLAUDE.md ของ project นายมี section ที่กลายเป็น "ขั้นตอน" 8 ขั้น แทนที่จะเป็น "ข้อเท็จจริง" — นั่นแหละต้องแยกเป็น skill
ปัญหาที่ 4 (จาก announcement):
"Skills can include executable code for tasks where traditional programming is more reliable than token generation."
ตัวอย่าง: ถ้าให้ Claude validate JSON schema ด้วย "การคิด" จะพลาดได้, แต่ถ้า skill มี validate.py แล้วบอก Claude ว่า "รันสคริปต์นี้" — ผลลัพธ์ deterministic
Before / After — มันต่างจากเดิมยังไง
เปรียบเทียบ 2 sceanario ที่ทีมไทยเจอบ่อย:
Scenario A: PR description ตามมาตรฐานทีม
Before — ทุกคนแปะ prompt เดียวกัน:
ช่วยเขียน PR description ตามรูปแบบของทีมเรานะ
มี 3 ส่วน: Why, What, Test plan
ใน Why ใส่ context + ticket link
ใน What เป็น bullet list ของไฟล์ที่แก้
Test plan เป็น checkbox markdown
ห้ามใส่ emoji ห้ามใส่ "🤖 Generated with..."
... (อีก 20 บรรทัด)
แปะทุก turn, บางคนจำได้บางคนลืม, format ไม่เหมือนกันใน team
After — มี .claude/skills/pr-description/SKILL.md:
---
name: pr-description
description: Write a PR description in our team's standard 3-section format (Why, What, Test plan). Use when the user asks to write or update a PR description, or after committing.
---
## Format
- ## Why — context + ticket link
- ## What — bullet of changed files
- ## Test plan — markdown checkbox list
## Rules
- No emoji
- No "Generated with..." trailer
- ...นาย commit เข้า repo, ทีมทุกคนใช้เหมือนกัน, prompt ลดเหลือ "ช่วยเขียน PR description" — Claude trigger skill เอง
Scenario B: deploy ไป ECS ของบริษัท
Before — ทุก dev ของทีมจำขั้นตอนเอง, พลาดบ่อย:
"ลืม update task definition ก่อน aws ecs update-service"
"secret ARN ของ service นี้คืออะไรนะ"
"Jenkinsfile pattern ที่ทีมใช้คือ deployEcsService ใช่ปะ"
After — .claude/skills/uplift-deploy/SKILL.md + reference.md ของ secret ARN ทั้งหมด + scripts/check-task-def.py (deterministic verification):
.claude/skills/uplift-deploy/
├── SKILL.md # ขั้นตอนหลัก
├── reference.md # secret ARN ของ 12 service
├── jenkinsfile.md # pattern + คำเตือน
└── scripts/
└── check-task-def.py
Claude อ่าน SKILL.md (5k tokens) แล้วชี้ไป reference.md เฉพาะถ้าต้องเช็ค secret. Script check-task-def.py รันได้เลย Claude ไม่เดา. ทุก dev ใน team ใช้ pattern เดียวกัน, ทุก deploy reproducible
ผลลัพธ์ที่ต่างกัน
| Before (prompt-only) | After (skill) | |
|---|---|---|
| Context กิน | 800+ tokens ทุก turn | 100 tokens (metadata) + 5k เมื่อ trigger |
| ความสม่ำเสมอใน team | ต่างคนต่างจำ | identical (ใน repo) |
| Deterministic ops | "Claude เดา" | script จริง |
| Onboarding คนใหม่ | "อ่าน wiki + ถาม pair" | clone repo จบ |
| Audit ได้ไหม | ดู chat history | git log |
องค์ประกอบของ skill

SKILL.md ฉบับเล็กที่สุด
---
name: pdf-processing
description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction.
---
# PDF Processing
## Quick start
Use pdfplumber for text extraction:
```python
import pdfplumber
with pdfplumber.open("file.pdf") as pdf:
text = pdf.pages[0].extract_text()
```Frontmatter — ที่ใช้บ่อย
| field | required? | หมายเหตุ |
|---|---|---|
name | ใช่ | [a-z0-9-] เท่านั้น, max 64 chars, ห้ามมีคำว่า claude / anthropic |
description | ใช่ | ที่สำคัญที่สุด — Claude ใช้ช่องนี้ตัดสินใจว่าจะ trigger skill ไหน. เขียน ในรูปบุรุษที่ 3 เสมอ ("Processes PDFs..." ไม่ใช่ "I help with...") |
allowed-tools | ไม่ | (Claude Code) pre-approve tool ตอน skill active เช่น Bash(git add *) Bash(git commit *) |
disable-model-invocation | ไม่ | (Claude Code) true = ผู้ใช้พิมพ์ /skill-name เท่านั้น, Claude จะ trigger เองไม่ได้ |
model | ไม่ | override model สำหรับ turn นั้น |
Supporting files ของ skill จริง (pdf ของ Anthropic)
ref: github.com/anthropics/skills
pdf/
├── SKILL.md # high-level guide (โหลดเมื่อ trigger)
├── FORMS.md # form-filling guide (โหลดเฉพาะถ้าทำ form)
├── reference.md # API reference (โหลดเฉพาะถ้าต้องดู)
├── examples.md
└── scripts/
├── analyze_form.py # bash exec, code ไม่เข้า context
├── fill_form.py
└── validate.py
นี่คือ canonical pattern: SKILL.md เป็น "table of contents" ที่ชี้ไปหา reference.md กับ scripts/ ตอนจำเป็น
Progressive Disclosure — mental model ที่ต้องเข้าใจ
ref: Overview
นี่คือเหตุผลที่ skill จะไม่ทำ context พัง:
| Level | โหลดเมื่อ | Token cost | เนื้อหา |
|---|---|---|---|
| L1: Metadata | startup (ทุก skill) | ~100 tokens/skill | name + description |
| L2: Instructions | skill ถูก trigger | <5k tokens | SKILL.md body |
| L3: Resources | ตามต้องการต่อไฟล์ | ไม่จำกัด (ตามจำเป็น) | reference.md, schema, scripts |
แปลว่า:
- ติดตั้ง skill 100 ตัวกิน context แค่ ~10k tokens ตอน startup — ถูกมาก
- Script ที่ bundle ใน skill กิน 0 token เพราะ Claude สั่ง
bash:python scripts/validate.pyแล้วได้ output กลับ — source code ของ script ไม่เข้า context เลย - Skill จะ ship reference 50 หน้าก็ได้ ถ้า task ไม่ต้องใช้ก็ไม่กินอะไร
Skill อยู่ที่ไหนได้บ้าง
ref: Claude Code skills
| ตำแหน่ง | path | scope |
|---|---|---|
| Personal | ~/.claude/skills/<name>/SKILL.md | ทุก project ของนาย |
| Project | .claude/skills/<name>/SKILL.md | project นี้เท่านั้น (commit เข้า git ได้) |
| Plugin | <plugin>/skills/<name>/SKILL.md | ตามที่ plugin enable |
| Enterprise | managed settings | ทุก user ในองค์กร |
Precedence: enterprise → personal → project (สูงกว่าทับล่าง). Plugin ใช้ namespace plugin-name:skill-name กันชน
เขียน skill ให้ดี — 3 กฎสำคัญ
ref: Best practices
1. description คือทุกอย่างสำหรับการ trigger
doc พูดตรง ๆ ว่า "critical for skill selection". Claude มี skill 100+ ตัวให้เลือก, มันใช้ description ของแต่ละตัวตัดสิน
✅ ดี:
description: Generate descriptive commit messages by analyzing git diffs. Use when the user asks for help writing commit messages or reviewing staged changes.❌ แย่:
description: Helps with documents❌ บุรุษที่ 1 (ทำลายการ trigger):
description: I can help you with X2. แยก SKILL.md กับ reference
- SKILL.md body < 500 บรรทัด: คำสั่งหลัก + quick-start
reference.md/examples.md: API detail, edge case, code ตัวอย่างยาว — Claude อ่านเฉพาะถ้าจำเป็นscripts/: ของ deterministic (validation, migration). Code ไม่เข้า context, มี output ออกมาเท่านั้น
3. อย่าสอนสิ่งที่ Claude รู้แล้ว
"Default assumption: Claude is already very smart. Only add context Claude doesn't already have."
อย่าเสียที่อธิบายว่า PDF คืออะไร, HTTP คืออะไร — ตัด
Skill vs MCP server — ใช้ตัวไหน

| ด้าน | Skill | MCP server |
|---|---|---|
| เพิ่มอะไร | ความรู้ขั้นตอน + script bundled | tool ใหม่ (function ผ่าน MCP protocol) |
| Distribution | โฟลเดอร์ + plugin | process ที่รันอยู่ |
| Loading | metadata เท่านั้นถ้ายังไม่ trigger | tool list อยู่ใน context เสมอ |
| State | stateless (file บน disk) | hold connection, session ได้ |
| เหมาะกับ | "ทำงาน X แบบนี้ในที่นี้" | "คุยกับระบบ Y" (API, DB, service ภายนอก) |
| Cost เมื่อไม่ใช้ | ~100 tokens | tool schema อยู่ในนั้นเสมอ |
Rule of thumb: ถ้าสิ่งที่จะเพิ่มอธิบายเป็น "ขั้นตอนทำสิ่งนี้ + ดู doc นี้" → เขียน skill. ถ้าเป็น "call ระบบเป็น ๆ ไปเอา/แก้ data" → ใช้ MCP
Distribution — จะแจกจ่ายยังไง
4 ทางหลัก:
- commit โฟลเดอร์ตรง ๆ ใน
.claude/skills/ของ project — distribute ผ่าน git ปกติ. ง่ายสุด, audit ผ่าน PR ได้, ทีมเห็น diff ปกติ - Anthropic plugin marketplace — repo
anthropics/skills:
/plugin marketplace add anthropics/skills
/plugin install document-skills@anthropic-agent-skills
- skills.sh — cross-tool marketplace (Open Agent Skills Ecosystem). ติดตั้ง skill ตัวเดียวใช้ได้ทั้ง Claude Code, Cursor, Codex, GitHub Copilot, Windsurf, Gemini, Cline และอื่น ๆ:
npx skills add <owner>/<repo>เหมาะถ้าทีมใช้ tool หลายตัว ไม่อยาก lock เข้า Claude อย่างเดียว 4. Third-party marketplace ส่วนตัว — repo GitHub ใด ๆ ที่มีโครงสร้างถูกใช้เป็น marketplace ได้ (Notion ทำเอง Notion Skills)
ฝั่ง Claude API: upload skill ผ่าน POST /v1/skills แล้วอ้างถึงด้วย skill_id ในตอน call Messages API
Reference ที่ควรดูก่อนเขียน skill แรก
anthropics/skills— source ของpdf,xlsx,docx,pptxskill ที่ powers Claude.ai เอง. อ่านSKILL.mdของแต่ละตัวเป็น reference ที่ดีที่สุด- skills.sh — community-curated, search ตามชื่อ tool ได้
- Claude Code skills docs — frontmatter reference ครบทุก field
- Best practices guide — naming, description, degree of freedom — สำคัญถ้าจะเขียนให้ Claude trigger ถูก
Gotcha สำคัญสำหรับ developer ไทย
ref: Overview > Security
nameใส่ภาษาไทยไม่ได้ —[a-z0-9-]เท่านั้น. ภาษาไทยใน body / description ได้ปกติ แต่ลอง include English trigger keyword ใน description เผื่อ Claude คิดเป็นอังกฤษ- Path มี space ต้อง quote — ถ้า script ใน skill อ้าง
$CLAUDE_SKILL_DIRแล้ว path เป็น/Volumes/My SSD/...ลืม quote = สคริปต์พัง:bash -c "cd \"$CLAUDE_SKILL_DIR\" && ..." - Security: skill รัน code ได้ — doc เตือนตรง ๆ: "Use Skills only from trusted sources... a malicious Skill can direct Claude to invoke tools or execute code in ways that don't match the Skill's stated purpose." — audit
scripts/ก่อน install - Secret leak — อย่า hardcode token ใน SKILL.md หรือ
!`cat .env`ใน body. body ถูก inject เข้า conversation context แล้วจะติด log - Lifecycle ใน Claude Code — พอ skill ถูก invoke แล้ว body จะค้างใน session ทั้งหมด แก้ไฟล์ระหว่าง session = ไม่ refresh จนกว่าจะ trigger ใหม่หรือเริ่ม session ใหม่
- ห้ามใช้คำว่า
claude/anthropicใน name — reject ทันที - Cross-surface ยังไม่ sync — upload claude.ai ไม่ทำให้ API หรือ Claude Code เห็น. 3 surface นี้แยกกัน
สรุป
Skill คือเครื่องมือที่ทำให้ "ความรู้ในหัวคุณ" → "asset ที่ทีมรียูสได้" ใน 3 คำ:
- เลิกแปะ prompt ซ้ำ → ทำ skill 1 ครั้ง รียูสทุก session
- เลิกพัง context → progressive disclosure โหลดเฉพาะจำเป็น
- เลิกพึ่ง LLM เดาเรื่อง deterministic → bundle script เข้าไป Claude จะรันให้
ถ้านายมี checklist หรือ workflow ที่ทำซ้ำในหัว — ลอง mkdir -p ~/.claude/skills/my-first-skill && touch SKILL.md แล้วเขียน frontmatter + 10 บรรทัดของ instruction ดูก่อน. Claude จะ trigger ตอนนายทำงานที่ตรงกับ description เอง
ลองดูตัวอย่างจริง ๆ ที่ anthropics/skills — เปิด SKILL.md ของ pdf หรือ xlsx แล้ว reverse-engineer ว่า frontmatter / structure / scripts/ จัดยังไง. หรือ search skill ที่คนอื่นเขียนไว้แล้วที่ skills.sh — บางทีของที่นายจะเขียนมีคนทำเสร็จแล้ว ติดตั้ง npx skills add <repo> จบ
30 นาทีคุณจะมี skill แรกของตัวเองพร้อม commit ลง .claude/skills/ ของ project
Uplift Engineering
UPLIFT Technology team — building AI and software solutions for Thai businesses

