# Trang 6.2: Sử dụng các script kiểm tra tổng thể (  checklist.py  &   verify_all.py ).

## 1. Tổng quan

Antigravity Kit cung cấp 2 script Python tổng thể (master scripts) trong thư mục `.agent/scripts/`. Chúng điều phối toàn bộ bộ script con từ các Skills để thực hiện kiểm tra chất lượng dự án một cách có hệ thống.

<div class="my-4 rounded-lg overflow-hidden border border-gray-500/20 [&_thead_tr:first-child_th:first-child]:border-t-0 [&_thead_tr:first-child_th:first-child]:border-l-0 [&_thead_tr:first-child_th:last-child]:border-t-0 [&_thead_tr:first-child_th:last-child]:border-r-0 [&_tbody_tr:last-child_td:first-child]:border-b-0 [&_tbody_tr:last-child_td:first-child]:border-l-0 [&_tbody_tr:last-child_td:last-child]:border-b-0 [&_tbody_tr:last-child_td:last-child]:border-r-0 [&_thead_tr:first-child_th]:border-t-0 [&_tbody_tr:last-child_td]:border-b-0 [&_th:first-child]:border-l-0 [&_td:first-child]:border-l-0 [&_th:last-child]:border-r-0 [&_td:last-child]:border-r-0" id="bkmrk-script-m%E1%BB%A5c-%C4%91%C3%ADch-khi-"><table class="min-w-full border-separate border-spacing-0"><thead><tr><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Script</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Mục đích</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Khi nào dùng</th></tr></thead><tbody><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`checklist.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Kiểm tra nhanh theo thứ tự ưu tiên</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Hàng ngày, trước commit</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`verify_all.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Kiểm tra toàn diện bao gồm E2E và performance</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Trước khi release production</td></tr></tbody></table>

</div>---

## 2. `checklist.py` — Kiểm tra hàng ngày

### Cú pháp

```bash
bash
# Kiểm tra cơ bản
python .agent/scripts/checklist.py .


# Kiểm tra đầy đủ kèm performance (cần server đang chạy)
python .agent/scripts/checklist.py . --url http://localhost:3000
```

### Thứ tự ưu tiên kiểm tra (P0 → P6)

<div class="my-4 rounded-lg overflow-hidden border border-gray-500/20 [&_thead_tr:first-child_th:first-child]:border-t-0 [&_thead_tr:first-child_th:first-child]:border-l-0 [&_thead_tr:first-child_th:last-child]:border-t-0 [&_thead_tr:first-child_th:last-child]:border-r-0 [&_tbody_tr:last-child_td:first-child]:border-b-0 [&_tbody_tr:last-child_td:first-child]:border-l-0 [&_tbody_tr:last-child_td:last-child]:border-b-0 [&_tbody_tr:last-child_td:last-child]:border-r-0 [&_thead_tr:first-child_th]:border-t-0 [&_tbody_tr:last-child_td]:border-b-0 [&_th:first-child]:border-l-0 [&_td:first-child]:border-l-0 [&_th:last-child]:border-r-0 [&_td:last-child]:border-r-0" id="bkmrk-m%E1%BB%A9c-t%C3%AAn-c%C3%B4ng-c%E1%BB%A5-d%E1%BB%ABng"><table class="min-w-full border-separate border-spacing-0"><thead><tr><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Mức</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Tên</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Công cụ</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Dừng nếu lỗi?</th></tr></thead><tbody><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P0**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Security Scan</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`security_scan.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">✅ Có — Critical</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P1**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Lint &amp; Type Check</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`lint_runner.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">✅ Có — Critical</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P2**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Schema Validation</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`schema_validator.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">❌ Không</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P3**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Test Runner</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`test_runner.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">❌ Không</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P4**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">UX Audit</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`ux_audit.py` + `accessibility_checker.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">❌ Không</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P5**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">SEO Check</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`seo_checker.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">❌ Không</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**P6**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Performance</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`lighthouse_audit.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">❌ Không (cần URL)</td></tr></tbody></table>

</div>> **Logic dừng sớm:** Nếu P0 (Security) hoặc P1 (Lint) thất bại, toàn bộ checklist dừng ngay và báo lỗi. Bạn phải sửa các vấn đề Critical trước khi các bước tiếp theo có ý nghĩa.

### Ví dụ kết quả

<div class="relative whitespace-pre-wrap word-break-all my-2 rounded-lg bg-list-hover-subtle border border-gray-500/20" id="bkmrk--1" node="[object Object]"><div class="min-h-7 relative box-border flex flex-row items-center justify-between rounded-t border-b border-gray-500/20 px-2 py-0.5">  
</div><div class="p-3"><div class="w-full h-full text-xs cursor-text"><div class="code-block"><div class="code-line" data-line-end="43" data-line-number="43" data-line-start="43"><div class="line-content">  
</div></div></div></div></div></div>```html
============================================================
🚀 ANTIGRAVITY KIT - MASTER CHECKLIST
============================================================
Project: /path/to/my-project


============================================================
📋 CORE CHECKS
============================================================


🔄 Running: Security Scan
✅ Security Scan: PASSED


🔄 Running: Lint Check
✅ Lint Check: PASSED


🔄 Running: Schema Validation
⏭️ Schema Validation: Script not found, skipping


🔄 Running: Test Runner
✅ Test Runner: PASSED


🔄 Running: UX Audit
✅ UX Audit: PASSED


🔄 Running: SEO Check
⚠️ SEO Check: FAILED
Error: Missing meta description on 3 pages


============================================================
📊 CHECKLIST SUMMARY
============================================================
Total Checks: 6
✅ Passed: 4
❌ Failed: 1
⏭️ Skipped: 1


❌ SEO Check
✅ Security Scan
✅ Lint Check
✅ Test Runner
✅ UX Audit


1 check(s) FAILED - Please fix before proceeding
```

<div class="relative whitespace-pre-wrap word-break-all my-2 rounded-lg bg-list-hover-subtle border border-gray-500/20" id="bkmrk--2" node="[object Object]"><div class="p-3"><div class="w-full h-full text-xs cursor-text"><div class="code-block"><div class="code-line" data-line-end="43" data-line-number="43" data-line-start="43"><div class="line-content">  
</div></div></div></div></div></div>---

## 3. `verify_all.py` — Kiểm tra toàn diện trước production

### Cú pháp

```bash
bash


# Cần cung cấp URL của server đang chạy
python .agent/scripts/verify_all.py . --url http://localhost:3000
```

### Kiểm tra thêm so với `checklist.py`

<div class="my-4 rounded-lg overflow-hidden border border-gray-500/20 [&_thead_tr:first-child_th:first-child]:border-t-0 [&_thead_tr:first-child_th:first-child]:border-l-0 [&_thead_tr:first-child_th:last-child]:border-t-0 [&_thead_tr:first-child_th:last-child]:border-r-0 [&_tbody_tr:last-child_td:first-child]:border-b-0 [&_tbody_tr:last-child_td:first-child]:border-l-0 [&_tbody_tr:last-child_td:last-child]:border-b-0 [&_tbody_tr:last-child_td:last-child]:border-r-0 [&_thead_tr:first-child_th]:border-t-0 [&_tbody_tr:last-child_td]:border-b-0 [&_th:first-child]:border-l-0 [&_td:first-child]:border-l-0 [&_th:last-child]:border-r-0 [&_td:last-child]:border-r-0" id="bkmrk-ki%E1%BB%83m-tra-th%C3%AAm-c%C3%B4ng-c"><table class="min-w-full border-separate border-spacing-0"><thead><tr><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Kiểm tra thêm</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Công cụ</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Mục đích</th></tr></thead><tbody><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**Lighthouse Audit**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`lighthouse_audit.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Score Core Web Vitals (LCP, CLS, INP)</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**Playwright E2E**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`playwright_runner.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Kiểm thử end-to-end trên trình duyệt thật</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**Bundle Analysis**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`bundle_analyzer.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Phân tích kích thước bundle JS/CSS</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**Mobile Audit**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">`mobile_audit.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Kiểm tra responsive + touch targets</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">**i18n Check**</td><td class="px-3 py-2 leading-snug border border-gray-500/20">(nếu có)</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Kiểm tra hardcoded strings</td></tr></tbody></table>

</div>### Yêu cầu trước khi chạy `verify_all.py`

- ✅ Server phải đang chạy (chạy `/preview start` trước).
- ✅ Playwright phải được cài: `npx playwright install`.
- ✅ Chromium hoặc Chrome phải có sẵn trên máy.

---

## 4. Khi nào dùng script nào?

```html
Đang phát triển hàng ngày:
→ python .agent/scripts/checklist.py .
→ Nhanh, dừng sớm khi có lỗi critical


Trước khi tạo Pull Request:
→ python .agent/scripts/checklist.py .
→ Đảm bảo không có Security/Lint issues


Trước khi merge vào main:
→ python .agent/scripts/checklist.py . --url http://localhost:3000
→ Bao gồm cả performance check


Trước khi release lên production:
→ python .agent/scripts/verify_all.py . --url http://localhost:3000
→ Kiểm tra toàn diện kể cả E2E và Lighthouse
```

---

## 5. Tích hợp vào CI/CD

### GitHub Actions

<div class="relative whitespace-pre-wrap word-break-all my-2 rounded-lg bg-list-hover-subtle border border-gray-500/20" id="bkmrk--6" node="[object Object]"><div class="min-h-7 relative box-border flex flex-row items-center justify-between rounded-t border-b border-gray-500/20 px-2 py-0.5">  
</div><div class="p-3"><div class="w-full h-full text-xs cursor-text"><div class="code-block"><div class="code-line" data-line-end="29" data-line-number="29" data-line-start="29"><div class="line-content"></div></div></div></div></div></div>```html
yaml


name: Quality Check
on: [push, pull_request]


jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3


- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'


- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'


- name: Install dependencies
run: npm ci


- name: Run Antigravity Checklist
run: python .agent/scripts/checklist.py .


# Deploy chỉ chạy khi checklist pass
- name: Deploy
if: success() && github.ref == 'refs/heads/main'
run: npm run deploy
```

---

## 6. Chạy script con riêng lẻ

Ngoài 2 master scripts, bạn cũng có thể chạy từng script con riêng lẻ khi cần:

<div class="relative whitespace-pre-wrap word-break-all my-2 rounded-lg bg-list-hover-subtle border border-gray-500/20" id="bkmrk--8" node="[object Object]"><div class="min-h-7 relative box-border flex flex-row items-center justify-between rounded-t border-b border-gray-500/20 px-2 py-0.5">  
</div><div class="p-3"><div class="w-full h-full text-xs cursor-text"><div class="code-block"><div class="code-line" data-line-end="11" data-line-number="11" data-line-start="11"><div class="line-content"></div></div></div></div></div></div>```html
bash


# Chỉ quét bảo mật
python .agent/skills/vulnerability-scanner/scripts/security_scan.py .


# Chỉ kiểm tra UX
python .agent/skills/frontend-design/scripts/ux_audit.py .


# Chỉ chạy Lighthouse
python .agent/skills/performance-profiling/scripts/lighthouse_audit.py . http://localhost:3000


# Chỉ kiểm tra SEO
python .agent/skills/seo-fundamentals/scripts/seo_checker.py .
```

---

## 7. Kích hoạt từ lệnh chat

Bạn không cần nhớ đường dẫn script. Chỉ cần nói với AI:

```html
"final checks" → AI chạy checklist.py tự động
"son kontrolleri yap" → (Tiếng Thổ) Cũng kích hoạt checklist
"chạy tất cả test" → AI chạy checklist.py
"kiểm tra trước khi deploy" → AI chạy verify_all.py (với URL)

AI được cấu hình để nhận diện các từ khóa này và tự động chạy đúng script cho bạn.
```

---

## 8. Bảng tổng hợp toàn bộ 12 Scripts

<div class="my-4 rounded-lg overflow-hidden border border-gray-500/20 [&_thead_tr:first-child_th:first-child]:border-t-0 [&_thead_tr:first-child_th:first-child]:border-l-0 [&_thead_tr:first-child_th:last-child]:border-t-0 [&_thead_tr:first-child_th:last-child]:border-r-0 [&_tbody_tr:last-child_td:first-child]:border-b-0 [&_tbody_tr:last-child_td:first-child]:border-l-0 [&_tbody_tr:last-child_td:last-child]:border-b-0 [&_tbody_tr:last-child_td:last-child]:border-r-0 [&_thead_tr:first-child_th]:border-t-0 [&_tbody_tr:last-child_td]:border-b-0 [&_th:first-child]:border-l-0 [&_td:first-child]:border-l-0 [&_th:last-child]:border-r-0 [&_td:last-child]:border-r-0" id="bkmrk-script-skill-khi-n%C3%A0o"><table class="min-w-full border-separate border-spacing-0"><thead><tr><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Script</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Skill</th><th class="bg-gray-500/20 px-3 py-2 text-left font-medium leading-snug border border-gray-500/20">Khi nào dùng</th></tr></thead><tbody><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`security_scan.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">vulnerability-scanner</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Mỗi lần deploy</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`dependency_analyzer.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">vulnerability-scanner</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Hàng tuần / Mỗi lần deploy</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`lint_runner.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">lint-and-validate</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Mỗi lần thay đổi code</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`test_runner.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">testing-patterns</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Sau khi thay đổi logic</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`schema_validator.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">database-design</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Sau khi thay đổi DB schema</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`ux_audit.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">frontend-design</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Sau khi thay đổi UI</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`accessibility_checker.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">frontend-design</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Sau khi thay đổi UI</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`seo_checker.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">seo-fundamentals</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Sau khi thay đổi trang</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`bundle_analyzer.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">performance-profiling</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Trước khi deploy</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`mobile_audit.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">mobile-design</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Sau khi thay đổi mobile UI</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`lighthouse_audit.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">performance-profiling</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Trước khi deploy</td></tr><tr><td class="px-3 py-2 leading-snug border border-gray-500/20">`playwright_runner.py`</td><td class="px-3 py-2 leading-snug border border-gray-500/20">webapp-testing</td><td class="px-3 py-2 leading-snug border border-gray-500/20">Trước khi deploy</td></tr></tbody></table>

</div>> **Ghi nhớ:** `checklist.py` và `verify_all.py` điều phối tất cả các scripts trên theo đúng thứ tự ưu tiên. Trong hầu hết các trường hợp, bạn chỉ cần gọi 2 master scripts và không cần chạy từng cái riêng lẻ.