---
name: agsmartkit
description: >
  Bộ tư duy xây dựng app chuyên nghiệp cho Google Antigravity.
  Kích hoạt khi user yêu cầu build app, feature phức tạp, hoặc cần
  lập kế hoạch triển khai. Áp dụng Architecture Checklist, 9 Mental 
  Models, Sequential Pipeline (Plan→Code→Simplify→Test→Review), 
  Status Protocol, và 5-Phase Workflow.
---

# AG Smart Kit

Bộ tư duy phát triển phần mềm chuyên nghiệp cho Google Antigravity.

## Khi nào kích hoạt

Skill này PHẢI được kích hoạt khi:
- User yêu cầu **build app mới** (web, mobile, CLI, API...)
- User yêu cầu **feature phức tạp** (nhiều component, cần architecture)
- User yêu cầu **refactor lớn** hoặc **migration**
- User yêu cầu **debug issue phức tạp** (multi-component)

## Workflow bắt buộc

### Bước 1: Research (KHÔNG sửa code)
- Phân tích yêu cầu bằng **9 Mental Models**:
  1. **Decomposition** — Chia nhỏ goal
  2. **Working Backwards** — "Done = gì?" → trace ngược
  3. **Second-Order Thinking** — Hậu quả ẩn?
  4. **5 Whys** — Vấn đề thật là gì?
  5. **80/20 MVP** — 20% features = 80% giá trị
  6. **Risk & Dependency** — Gì có thể sai? Phụ thuộc gì?
  7. **Systems Thinking** — Ảnh hưởng hệ thống hiện tại?
  8. **Capacity Planning** — Effort thực tế
  9. **User Journey Mapping** — Toàn bộ hành trình user
- Hỏi user nếu có questions quan trọng

### Bước 2: Plan (user phải approve)
Tạo `implementation_plan.md` với **Architecture Checklist**:
- [ ] Data flows documented
- [ ] Dependency graph complete
- [ ] Risk assessed per phase
- [ ] Backwards compatibility stated
- [ ] Test matrix defined
- [ ] Rollback plan exists
- [ ] File ownership assigned
- [ ] Success criteria measurable

### Bước 3: Execute (theo pipeline)
```
PLAN → CODE → SIMPLIFY → TEST → REVIEW
```
Quy tắc code:
- **YAGNI / KISS / DRY** — LUÔN LUÔN
- File < 200 dòng → vượt thì tách module
- Kebab-case naming (self-documenting)
- Build/compile check sau MỖI lần sửa
- KHÔNG fake/mock/cheat để pass build
- KHÔNG ignore failing tests
- KHÔNG tạo file "enhanced" — sửa file gốc

### Bước 4: Verify
- Chạy app, test thực tế
- Browser recording nếu web app
- Fix issues

### Bước 5: Document
- Tạo `walkthrough.md` tổng kết
- Lưu Knowledge Item nếu pattern reusable

## Status Protocol

Sau mỗi task, report:
- **DONE** — Hoàn thành → tiếp tục
- **DONE_WITH_CONCERNS** — Xong, có lo ngại → user review
- **BLOCKED** — Không thể tiếp → cần thêm info/thay approach
- **NEEDS_CONTEXT** — Thiếu thông tin → user cung cấp

Quy tắc:
- BLOCKED 3+ lần cùng task → escalate cho user
- DONE_WITH_CONCERNS về correctness → address trước khi tiếp

## Context Isolation
- Mô tả task cụ thể + file paths
- KHÔNG "tiếp tục cái hôm qua" — describe rõ ràng
- Task summary 5 dòng max, không dump history

## Git Discipline
- Conventional commits: `feat:`, `fix:`, `docs:`, `refactor:`
- Atomic commits — 1 commit = 1 thay đổi logic
- KHÔNG commit secrets (`.env`, API keys)

## Companion Skills

AG Smart Kit gồm 3 agent skills chuyên biệt, load khi cần:

| Skill | Persona | Khi nào dùng |
|-------|---------|-------------|
| `agsmartkit-debugger` | Senior SRE | Debug, root cause analysis, log investigation |
| `agsmartkit-tester` | QA Lead | Test execution, coverage, build verification |
| `agsmartkit-reviewer` | Staff Engineer | Code review, security audit, pre-landing check |

## Checklists (trong `checklists/`)

| Checklist | Mô tả |
|-----------|--------|
| `base.md` | Universal — Injection, Race Conditions, Security, Auth |
| `web-app.md` | Overlay — XSS, CSRF, Accessibility, Frontend Performance |
| `api.md` | Overlay — Rate Limiting, Input Validation, Data Exposure |

Áp dụng `base.md` **luôn luôn**. Thêm overlay phù hợp với project type.

## Templates (trong `templates/`)

| Template | Mô tả |
|----------|--------|
| `plan-template.md` | Khuôn mẫu implementation plan với YAML frontmatter |
| `scope-challenge.md` | 3 câu hỏi scope + 3 modes trước khi plan |
