ขยาย Claude ด้วย Skills
สร้าง จัดการ และแชร์ skills เพื่อขยายความสามารถของ Claude ใน Claude Code รวมถึง custom commands และ bundled skills
Skills ขยายสิ่งที่ Claude ทำได้ สร้างไฟล์ SKILL.md พร้อมคำสั่ง และ Claude จะเพิ่มเข้าใน toolkit ของมัน Claude ใช้ skills เมื่อเกี่ยวข้อง หรือคุณสามารถเรียกใช้โดยตรงด้วย /skill-name
Custom commands ถูก merge เข้าสู่ skills แล้ว ไฟล์ที่
.claude/commands/deploy.mdและ skill ที่.claude/skills/deploy/SKILL.mdทั้งสองสร้าง/deployและทำงานเหมือนกัน ไฟล์.claude/commands/ที่มีอยู่ยังคงทำงาน
Claude Code skills ปฏิบัติตาม Agent Skills open standard
Bundled Skills
Claude Code มี bundled skills พร้อมใช้ในทุก session เว้นแต่ปิดใช้งานด้วย disableBundledSkills รวมถึง /code-review, /batch, /debug, /loop และ /claude-api
รันและยืนยัน App
| Skill | วัตถุประสงค์ |
|---|---|
/run | เปิดและขับเคลื่อน app ของคุณเพื่อดูการเปลี่ยนแปลงที่ทำงาน |
/verify | Build และรัน app เพื่อยืนยัน code change |
/run-skill-generator | สอน /run และ /verify วิธี build และเปิด project |
เริ่มต้น
สร้าง Skill แรกของคุณ
ตัวอย่างนี้สร้าง skill ที่สรุปการเปลี่ยนแปลงที่ uncommitted ใน git repository:
ขั้นที่ 1: สร้าง skill directory
mkdir -p ~/.claude/skills/summarize-changes
ขั้นที่ 2: เขียน SKILL.md
บันทึกไปยัง ~/.claude/skills/summarize-changes/SKILL.md:
---
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
---
## Current changes
!`git diff HEAD`
## Instructions
Summarize the changes above in two or three bullet points, then list any risks you notice such as missing error handling, hardcoded values, or tests that need updating.
ขั้นที่ 3: ทดสอบ skill
เปิด git project แล้วรัน Claude Code คุณสามารถทดสอบ 2 วิธี:
ให้ Claude เรียกใช้อัตโนมัติ:
What did I change?
หรือเรียกใช้โดยตรง:
/summarize-changes
ตำแหน่ง Skills
| ตำแหน่ง | Path | ใช้ได้กับ |
|---|---|---|
| Enterprise | ดู managed settings | ผู้ใช้ทั้งหมดในองค์กร |
| Personal | ~/.claude/skills/<skill-name>/SKILL.md | ทุก projects ของคุณ |
| Project | .claude/skills/<skill-name>/SKILL.md | Project นี้เท่านั้น |
| Plugin | <plugin>/skills/<skill-name>/SKILL.md | ที่ plugin เปิดใช้งาน |
กำหนดค่า Skills
Frontmatter Reference
---
name: my-skill
description: What this skill does
disable-model-invocation: true
allowed-tools: Read Grep
---
Your skill instructions here...
| Field | Required | Description |
|---|---|---|
name | ไม่ | Display name แสดงใน skill listings |
description | แนะนำ | สิ่งที่ skill ทำและเมื่อใช้ Claude ใช้นี้เพื่อตัดสินใจเมื่อใช้ skill |
when_to_use | ไม่ | Context เพิ่มเติมสำหรับเมื่อ Claude ควรเรียกใช้ skill |
argument-hint | ไม่ | คำใบ้แสดงใน autocomplete |
arguments | ไม่ | Named positional arguments สำหรับ $name substitution |
disable-model-invocation | ไม่ | ตั้งเป็น true เพื่อป้องกัน Claude จากการโหลด skill อัตโนมัติ |
user-invocable | ไม่ | ตั้งเป็น false เพื่อซ่อนจาก / menu |
allowed-tools | ไม่ | Tools ที่ Claude ใช้โดยไม่ต้องขอ permission เมื่อ skill active |
disallowed-tools | ไม่ | Tools ที่ถูกถอดออกขณะ skill active |
model | ไม่ | Model ที่ใช้เมื่อ skill active |
effort | ไม่ | Effort level เมื่อ skill active |
context | ไม่ | ตั้งเป็น fork เพื่อรันใน forked subagent context |
agent | ไม่ | subagent type ที่ใช้เมื่อ context: fork ถูกตั้ง |
String Substitutions
| Variable | Description |
|---|---|
$ARGUMENTS | Arguments ทั้งหมดที่ผ่านเมื่อเรียกใช้ skill |
$ARGUMENTS[N] | เข้าถึง argument เฉพาะตาม 0-based index |
$N | Shorthand สำหรับ $ARGUMENTS[N] |
${CLAUDE_SESSION_ID} | Session ID ปัจจุบัน |
${CLAUDE_EFFORT} | Effort level ปัจจุบัน |
${CLAUDE_SKILL_DIR} | Directory ที่มี SKILL.md ของ skill |
Advanced Patterns
Inject Dynamic Context
Syntax !`<command>` รันคำสั่ง shell ก่อนส่ง skill content ไปยัง Claude:
---
name: pr-summary
description: Summarize changes in a pull request
context: fork
agent: Explore
allowed-tools: Bash(gh *)
---
## Pull request context
- PR diff: !`gh pr diff`
- PR comments: !`gh pr view --comments`
- Changed files: !`gh pr diff --name-only`
## Your task
Summarize this pull request...
รัน Skills ใน Subagent
เพิ่ม context: fork ใน frontmatter เมื่อต้องการให้ skill รันแบบ isolated:
---
name: deep-research
description: Research a topic thoroughly
context: fork
agent: Explore
---
Research $ARGUMENTS thoroughly:
1. Find relevant files using Glob and Grep
2. Read and analyze the code
3. Summarize findings with specific file references
ควบคุมการเข้าถึง Skill ของ Claude
ปิดใช้งาน skills ทั้งหมด:
# เพิ่มใน deny rules:
Skill
อนุญาตหรือปฏิเสธ skills เฉพาะ:
# อนุญาตเฉพาะ skills บางอย่าง
Skill(commit)
Skill(review-pr *)
# ปฏิเสธ skills เฉพาะ
Skill(deploy *)
แชร์ Skills
Skills สามารถกระจายในขอบเขตต่าง ๆ:
- Project skills: Commit
.claude/skills/ไปยัง version control - Plugins: สร้าง
skills/directory ใน plugin ของคุณ - Managed: Deploy organization-wide ผ่าน managed settings
การแก้ไขปัญหา
Skill ไม่ถูก Trigger
หาก Claude ไม่ใช้ skill ของคุณเมื่อคาดหวัง:
- ตรวจสอบว่า description มี keywords ที่ผู้ใช้จะพูดตามธรรมชาติ
- ยืนยันว่า skill ปรากฏใน
What skills are available? - ลอง rephrase คำขอให้ตรงกับ description มากขึ้น
- เรียกใช้โดยตรงด้วย
/skill-name
Skill ถูก Trigger บ่อยเกินไป
หาก Claude ใช้ skill ของคุณเมื่อไม่ต้องการ:
- ทำให้ description เฉพาะเจาะจงมากขึ้น
- เพิ่ม
disable-model-invocation: trueหากต้องการ manual invocation เท่านั้น
แหล่งข้อมูลที่เกี่ยวข้อง
- Debug your configuration: วินิจฉัยว่าทำไม skill ไม่ปรากฏหรือถูก trigger
- Subagents: มอบหมายงานให้ specialized agents
- Plugins: package และกระจาย skills พร้อม extensions อื่น ๆ
- Hooks: automate workflows รอบ tool events
- Commands: อ้างอิงสำหรับ built-in commands และ bundled skills