Skills
Skills là một open standard để mở rộng khả năng của Agent với các gói kiến thức chuyên biệt.
Skills là gì?
Skills là các thư mục chứa instructions giúp Agent thực hiện các tác vụ đặc thù. Mỗi skill bao gồm:
- SKILL.md (bắt buộc) - File hướng dẫn chính
- scripts/ - Scripts hỗ trợ
- examples/ - Ví dụ tham khảo
- resources/ - Tài nguyên bổ sung
Cấu trúc SKILL.md
File SKILL.md có format YAML frontmatter + Markdown:
---
name: React Component Generator
description: Tạo React components theo best practices
---
# React Component Generator
## Khi nào sử dụng
Sử dụng skill này khi cần tạo React components mới.
## Instructions
### Bước 1: Tạo file component
Tạo file trong `src/components/[ComponentName]/index.tsx`
### Bước 2: Structure
\`\`\`tsx
interface [ComponentName]Props {
// props
}
export function [ComponentName]({ ...props }: [ComponentName]Props) {
return (
// JSX
);
}
\`\`\`
### Bước 3: Export
Thêm export vào `src/components/index.ts`Cách Agent sử dụng Skills
- Agent phát hiện skill liên quan đến task
- Agent đọc SKILL.md để hiểu instructions
- Agent tuân theo instructions trong quá trình thực hiện
Tạo Custom Skills
Bước 1: Tạo thư mục
.agent/skills/
└── my-skill/
├── SKILL.md
├── scripts/
│ └── helper.js
└── examples/
└── example.mdBước 2: Viết SKILL.md
---
name: My Custom Skill
description: Mô tả ngắn về skill
---
# My Custom Skill
## Overview
Mô tả chi tiết skill làm gì.
## Prerequisites
- Requirement 1
- Requirement 2
## Instructions
1. Bước đầu tiên
2. Bước thứ hai
3. ...
## Examples
Xem thư mục `examples/` để tham khảo.
## Troubleshooting
Các vấn đề thường gặp và cách xử lý.Bước 3: Test Skill
Yêu cầu Agent sử dụng skill:
"Sử dụng skill my-skill để thực hiện..."Skills có sẵn
Antigravity đi kèm một số skills mặc định:
| Skill | Mô tả |
|---|---|
| Web Development | Best practices cho web apps |
| API Design | RESTful API conventions |
| Testing | Testing patterns và frameworks |
| Documentation | Writing technical docs |
Best Practices
✅ Instructions rõ ràng
❌ "Tạo component đẹp"
✅ "Tạo functional component với TypeScript,
sử dụng Tailwind cho styling"✅ Có ví dụ cụ thể
## Example
Input:
\`\`\`
Create a Button component with primary and secondary variants
\`\`\`
Output:
\`\`\`tsx
interface ButtonProps {
variant: 'primary' | 'secondary';
children: React.ReactNode;
}
export function Button({ variant, children }: ButtonProps) {
const styles = {
primary: 'bg-blue-500 text-white',
secondary: 'bg-gray-200 text-gray-800'
};
return (
<button className={styles[variant]}>
{children}
</button>
);
}
\`\`\`✅ Cover edge cases
## Edge Cases
### Empty input
Nếu input rỗng, throw error với message rõ ràng.
### Invalid format
Validate input trước khi process.Chia sẻ Skills
Skills là open standard, có thể:
- Share trong team
- Publish lên GitHub
- Import từ community
Skills vs Rules
| Đặc điểm | Skills | Rules |
|---|---|---|
| Scope | Tác vụ cụ thể | Project-wide |
| Format | Structured instructions | Guidelines |
| Reusability | Cao (có thể share) | Project-specific |
| Complexity | Có thể phức tạp | Nên đơn giản |
Last updated on