Skills: Nâng Cao Chuyên Môn Agent

Dùng Skills để cung cấp kiến thức chuyên sâu cho các tác vụ cụ thể

Skills Là Gì?

Skills là structured knowledge packages, cung cấp domain expertise cho agent trong các lĩnh vực cụ thể. Thay vì kiến thức chung, agent có detailed patterns, best practices và decision-making framework.

Skills nằm trong .agent/skills/ và chứa:

  • SKILL.md — File hướng dẫn chính (bắt buộc)
  • scripts/ — Scripts hỗ trợ agent thực thi
  • examples/ — Reference implementations
  • resources/ — Templates, assets

Skills Phổ Biến

SkillChức năng
clean-codeEnforce code ngắn gọn, tự document
frontend-designDesign thinking cho web UI/UX
tailwind-patternsBest practices Tailwind CSS v4
testing-patternsUnit, integration, mocking strategies
seo-fundamentalsSEO optimization
vulnerability-scannerOWASP 2025 security scanning

Tạo Custom Skill

Tạo .agent/skills/my-api/SKILL.md:

---
name: my-api-patterns
description: API design patterns cho microservice stack
---

# API Design Skill

## Response Format

Tất cả API phải trả về:
{
"data": T,
"meta": { "page": number, "total": number },
"error": null | { "code": string, "message": string }
}

## Authentication

- Tất cả endpoints cần Bearer token
- Dùng middleware, không check auth trong handlers

Skills Có Scripts

Skills có thể bao gồm scripts thực thi:

.agent/skills/testing-patterns/
├── SKILL.md
└── scripts/
    ├── test_runner.py    → Chạy tests với coverage
    └── lint_runner.py    → Lint code và báo lỗi

Kết Hợp Nhiều Skills

Agent có thể kết hợp skills cho tác vụ phức tạp:

Task: "Build trang user profile"

Skills kích hoạt:
├── frontend-design → Layout và UI patterns
├── clean-code → Code quality standards
├── tailwind-patterns → Styling approach
├── testing-patterns → Viết component tests
└── seo-fundamentals → Meta tags và structure

Task Groups

Task Groups cho phép nhóm các tác vụ liên quan cần thực hiện cùng nhau — hữu ích cho refactoring trên nhiều files.

Best Practices

  1. Một skill, một lĩnh vực — Không trộn API patterns với UI rules
  2. Giữ SKILL.md tập trung — Rõ ràng giúp agent đọc tốt hơn
  3. Kèm anti-patterns — Show những gì KHÔNG nên làm
  4. Thêm ví dụ thực tế — Code thực nói nhiều hơn rules

Tiếp Theo

Chúng ta đã biết agent suy nghĩ thế nào (modes), tuân theo gì (rules), và biết gì (skills). Tiếp theo hãy khám phá tools — MCP, Browser và Artifacts.