093-130-4223
UPLIFT
Claude Skills, ทำให้ Claude เป็น 'นักเฉพาะทาง' ในงานของคุณ ด้วยโฟลเดอร์เดียว

Claude Skills, ทำให้ Claude เป็น 'นักเฉพาะทาง' ในงานของคุณ ด้วยโฟลเดอร์เดียว

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

ทุกคนที่ใช้ 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 คืออะไร (ในประโยคเดียว)

ref: Agent Skills overview

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...
Promptturn ปัจจุบันทุก turnคำสั่ง one-shot
CLAUDE.mdrepo root / ~/.claude/อยู่ใน system prompt เสมอfacts/rules แบบนิ่ง
MCP serverprocess ที่รันอยู่tools list อยู่ใน context ทุกตอนtools ใหม่ (function ผ่าน protocol)
Skillโฟลเดอร์บน diskmetadata เท่านั้น, body โหลดตอน triggerknow-how + script bundled

จุดสำคัญ: Skill ไม่ใช่ tool ใหม่. มันคือ "ห่อความรู้" บอก Claude ว่า "task แบบนี้ต้องทำตามขั้นตอนนี้ มี script ตัวช่วยด้วย", Claude ยังใช้ tool เดิมของตัวเอง (Bash, Read, Edit, ...) แต่มี playbook ชัดเจน

ทำไมต้องมี Skill, design problem ที่มันแก้

ref: Best practices

3 ปัญหาที่ doc พูดตรง ๆ:

  1. Context bloat, ถ้าแปะ "คู่มือเขียน PR" 800 บรรทัดทุก session, context หาย + คู่มือล้าสมัยได้ง่าย. Skill โหลดแค่ metadata (~100 tokens) ตอน startup, body โหลดเฉพาะเมื่อ task ตรง
  2. Repeated instructions, ทีมเขียน checklist เดียวกันแปะใน chat ทุกคน. ถ้ารวมเป็น skill ก็ commit ไว้ใน repo จบ
  3. 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 ทุก turn100 tokens (metadata) + 5k เมื่อ trigger
ความสม่ำเสมอใน teamต่างคนต่างจำidentical (ใน repo)
Deterministic ops"Claude เดา"script จริง
Onboarding คนใหม่"อ่าน wiki + ถาม pair"clone repo จบ
Audit ได้ไหมดู chat historygit log

องค์ประกอบของ skill

โครงสร้างโฟลเดอร์ของ skill: SKILL.md, reference.md, scripts/

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, ที่ใช้บ่อย

fieldrequired?หมายเหตุ
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: Metadatastartup (ทุก skill)~100 tokens/skillname + description
L2: Instructionsskill ถูก trigger<5k tokensSKILL.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

ตำแหน่งpathscope
Personal~/.claude/skills/<name>/SKILL.mdทุก project ของนาย
Project.claude/skills/<name>/SKILL.mdproject นี้เท่านั้น (commit เข้า git ได้)
Plugin<plugin>/skills/<name>/SKILL.mdตามที่ plugin enable
Enterprisemanaged 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 X

2. แยก 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 ในตำแหน่งต่างๆ user / project / plugin

ด้านSkillMCP server
เพิ่มอะไรความรู้ขั้นตอน + script bundledtool ใหม่ (function ผ่าน MCP protocol)
Distributionโฟลเดอร์ + pluginprocess ที่รันอยู่
Loadingmetadata เท่านั้นถ้ายังไม่ triggertool list อยู่ใน context เสมอ
Statestateless (file บน disk)hold connection, session ได้
เหมาะกับ"ทำงาน X แบบนี้ในที่นี้""คุยกับระบบ Y" (API, DB, service ภายนอก)
Cost เมื่อไม่ใช้~100 tokenstool schema อยู่ในนั้นเสมอ

Rule of thumb: ถ้าสิ่งที่จะเพิ่มอธิบายเป็น "ขั้นตอนทำสิ่งนี้ + ดู doc นี้" → เขียน skill. ถ้าเป็น "call ระบบเป็น ๆ ไปเอา/แก้ data" → ใช้ MCP

Distribution, จะแจกจ่ายยังไง

ref: anthropics/skills repo

4 ทางหลัก:

  1. commit โฟลเดอร์ตรง ๆ ใน .claude/skills/ ของ project, distribute ผ่าน git ปกติ. ง่ายสุด, audit ผ่าน PR ได้, ทีมเห็น diff ปกติ
  2. Anthropic plugin marketplace, repo anthropics/skills:
/plugin marketplace add anthropics/skills
/plugin install document-skills@anthropic-agent-skills
  1. 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, pptx skill ที่ 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

  1. name ใส่ภาษาไทยไม่ได้, [a-z0-9-] เท่านั้น. ภาษาไทยใน body / description ได้ปกติ แต่ลอง include English trigger keyword ใน description เผื่อ Claude คิดเป็นอังกฤษ
  2. Path มี space ต้อง quote, ถ้า script ใน skill อ้าง $CLAUDE_SKILL_DIR แล้ว path เป็น /Volumes/My SSD/... ลืม quote = สคริปต์พัง: bash -c "cd \"$CLAUDE_SKILL_DIR\" && ..."
  3. 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
  4. Secret leak, อย่า hardcode token ใน SKILL.md หรือ !`cat .env` ใน body. body ถูก inject เข้า conversation context แล้วจะติด log
  5. Lifecycle ใน Claude Code, พอ skill ถูก invoke แล้ว body จะค้างใน session ทั้งหมด แก้ไฟล์ระหว่าง session = ไม่ refresh จนกว่าจะ trigger ใหม่หรือเริ่ม session ใหม่
  6. ห้ามใช้คำว่า claude / anthropic ใน name, reject ทันที
  7. 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

Share

แชร์บทความนี้

XFacebookLinkedIn