Antigravity Kit
Mission Control for AI Agents
vudovn/antigravity-kitLời nói đầu
Antigravity Kit ra đời từ một nhận thức đơn giản: AI không thể thay thế chuyên gia, nhưng AI có thể trở thành chuyên gia khi được hướng dẫn đúng cách.
Trong thế giới phát triển phần mềm hiện đại, AI Agent không còn là công cụ trợ giúp thụ động. Nó đã tiến hóa thành đồng nghiệp có chuyên môn sâu - người mà bạn có thể giao một tác vụ phức tạp và nhận lại kết quả chất lượng production-ready.
Cuốn sách này hướng dẫn bạn hiểu, sử dụng, và tùy biến Antigravity Kit - từ cài đặt cơ bản đến orchestration (điều phối) đa agent cho dự án phức tạp.
Đối tượng độc giả
- Developers muốn leverage (tận dụng) AI Agent trong workflow hàng ngày
- Tech Leads muốn chuẩn hóa quy trình phát triển với AI
- AI Enthusiasts muốn hiểu cách thiết kế hệ thống multi-agent
1. Tổng quan Antigravity Kit
Antigravity Kit là gì?
Antigravity Kit là bộ AI Agent Templates mã nguồn mở, cung cấp framework (khung phát triển) hoàn chỉnh để biến AI model thành đội ngũ chuyên gia phát triển phần mềm.
Triết lý thiết kế
- Progressive Disclosure (Tiết lộ dần dần) - Thông tin chỉ được load khi cần
- Domain Boundaries (Ranh giới chuyên môn) - Mỗi agent chỉ hoạt động trong phạm vi chuyên môn
- Verify-First (Kiểm tra trước) - Mọi output đều phải qua validation
So sánh: AI thuần vs Antigravity Kit
| Khía cạnh | AI Model thuần | Antigravity Kit |
|---|---|---|
| Kiến thức | Generalist | Specialist per domain |
| Context | Load hết mọi thứ | Progressive Disclosure |
| Output | Tùy thuộc prompt | Chuẩn hóa qua checklist |
| Teamwork | Single agent | Multi-agent orchestration |
| Quality | Không kiểm tra | Master scripts tự động |
Thành phần chính
1. Agents (20 chuyên gia) - Mỗi Agent là một AI persona chuyên biệt với Role Definition, Decision Frameworks, Anti-patterns, và Review Checklist.
2. Skills (37 modules kiến thức) - Gói kiến thức modular hoạt động theo Progressive Disclosure 3 tầng.
3. Workflows (11 quy trình) - Quy trình tự động hóa qua slash commands: /create, /brainstorm, /orchestrate...
4. Master Scripts - checklist.py và verify_all.py chạy pre-delivery validation.
2. Cài đặt và thiết lập
Yêu cầu hệ thống
| Nền tảng | Hỗ trợ | Ghi chú |
|---|---|---|
| Google Gemini CLI | Đầy đủ | Nền tảng gốc |
| Claude Code | Đầy đủ | Tương thích hoàn toàn |
| Cursor IDE | Đầy đủ | Tích hợp trực tiếp |
Cài đặt nhanh
git clone https://github.com/anthropics/antigravity-kit.git
cd antigravity-kit
# Copy .agent vào dự án
cp -r .agent/ /path/to/your-project/.agent/
Cấu trúc thư mục
your-project/
├── .agent/
│ ├── agents/ # 20 specialist agents
│ ├── skills/ # 37 skill modules
│ ├── workflows/ # 11 workflows
│ ├── scripts/ # Master scripts
│ └── ARCHITECTURE.md
├── src/
└── ...
3. Kiến trúc hệ thống
Request Classification (Phân loại yêu cầu)
Khi user gửi request, hệ thống phân loại vào 1 trong 3 phương thức:
1. Single Agent Request
Khi request rơi vào domain của đúng 1 agent.
| Trigger keywords | Agent |
|---|---|
| "review code", "check quality" | code-archaeologist |
| "deploy", "CI/CD" | devops-engineer |
| "fix bug", "error" | debugger |
| "optimize", "lighthouse" | performance-optimizer |
| "database schema" | database-architect |
2. Workflow Request
Khi user dùng slash command: /create, /brainstorm, /orchestrate...
3. Multi-Agent Orchestration
Task phức tạp cần phối hợp nhiều chuyên gia (minimum 3 agents).
Skill Loading Protocol
Dựa trên Progressive Disclosure 3 tầng:
| Tier | Content | Khi nào load | Token cost |
|---|---|---|---|
| Tier 1 | YAML Frontmatter | Luôn có sẵn | ~50/skill |
| Tier 2 | SKILL.md Body | Khi relevant | ~500-2000 |
| Tier 3 | references/ | Khi cần deep knowledge | ~1000-5000 |
MCP (Kitchen) cung cấp thiết bị. Skill (Recipe) cung cấp hướng dẫn. MCP cho biết CÓ THỂ LÀM GÌ. Skill cho biết NÊN LÀM NHƯ THẾ NÀO.
Validation Layer
| Priority | Script | Mục đích |
|---|---|---|
| P0 | security_scan.py | Quét vulnerabilities, secrets |
| P1 | Color Contrast | WCAG AA accessibility |
| P1.5 | ux_audit.py | UX psychology laws |
| P2 | Touch Target | Mobile accessibility |
| P3 | lighthouse_audit.py | Performance, SEO |
| P4 | Playwright tests | End-to-end testing |
4. Hệ thống Agents
Tổng quan 20 Agents
| # | Agent | Domain |
|---|---|---|
| 1 | orchestrator | Điều phối đa agent |
| 2 | frontend-specialist | UI/UX, Web frontend |
| 3 | backend-specialist | Server, API, Backend |
| 4 | database-architect | Database, SQL, Schema |
| 5 | security-auditor | Cybersecurity, OWASP |
| 6 | debugger | Bug fixing, Root cause |
| 7 | devops-engineer | Deployment, CI/CD |
| 8 | test-engineer | Testing, TDD |
| 9 | mobile-developer | React Native, Flutter |
| 10 | project-planner | Planning, Task breakdown |
| 11 | game-developer | Unity, Godot, Phaser |
| 12 | performance-optimizer | Web Vitals, Profiling |
| 13 | documentation-writer | Technical writing |
| 14 | seo-specialist | SEO, Web performance |
| 15 | explorer-agent | Codebase analysis |
| 16 | code-archaeologist | Legacy code analysis |
| 17 | product-manager | Product strategy |
| 18 | product-owner | User stories, Backlog |
| 19 | penetration-tester | Pentest chuyên sâu |
| 20 | qa-automation-engineer | QA Automation |
Orchestrator - Điều phối viên chính
"Coordination is not control. Each specialist knows their domain better than you."
Orchestrator là "nhạc trưởng" - không viết code mà phối hợp các chuyên gia.
| Quy tắc | Mô tả |
|---|---|
| Minimum 3 agents | Không orchestrate nếu ít hơn 3 agents |
| No domain violation | Không yêu cầu agent làm ngoài chuyên môn |
| Sequential phases | Planning PHẢI xong trước Implementation |
| Conflict protocol | Quyết định dựa trên data khi bất đồng |
Frontend Specialist
"Frontend không phải trang trí - đó là engineering."
Có tư duy đi ngược xu hướng - chống "Modern SaaS Safe Harbor":
| Cliché phải tránh | Thay thế bằng |
|---|---|
| Purple/violet gradient mặc định | Màu sắc có chủ đích, phù hợp brand |
| Rounded cards + shadows chuẩn | Layout sáng tạo, phá vỡ quy ước |
| Hero section "generic" | Visual elements gây ấn tượng |
Framework Selection (2025)
| Scenario | Recommendation |
|---|---|
| Static site, landing page | Vanilla HTML/CSS + JS |
| Blog, content-heavy | Astro |
| Full-stack web app | Next.js 15 (App Router) |
| Dashboard, SPA | React + Vite |
Backend Specialist
"Backend is not just CRUD - it's system architecture."
- Security is non-negotiable: Validate everything, trust nothing
- Async by default: I/O-bound = async, CPU-bound = offload
- Type safety: TypeScript/Pydantic everywhere
Framework Selection (2025)
| Scenario | Node.js | Python |
|---|---|---|
| Edge/Serverless | Hono | - |
| High Performance | Fastify | FastAPI |
| Enterprise | NestJS | Django |
Database Architect
"Database is not just storage - it's the foundation."
Platform Selection (2025)
| Scenario | Recommendation |
|---|---|
| Full PostgreSQL features | Neon (serverless PG) |
| Edge deployment | Turso (edge SQLite) |
| AI/Embeddings | PostgreSQL + pgvector |
| Real-time features | Supabase |
Security Auditor
"Assume breach. Trust nothing. Verify everything. Defense in depth."
Code Red Flags
| Pattern | Risk |
|---|---|
| String concat in queries | SQL Injection |
eval(), exec() | Code Injection |
dangerouslySetInnerHTML | XSS |
| Hardcoded secrets | Credential exposure |
Debugger
"Don't guess. Investigate systematically. Fix the root cause, not the symptom."
4-Phase Debugging Process
PHASE 1: REPRODUCE - Tái tạo lỗi
PHASE 2: ISOLATE - Thu hẹp phạm vi
PHASE 3: UNDERSTAND - Root cause (5 Whys)
PHASE 4: FIX & VERIFY - Sửa + test regression
Các Agents khác
| Agent | Triết lý | Khi nào dùng |
|---|---|---|
devops-engineer | "Automate the repeatable" | Deployment, CI/CD, rollback |
test-engineer | "Find what the developer forgot" | Unit, E2E, TDD, coverage |
mobile-developer | "Mobile is not a small desktop" | React Native, Flutter, Expo |
project-planner | Phân tích + breakdown tasks | New projects, planning |
game-developer | "Experience, not technology" | Unity, Godot, Phaser |
performance-optimizer | "Measure first, optimize second" | Core Web Vitals, profiling |
documentation-writer | Kỹ thuật rõ ràng, có cấu trúc | API docs, README, guides |
seo-specialist | Technical + On-page SEO | SEO audit, meta tags |
explorer-agent | Map codebase hiện có | Onboarding, dependency analysis |
code-archaeologist | "Khảo cổ code" - hiểu lịch sử | Legacy analysis, refactoring |
product-manager | User needs + priorities | Feature prioritization, roadmap |
product-owner | User stories + backlog | Sprint planning, acceptance |
penetration-tester | Red team tactics | Deep security testing |
qa-automation-engineer | Automated testing infra | CI/CD testing, flaky test fix |
5. Hệ thống Skills
Progressive Disclosure 3 tầng
Skills là gói kiến thức modular mà agents load theo nhu cầu. Cấu trúc mỗi skill:
.agent/skills/skill-name/
├── SKILL.md # Tier 2 - required
├── references/ # Tier 3 - optional
├── scripts/ # Automation scripts
└── assets/ # Templates, fonts
Tổng quan 37 Skills
| Nhóm | Skills |
|---|---|
| Foundation | clean-code, lint-and-validate |
| Frontend | frontend-design, ui-ux-pro-max |
| Backend | nodejs-best-practices, python-patterns, api-patterns, database-design, mcp-builder |
| Mobile/Game | mobile-design (11 sub-files), game-development (12 sub-skills) |
| Security | vulnerability-scanner, red-team-tactics |
| Testing | testing-patterns, tdd-workflow, webapp-testing, code-review-checklist |
| DevOps | deployment-procedures, server-management, powershell-windows, bash-linux |
| Performance | performance-profiling |
| Planning | app-builder, plan-writing, brainstorming |
| Specialized | rust-pro, systematic-debugging |
Tạo Skill mới
# Tạo skill đơn giản
mkdir -p .agent/skills/code-review
# SKILL.md:
---
name: code-review
description: Reviews code for bugs, style, and best practices.
---
# Code Review Skill
## Review Checklist
1. Correctness - Does the code work?
2. Edge cases - Error conditions handled?
3. Style - Project conventions followed?
4. Performance - Obvious inefficiencies?
ui-ux-pro-max: Skill nâng cao
Skill phức tạp nhất - có search engine và 500+ design data points:
| Data | Count |
|---|---|
| UI Styles | 50+ |
| Color Palettes | 97 |
| Font Pairings | 57 |
| UX Guidelines | 99 |
| Chart Types | 25 |
# Generate design system tự động
python3 search.py "beauty spa" --design-system -p "My Spa"
# Search theo domain
python3 search.py "dark glassmorphism" --domain style
python3 search.py "SaaS dashboard" --domain color
6. Hệ thống Workflows
11 workflows cung cấp quy trình chuẩn hóa, trigger bằng slash commands:
| Command | Mô tả | Agents |
|---|---|---|
/create | Tạo ứng dụng mới | planner, frontend/backend/DB |
/brainstorm | Khám phá ý tưởng | Single agent, 4 phases |
/orchestrate | Điều phối đa agent | Orchestrator + 3+ agents |
/plan | Lên kế hoạch | project-planner |
/debug | Debug có phương pháp | debugger |
/review | Code review | code-archaeologist |
/test | Tạo test suite | test-engineer |
/deploy | Deploy ứng dụng | devops-engineer |
/secure | Security audit | security-auditor |
/optimize | Tối ưu hiệu suất | performance-optimizer |
/ui-ux-pro-max | Design system | frontend-specialist |
/create - Tạo ứng dụng
/create e-commerce platform with product catalog,
shopping cart, and Stripe payments
Flow:
Request Analysis → Technology Selection →
Project Planning → Agent Assignment
/brainstorm - Khám phá ý tưởng
4 Phases:
1. UNDERSTAND - Clarify problem, constraints
2. EXPLORE - Generate 3-5 options
3. EVALUATE - Compare, trade-off, risk
4. RECOMMEND - Top pick + roadmap
/orchestrate - Điều phối đa agent
Workflow phức tạp nhất - phối hợp minimum 3 agents:
Protocol:
1. Orchestrator Analysis (chọn agents ≥ 3)
2. PHASE 1: Planning (mỗi agent lên kế hoạch)
3. PHASE 2: Implementation (thực thi theo dependency)
4. Conflict Resolution (nếu có)
5. Verification + Delivery
7. Multi-Agent Orchestration
Protocol chi tiết
Orchestrator KHÔNG: viết code, thiết kế, review security
Orchestrator CHỈ: phân tích, chọn agents, chia tasks,
truyền context, giải quyết conflicts
Conflict Resolution
Khi 2 agents bất đồng:
- Xem evidence - approach nào có bằng chứng mạnh hơn?
- Domain authority - agent nào có quyền quyết định?
- User preference - hỏi user nếu cần
Case Study: Build Next.js Dashboard
User Request
/orchestrate Build real-time analytics dashboard with:
- PostgreSQL for storing events
- REST API + WebSocket for real-time
- React dashboard with charts
- JWT Authentication
- Playwright E2E tests
6 Agents tham gia
| Agent | Subtask |
|---|---|
database-architect | Schema: events, users, sessions |
backend-specialist | REST API + WebSocket + JWT |
frontend-specialist | React dashboard + Recharts |
security-auditor | JWT review, input validation |
test-engineer | Playwright E2E tests |
performance-optimizer | Chart rendering optimization |
Implementation Order
Step 1 (Sequential): database-architect → schema
Step 2 (Sequential): backend-specialist → API
Step 3 (Parallel): frontend + security review
Step 4 (Sequential): test-engineer → E2E tests
Step 5 (Parallel): performance optimization
8. Case Studies và Thực hành
Case Study 1: Landing Page chuyên nghiệp
/create landing page cho dịch vụ spa,
phong cách elegant và premium
→ ui-ux-pro-max generate design system
→ Frontend Specialist triển khai
→ verify_all.py → Lighthouse 98+, SEO 100
Case Study 2: Debug Production Error
Kỹ thuật 5 Whys
WHY 500? → Database query timeout
WHY timeout? → Connection pool full
WHY full? → Connections not released
WHY? → Missing await on query
WHY? → Copy-paste error ← ROOT CAUSE
Fix: 1 dòng code (thêm await)
+ Regression test + Audit tương tự
Bài tập thực hành
Bài 1: Tạo Git Commit Skill
mkdir -p .agent/skills/git-commit
# SKILL.md
---
name: git-commit
description: Formats git commit following Conventional Commits.
---
Types: feat, fix, docs, refactor, test, chore
Rules: lowercase, imperative mood, max 72 chars
Example: feat(auth): add JWT refresh token rotation
Bài 2: Custom Agent
# .agent/agents/my-project-specialist.md
---
name: my-project-specialist
description: Expert in [your project] conventions
skills: clean-code, [relevant-skills]
---
## Project Context: [describe your architecture]
## Conventions: [your code conventions]
## Decision Frameworks: [your tech stack]
Tips nâng cao
| Tip | Chi tiết |
|---|---|
| Skill Chaining | Agent tự load combo skills phù hợp |
| Context Budget | Mỗi task chỉ nên load 2-3 skills maximum |
| Customization | Override skill → Add skill → Modify agent → New workflow |
| Team Collaboration | Commit .agent/ vào repo, shared workflows |