Bỏ qua để đến nội dung

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à 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

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`
  1. Agent phát hiện skill liên quan đến task
  2. Agent đọc SKILL.md để hiểu instructions
  3. Agent tuân theo instructions trong quá trình thực hiện
.agent/skills/
└── my-skill/
├── SKILL.md
├── scripts/
│ └── helper.js
└── examples/
└── example.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ý.

Yêu cầu Agent sử dụng skill:

"Sử dụng skill my-skill để thực hiệ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
❌ "Tạo component đẹp"
✅ "Tạo functional component với TypeScript,
sử dụng Tailwind cho styling"
## 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>
);
}
\`\`\`
## 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.

Skills là open standard, có thể:

  • Share trong team
  • Publish lên GitHub
  • Import từ community
Đặ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