Tạo Custom Skills
Hướng dẫn chi tiết cách tạo Agent Skills riêng cho workflow của bạn.
Cấu trúc cơ bản
Mỗi skill là một thư mục chứa ít nhất một file SKILL.md:
my-skill/
├── SKILL.md # File chính (bắt buộc)
├── reference.md # Tài liệu bổ sung (optional)
├── templates/ # Templates mẫu (optional)
└── scripts/ # Code thực thi (optional)
├── main.py
└── helpers.jsTạo file SKILL.md
Cấu trúc file
---
name: my-skill-name
description: Mô tả rõ ràng skill làm gì và khi nào nên dùng
---
# My Skill Name
[Hướng dẫn chi tiết cho Claude]
## Khi nào sử dụng
- Trường hợp 1
- Trường hợp 2
## Hướng dẫn thực hiện
1. Bước 1
2. Bước 2
## Examples
- Input: ...
- Output: ...Metadata bắt buộc
| Field | Giới hạn | Mô tả |
|---|---|---|
name | 64 ký tự | Tên định danh (lowercase, dùng hyphen) |
description | 200 ký tự | Mô tả ngắn gọn - Claude dựa vào đây để quyết định khi nào dùng skill |
Metadata tùy chọn
---
name: data-analyzer
description: Phân tích dữ liệu theo workflow công ty XYZ
dependencies: python>=3.8, pandas>=1.5.0, matplotlib>=3.5.0
---Ví dụ: Brand Guidelines Skill
---
name: brand-guidelines
description: Áp dụng brand guidelines của Acme Corp cho tất cả documents và presentations
---
# Brand Guidelines
Skill này cung cấp brand guidelines chính thức của Acme Corp.
Áp dụng các tiêu chuẩn này khi tạo materials đại diện cho công ty.
## Brand Colors
| Mục đích | Màu | Hex |
|----------|-----|-----|
| Primary | Coral | #FF6B35 |
| Secondary | Navy Blue | #004E89 |
| Accent | Gold | #F7B801 |
| Neutral | Charcoal | #2E2E2E |
## Typography
- **Headers:** Montserrat Bold
- **Body:** Open Sans Regular
- **Size guidelines:**
- H1: 32pt
- H2: 24pt
- Body: 11pt
## Logo Usage
- Dùng full-color logo trên background sáng
- Dùng white logo trên background tối
- Giữ khoảng cách tối thiểu 0.5 inch xung quanh logo
## Khi áp dụng
Áp dụng guidelines khi tạo:
- PowerPoint presentations
- Word documents cho external sharing
- Marketing materials
- Reports cho clientsThêm Resources
Khi skill cần nhiều thông tin, tách thành nhiều files:
brand-guidelines/
├── SKILL.md
├── color-palette.md # Chi tiết về màu sắc
├── typography.md # Chi tiết về fonts
└── assets/
├── logo-light.png
└── logo-dark.pngTrong SKILL.md, tham chiếu đến resources:
## Resources bổ sung
- Chi tiết về màu sắc: xem `color-palette.md`
- Chi tiết về typography: xem `typography.md`
- Logo files: trong thư mục `assets/`Thêm Scripts
Cho các skill nâng cao cần chạy code:
Python Script
# scripts/analyze_data.py
import pandas as pd
import matplotlib.pyplot as plt
def analyze_sales(file_path):
df = pd.read_csv(file_path)
# Phân tích theo workflow công ty
summary = df.groupby('region').agg({
'revenue': 'sum',
'orders': 'count'
})
# Tạo biểu đồ
summary['revenue'].plot(kind='bar')
plt.title('Revenue by Region')
plt.savefig('revenue_chart.png')
return summaryTham chiếu trong SKILL.md
## Scripts
Sử dụng `scripts/analyze_data.py` để phân tích dữ liệu:
\`\`\`python
from scripts.analyze_data import analyze_sales
result = analyze_sales('data.csv')
\`\`\`Đóng gói Skill
Bước 1: Kiểm tra cấu trúc
my-skill/
├── SKILL.md ✅ Bắt buộc
├── reference.md ✅ Optional
└── scripts/
└── main.py ✅ OptionalBước 2: Tạo ZIP
# Đảm bảo thư mục skill ở root của ZIP
zip -r my-skill.zip my-skill/Cấu trúc đúng:
my-skill.zip
└── my-skill/
├── SKILL.md
└── ...Cấu trúc SAI:
my-skill.zip
├── SKILL.md ❌ Files ở root
└── ...Bước 3: Upload
- Vào Claude.ai Settings
- Chọn Skills → Upload Skill
- Chọn file ZIP
- Enable skill vừa upload
Dependencies
Claude tự động cài đặt packages từ:
- Python: PyPI (
pip install) - JavaScript: npm (
npm install)
Khai báo trong metadata:
---
name: data-processor
description: Xử lý và phân tích dữ liệu
dependencies: python>=3.8, pandas>=2.0, openpyxl>=3.0
---Lưu ý: Với API, dependencies phải được pre-install trong container.
Tiếp theo
Xem bài Best Practices để tối ưu skills của bạn.
Last updated on