Case 01 — Setup
Project mới: thiết lập nền móng AI-ready
Làm đúng từ đầu — CLAUDE.md, cấu trúc, conventions — để mọi interaction sau đó đều hiệu quả tối đa. Đầu tư 2 giờ, tiết kiệm hàng tuần.
Day 1 Foundation High ROI
Workflow tổng quan
1. Khởi tạo với Claude
2. CLAUDE.md
3. Scaffold structure
4. Core setup
5. Commands library
6. Verify & commit
🚀 Bước 1: khởi tạo project — để Claude setup boilerplate
Làm đầu tiên
Thay vì tự setup thủ công — giao cho Claude lên scaffold
Cung cấp đủ ngữ cảnh kỹ thuật ngay từ đầu. Claude sẽ tạo cấu trúc, config files, và CLAUDE.md draft — bạn review và điều chỉnh.
claude "Tôi cần khởi tạo project mới với thông tin sau:

PROJECT: API service quản lý đơn hàng cho e-commerce
STACK:
  - Runtime: Node.js 20 + TypeScript 5 (strict mode)
  - Framework: Fastify (không phải Express — nhanh hơn)
  - Database: PostgreSQL 15 + Prisma ORM
  - Auth: JWT access (15m) + refresh token (7d) lưu Redis
  - Queue: BullMQ + Redis cho background jobs
  - Testing: Vitest + Supertest
  - Linting: ESLint Airbnb-base + Prettier
  - Logger: Pino (structured JSON)

CODING PATTERNS tôi muốn enforce:
  - Repository pattern (không query DB trực tiếp trong service)
  - Result<T, E> pattern cho error handling (không throw)
  - Zod schemas cho input validation
  - Dependency injection thủ công (không framework)

YÊU CẦU:
1. Tạo directory structure đầy đủ với README trong mỗi folder
2. Package.json với tất cả deps + scripts cần thiết
3. tsconfig.json với strict mode đúng cho Node.js
4. .eslintrc, .prettierrc, .gitignore
5. Prisma schema với model User và Order mẫu
6. Docker Compose cho local dev (postgres + redis)
7. File src/index.ts — entry point, Fastify setup
8. CLAUDE.md draft — điền đầy đủ project context

Tạo từng file một, show nội dung. Hỏi tôi nếu có quyết định kiến trúc cần confirm."
Claude sẽ tạo 15–20 file trong 1 session. Thủ công mất 3–4 giờ, với Claude mất 15–20 phút.
Verify sau khi Claude setup xong
# Claude tự chạy verify — không cần bạn test thủ công
claude "Project vừa được tạo. Verify toàn bộ:
1. npm install — có lỗi dependency không?
2. npm run typecheck — TypeScript clean không?
3. npm run lint — ESLint pass không?
4. docker-compose up -d — containers start được không?
5. npm run db:migrate — migration chạy được không?
6. npm run dev — server khởi động được không?

Fix mọi issue gặp phải. Báo cáo final status."
📋 Bước 2: CLAUDE.md — viết đúng từ đầu, không sửa về sau
Quan trọng nhất
Template production-grade — copy và điền vàoTiết kiệm 3000+ token/ngày
# CLAUDE.md
## Project
- Name: Order Management Service
- Purpose: REST API backend cho e-commerce platform
- Team: 4 devs, repository github.com/company/order-svc

## Tech stack
- Node.js 20 + TypeScript 5 strict
- Fastify 4 (NOT Express)
- PostgreSQL 15 + Prisma 5 ORM
- Redis 7 (auth tokens + BullMQ queue)
- Docker + Kubernetes (GKE)

## Repository structure
src/
  routes/        # Route definitions + Zod schemas. Không có business logic.
  controllers/   # Request handlers. Gọi service, format response.
  services/      # Business logic. Không gọi DB trực tiếp.
  repositories/  # DB layer. Chỉ Prisma queries.
  domain/        # TypeScript interfaces, value objects, Result type
  lib/           # Singletons: db, redis, logger, queue
  errors/        # Custom error classes kế thừa AppError
  utils/         # Pure functions. Không side effects.
tests/
  unit/          # Services + utils. Mock repos.
  integration/   # API routes. Real test DB.
  fixtures/      # Test data factories.

## Coding rules (enforce nghiêm)
- KHÔNG throw errors — dùng Result<T, AppError> từ src/domain/result.ts
- KHÔNG dùng `any` — dùng `unknown` rồi narrow
- KHÔNG query DB trong service — gọi qua repository interface
- KHÔNG import @prisma/client ngoài src/repositories/
- KHÔNG hardcode config — luôn từ src/lib/config.ts (đọc env)
- Functions tối đa 30 dòng. Nếu dài hơn → tách.
- Tất cả public methods có JSDoc với @throws nếu có
- Log format: pino structured. Không log: password, token, card number

## Error handling pattern
// ĐÚNG — dùng Result type
async findById(id: string): Promise<Result<Order, AppError>> {
  const order = await prisma.order.findFirst({ where: { id, deletedAt: null } });
  if (!order) return err(new NotFoundError('Order', id));
  return ok(toDomain(order));
}
// SAI — không throw
async findById(id: string): Promise<Order> {
  const order = await prisma.order.findFirst({ where: { id } });
  if (!order) throw new Error('Not found'); // ❌
  return order;
}

## Business rules
- Order status flow: DRAFT → CONFIRMED → PAID → SHIPPED → DELIVERED
  Transitions ngược KHÔNG hợp lệ. Xem src/domain/order-status.ts.
- Soft delete: set deletedAt. KHÔNG xóa record.
- Audit log: mọi mutation → ghi audit_logs (xem AuditService).
- Money: integer (VNĐ, không cents). KHÔNG float.
- Timezone: UTC trong DB. Client tự convert.

## Commands
npm run dev           # Fastify + hot reload (port 3000)
npm test              # Vitest unit tests
npm run test:int      # Integration tests (cần TEST_DATABASE_URL)
npm run db:migrate    # Prisma migrations
npm run db:seed       # Seed dev data
npm run typecheck     # tsc --noEmit
npm run lint          # ESLint + Prettier check
npm run lint:fix      # Auto-fix lint issues

## Common gotchas
- Prisma: dùng findFirst (không findOne, đã deprecated)
- Redis: singleton từ src/lib/redis.ts. Không tạo connection mới.
- BullMQ jobs phải idempotent — có thể retry an toàn
- Fastify routes: schema validation tự động từ Zod (plugin)
- Test isolation: mỗi test file có beforeEach cleanup riêng
⌨️ Bước 3: setup custom commands library ngay từ đầu
Automation
# Cấu trúc commands folder — tạo ngay Day 1
.claude/
└── commands/
    ├── feature.md       # /feature user-auth
    ├── fix.md           # /fix "TypeError: null"
    ├── test.md          # /test src/services/order.ts
    ├── review.md        # /review (review staged changes)
    ├── refactor.md      # /refactor src/services/user.ts
    └── audit.md         # /audit (security scan)
Mỗi command là 1 lần đầu tư. Sau đó mỗi ngày tiết kiệm 5–10 phút viết prompt. Team 4 người = 1–2 giờ/ngày saved.
Xem nội dung từng command — copy và dùng ngay

      
Lưu nội dung trên vào file .claude/commands/feature.md — Claude tự nhận diện khi gõ /feature [tên feature]
⚙️ Bước 4: settings.json — permissions và model theo môi trường
Team setup
// .claude/settings.json — commit vào git
{
  "model": "claude-sonnet-4-5",
  "permissions": {
    "allow": [
      "Bash(npm:*)", "Bash(npx:*)",
      "Bash(git diff:*)", "Bash(git log:*)", "Bash(git status:*)",
      "Bash(git add:*)", "Bash(git commit:*)",
      "Bash(docker-compose:*)",
      "Write(src/**)", "Write(tests/**)", "Write(docs/**)",
      "Write(prisma/schema.prisma)"
    ],
    "deny": [
      "Bash(rm -rf:*)",
      "Bash(git push:*)",          // push phải manual
      "Write(.env*)",               // bảo vệ env files
      "Write(prisma/migrations/**)"  // migration phải review
    ]
  }
}
Case 02 — Understanding
Đọc hiểu project cũ — không tốn token vô ích
Project legacy hàng trăm nghìn dòng, không có docs, người cũ đã nghỉ. Đây là kỹ năng quan trọng nhất của dev mới join team — và Claude làm điều này tốt hơn đọc code thủ công 10x.
Token-efficient Onboarding Hay bị làm sai
Nguyên tắc — đọc theo tầng, không đọc tuốt luốt
❌ Cách tốn token nhất
Paste toàn bộ file vào prompt. Hoặc để Claude tự đọc mọi thứ không có định hướng. Một project 50K dòng = 200K+ token để đọc hết.
✅ Cách đúng — đọc theo tầng
Layer 1: structure overview. Layer 2: entry points. Layer 3: domain logic. Layer 4: cụ thể theo task. Mỗi layer chỉ đọc những gì cần.
🗺️ Layer 1: Architecture overview — 5 phút, ít token nhất
Bắt đầu đây
Prompt: overview không đọc nhiều file~2000 token
Claude dùng LSGlob để map structure, không cần đọc từng file.
claude "Phân tích structure của project này để tôi hiểu tổng quan.

Dùng LS và Glob (KHÔNG đọc file content trừ package.json, README):
1. Tech stack: language, framework, DB, main deps từ package.json/requirements.txt
2. Directory structure: mỗi folder có ý nghĩa gì?
3. Số lượng file theo type (*.ts, *.test.ts, *.sql...)
4. Entry points: main file, server start, worker start
5. Config files: có gì đáng chú ý?
6. Kết luận: đây là monolith / microservice / monorepo?

Output dạng structured overview. Không đọc source files."
Token tip: Bước này chỉ tốn ~2000 token nhưng cho bạn đủ context để làm bước tiếp theo thông minh hơn.
🔌 Layer 2: Entry points và data flow — biết cách data di chuyển
Layer 2
Chỉ đọc entry points — không đọc toàn bộ codebase~5000 token
claude "Bây giờ đọc các entry points để hiểu data flow:

Đọc: src/index.ts (hoặc app.ts, main.ts, server.ts)
Đọc: src/routes/ (chỉ đọc file index, không đọc từng route file)
Grep: 'app.use\|router.get\|app.get\|app.post' để map endpoints
Grep: 'new.*Service\|import.*Service' để hiểu dependencies

Tôi muốn biết:
1. Request lifecycle: request vào → đi qua middleware nào → đến đâu?
2. Danh sách endpoints chính (method + path + handler)
3. Middleware stack (auth, logging, error handler...)
4. External services được connect (DB, Redis, external APIs)
5. Background jobs có không?

KHÔNG đọc service files. KHÔNG đọc repository files. Chỉ map flow."
🧩 Layer 3: Domain logic — hiểu business rules trong code
Layer 3
Đọc services — nơi chứa business logic thực sự~10000 token
claude "Đọc src/services/ (tất cả service files).
Extract:

1. BUSINESS RULES — mỗi rule format:
   Rule: [phát biểu rõ ràng, không kỹ thuật]
   Code: [file:function:line]
   Edge cases: [list]

2. STATE MACHINES — entities nào có status/state?
   Entity: Order → States: [DRAFT, CONFIRMED, PAID...]
   Transitions hợp lệ: [diagram dạng text]

3. CALCULATIONS — công thức tính toán quan trọng
   Ví dụ: discount, tax, shipping fee...

4. SIDE EFFECTS — action nào trigger side effect?
   Ví dụ: create order → gửi email → update inventory

5. DEPENDENCIES NGẦM — code đang assume gì?
   Ví dụ: assume user phải login, assume currency là VND

KHÔNG cần đọc repositories. Chỉ services."
⚠️ Layer 4: Tìm tech debt và rủi ro — trước khi bắt tay vào code
Risk analysis
claude "Sau khi đã hiểu codebase, phân tích rủi ro:

Grep và đọc nhanh để tìm:

🔴 CRITICAL (cần biết trước khi sửa bất cứ gì):
□ Circular dependencies
□ God objects (file > 300 dòng, class > 20 methods)
□ Global state mutations
□ Raw SQL queries (SQL injection risk)
□ setTimeout/setInterval không clear

🟡 HIGH (tech debt cần plan refactor):
□ TODO/FIXME/HACK comments — list tất cả
□ Functions > 50 dòng (quá phức tạp để sửa an toàn)
□ Missing error handling (try/catch trống, .catch bỏ qua)
□ Hardcoded values (URLs, magic numbers, credentials)

🟢 MEDIUM (note để improve):
□ Missing TypeScript types (any usage)
□ Missing input validation
□ No test coverage (functions không có test)

Format: file:line + mô tả ngắn + risk nếu sửa sai."
Biết tech debt trước khi sửa code = tránh được 80% incidents. Đây là thứ senior dev làm đầu tiên khi join project mới.
📝 Tổng hợp: sinh CLAUDE.md từ codebase hiện có
Output hữu hình
Sau 4 layer trên, bạn đã có đủ context. Giờ để Claude viết CLAUDE.md — sẽ tiết kiệm token cho mọi session sau.
claude "Dựa trên toàn bộ analysis vừa làm (4 layers),
viết CLAUDE.md đầy đủ cho project này.

Include:
1. Tech stack và version chính xác
2. Directory structure với mô tả từng folder
3. Coding conventions đang được dùng (kể cả inconsistent)
4. Business rules quan trọng nhất (top 10)
5. Gotchas và landmines (từ tech debt analysis)
6. Dev commands từ package.json
7. Environment variables cần thiết (không ghi giá trị)

Sau khi viết xong CLAUDE.md, commit:
git add CLAUDE.md
git commit -m 'docs: add CLAUDE.md for AI-assisted development'"
Case 03 — Daily dev
Implement feature mới — từ spec đến production-ready
Cách tiếp cận đúng: Claude lên plan → bạn confirm → Claude implement từng layer → test tự động. Không phải "Claude viết code, bạn paste vào".
Daily workflow Planning first TDD-compatible
🗺️ Phase 1: Planning — bắt buộc với mọi feature không trivial
Không được skip
Prompt planning — Claude phân tích rồi chờ confirm~3000 token
claude "Feature cần implement: User có thể export lịch sử đơn hàng ra file Excel.

TRƯỚC KHI viết bất kỳ dòng code nào, hãy làm analysis:

1. SCOPE — đọc codebase tìm:
   - Code liên quan đến Order đã có: files, functions
   - Patterns đang dùng để implement feature tương tự
   - Thư viện nào đang dùng (xlsx, exceljs, csv-writer...?)

2. DESIGN — đề xuất:
   - API endpoint: method, path, params, response type
   - Approach: sync response vs async + download link?
   - Nếu async: cần queue? file storage (S3)?
   - Ảnh hưởng đến DB schema không?

3. FILES — list chính xác:
   - Files cần tạo mới (với path)
   - Files cần sửa (với lý do)
   - Dependencies cần thêm

4. RISKS:
   - Performance: user có 10000 orders → handle như thế nào?
   - Security: user chỉ xem được orders của họ?
   - Edge cases: không có order nào? Order bị deleted?

5. EFFORT: S/M/L/XL và giải thích

Present plan. KHÔNG code. Chờ tôi confirm."
Bước này tốn ~3000 token nhưng giúp tránh implement sai hướng, tiết kiệm 50–100K token về sau.
⚙️ Phase 2: Implementation — layer by layer, test sau mỗi layer
Core
Layer 1: Domain và Repository
claude "Plan đã confirm. Implement Layer 1: Domain + Repository.

Layer 1 gồm:
- src/domain/export.ts — ExportRequest, ExportResult interfaces
- src/repositories/order-export.repo.ts — query orders cho export
  Interface: getOrdersForExport(userId, filters) → Promise<Result<OrderRow[], AppError>>
  Phải handle: pagination nếu > 1000 orders, chỉ lấy fields cần thiết

Sau khi implement:
- Viết unit test cho repository (mock Prisma)
- npm run typecheck — phải clean
- npm test -- --testPathPattern=order-export.repo
Báo cáo khi Layer 1 pass."
Layer 2: Service (business logic)
claude "Layer 1 pass. Implement Layer 2: ExportService.

src/services/export.service.ts
Interface:
  generateOrderExcel(userId, filters): Promise<Result<Buffer, AppError>>

Logic:
1. Gọi orderExportRepo.getOrdersForExport()
2. Transform data: format date, format money (VNĐ → '1,500,000 ₫')
3. Generate Excel với exceljs:
   - Sheet 'Lịch sử đơn hàng'
   - Header row: STT | Mã đơn | Ngày đặt | Sản phẩm | Tổng tiền | Trạng thái
   - Freeze header row
   - Auto-width columns
   - Stripe rows (alternate background)
4. Return Buffer

Sau khi implement:
- Unit test: mock repo, test với 0 orders, 1 order, 1000 orders
- Test formatting: money, date format đúng không?
- npm test -- --testPathPattern=export.service"
Layer 3: Controller + Route
claude "Layer 2 pass. Implement Layer 3: Controller + Route.

src/routes/export.route.ts — Fastify route
  GET /api/orders/export
  Auth: requireAuth middleware (đã có)
  Query params (Zod schema):
    - from?: ISO date string
    - to?: ISO date string
    - status?: OrderStatus enum
  Response:
    - Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    - Content-Disposition: attachment; filename='orders-{date}.xlsx'
    - Body: Excel buffer

Error handling:
  - 401: không có auth
  - 400: params không hợp lệ (Zod error → format đẹp)
  - 500: lỗi generate → log đầy đủ, response generic

Register route trong src/routes/index.ts

Integration test:
  - GET /api/orders/export — authenticated → 200 + Excel file
  - GET /api/orders/export — unauthenticated → 401
  - GET /api/orders/export?from=invalid → 400"
Phase 3: Quality gate cuối
claude "Tất cả layers pass. Chạy quality gate:

1. npm run typecheck — must be 0 errors
2. npm run lint — must be 0 warnings
3. npm test — all tests pass
4. npm run test:int — integration tests pass

Sau đó review lại với checklist:
□ User chỉ export được orders của chính họ (không lộ data user khác)?
□ File name có timestamp để tránh cache?
□ Excel có format đúng khi mở trên Mac, Windows, Google Sheets?
□ Memory: stream thay vì load hết vào memory nếu > 10K orders?
□ JSDoc cho public service method?
□ CHANGELOG.md cập nhật chưa?

Fix mọi issue. Báo cáo final status."
🏃 Feature nhỏ/trivial — dùng /feature command, không cần phase
Quick path
Với feature nhỏ (thêm field vào response, thêm endpoint CRUD đơn giản, thêm validation), không cần plan phase. Dùng command trực tiếp.
# Feature nhỏ: thêm field vào response
claude "Thêm field 'itemCount' vào response của GET /api/orders/:id.
itemCount = tổng số sản phẩm trong đơn (sum của quantity các items).
Cập nhật: repository query, domain type, controller response.
Thêm test case cho field mới. Chạy test."

# Feature nhỏ: thêm validation
claude "Trong POST /api/orders, thêm validation:
- items array không được rỗng
- mỗi item.quantity phải là integer dương
- mỗi item.productId phải tồn tại trong DB (check trước khi create)
Dùng Zod cho structural validation, service method cho DB check.
Thêm test cases cho từng validation fail case."
Case 04 — Debug
Fix bug & debug — triage đúng, fix đúng gốc
Bug fixing với Claude không phải "paste lỗi và chờ". Là cung cấp đủ context để Claude hiểu đúng vấn đề — rồi fix đúng gốc, không phải patch bề mặt.
Root cause Context is king Regression test
🐛 Bug report có đủ context — template chuẩn
Làm đúng
❌ Prompt thiếu context
"Bị lỗi TypeError: Cannot read property 'id' of undefined. Fix giúp tôi."

→ Claude phải đọc toàn bộ codebase để đoán. Tốn 20K+ token.
✅ Prompt đủ context
Có error message + stack trace + file:line + expected vs actual + khi nào xảy ra → Claude đọc đúng 2-3 file. Tốn 3K token.
claude "BUG: Order total tính sai khi có coupon + tax

ERROR (từ Sentry):
  TypeError: Cannot read properties of undefined (reading 'discountAmount')
  at OrderService.calculateTotal (src/services/order.ts:127)
  at OrderService.applyPromotion (src/services/order.ts:89)

CONTEXT:
  - Xảy ra khi: user apply coupon FIXED_AMOUNT (giảm số tiền cố định)
  - KHÔNG xảy ra với: coupon PERCENTAGE (giảm %)
  - Môi trường: production, xảy ra 3 lần hôm nay lúc 14:23, 15:01, 15:47
  - Last deploy: hôm qua 16:00 (commit abc123)

EXPECTED: total = subtotal - discountAmount + tax
ACTUAL: crash tại line 127

FILES LIÊN QUAN (tôi đoán):
  - src/services/order.ts (chính)
  - src/domain/promotion.ts (Promotion type)
  - src/repositories/promotion.repo.ts

YÊU CẦU:
1. Đọc 3 files trên
2. Tìm root cause chính xác
3. Check: commit hôm qua có thay đổi gì ở đây? (git log -p -1 -- src/services/order.ts)
4. Fix root cause (không phải patch)
5. Viết regression test: case này không được crash nữa
6. Check: có case tương tự nào khác với FIXED_AMOUNT coupon không?"
Sau khi Claude fix — verify đúng cách
claude "Fix đã apply. Verify:
1. Chạy: npm test -- --testPathPattern=order
2. Chạy: npm test -- --testPathPattern=promotion
3. Reproduce lại bug: tạo order + apply FIXED_AMOUNT coupon → có crash không?
4. Check related cases:
   - FIXED_AMOUNT coupon khi order total < discount amount?
   - FIXED_AMOUNT coupon = 0?
   - FIXED_AMOUNT coupon khi giỏ hàng rỗng?
5. Nếu tất cả pass: git commit với message chuẩn
   Format: fix(order): coupon discountAmount undefined when type is FIXED_AMOUNT"
🔥 Production incident — triage nhanh trong 10 phút
P0 emergency
claude "PRODUCTION INCIDENT — cần triage nhanh.

SYMPTOM: API /api/checkout đang trả về 500 từ 14:35.
Error rate: 100% (tất cả requests fail).
Logs Sentry: [paste logs]
Last deploy: 14:20 (commit def456 — 'feat: add payment retry logic')

IMMEDIATE TRIAGE (làm ngay, không implement):
1. git log -p def456 -- src/ (xem chính xác thay đổi gì)
2. Đọc src/services/payment.ts chỉ phần liên quan đến retry
3. Tìm lỗi có khả năng cao nhất gây 500

PARALLEL: trong khi triage, chuẩn bị:
A. Hotfix nếu lỗi nhỏ (fix inline, không refactor)
B. Rollback command nếu lỗi phức tạp

Output trong 5 phút:
- Root cause: [1 câu]
- Fix: [code snippet] HOẶC Rollback: [command]
- ETA để fix

Ưu tiên speed, không cần hoàn hảo."
Rule P0: Hotfix TRƯỚC, refactor SAU. Nếu không chắc chắn fix đúng trong 10 phút → rollback. Hỏi Claude để quyết định cái nào đúng.
🕵️ Bug khó reproduce — dùng Claude để điều tra
Intermittent bug
claude "Bug intermittent: đôi khi tạo order bị duplicate — 2 orders giống hệt nhau.
Xảy ra khoảng 1/500 requests. Không reproduce được locally.

Dữ liệu từ DB (2 duplicate orders):
  order_1: id=abc, created_at=2024-01-15 10:23:45.123, user_id=123
  order_2: id=def, created_at=2024-01-15 10:23:45.234, user_id=123
  Chênh nhau 111ms.

Điều tra:
1. Đọc src/services/order.ts: createOrder function
2. Đọc src/routes/order.route.ts: POST /api/orders handler
3. Tìm: có idempotency key không? Có transaction không?
4. Tìm: client có thể retry request không? (check middleware, timeout)
5. Tìm: race condition — nếu 2 requests cùng lúc, DB constraint bắt được không?

Hypothesis: [Claude nêu 2-3 possible causes theo probability]
Fix recommended: [implement idempotency + DB unique constraint]"
🧪 Debug bằng test — viết failing test trước khi fix
Best practice
Cách tiếp cận TDD cho bug fixing: viết test reproduce bug → confirm test fail → fix → confirm test pass. Đây là cách duy nhất đảm bảo bug không tái phát.
claude "Bug: getDiscountedPrice() trả về giá sai khi quantity > 100.

Bước 1: Đọc src/services/pricing.ts — hàm getDiscountedPrice
Bước 2: Viết failing test reproduce chính xác bug:
  describe('getDiscountedPrice')
  it('should apply bulk discount when quantity > 100')
  → test này phải FAIL với code hiện tại

Bước 3: Chạy test → confirm nó fail (đừng fix trước)
Bước 4: Tìm bug trong code
Bước 5: Fix
Bước 6: Chạy test → confirm nó pass
Bước 7: Chạy toàn bộ pricing tests → không có regression

Report: root cause + fix + test added."
Case 05 — Code quality
Refactor & clean code — an toàn, không break
Refactor sai cách là nguồn gốc của nhiều incidents nhất. Claude giúp refactor có hệ thống: phân tích trước, implement từng bước nhỏ, test sau mỗi bước.
Safe refactoring Strangler Fig No big bang
🔬 Analysis trước khi refactor — hiểu rủi ro
Bắt buộc
claude "Tôi muốn refactor src/services/user.service.ts (hiện 600 dòng).

Phân tích trước khi làm bất cứ gì:

1. CALLERS — ai đang dùng UserService?
   Grep: 'UserService\|userService\|new User' trong toàn src/
   List: tất cả methods đang được call từ bên ngoài

2. RESPONSIBILITIES — file này đang làm gì?
   Group các methods theo responsibility:
   - Authentication (login, logout, token)
   - Profile management (update, avatar)
   - Permissions (check, grant, revoke)
   - Notification (email, push)

3. DEPENDENCIES — file này depend vào gì?
   Và gì depend vào file này?

4. TEST COVERAGE hiện tại:
   Grep: test file tương ứng. Có bao nhiêu % được test?

5. RISK ASSESSMENT:
   - Methods nào quan trọng nhất (called nhiều nhất)?
   - Methods nào có side effects phức tạp?
   - Thứ tự refactor an toàn nhất là gì?

6. PROPOSED SPLIT: đề xuất tách thành bao nhiêu service?

KHÔNG code. Chỉ analysis. Chờ tôi confirm plan."
🪜 Strangler Fig pattern — refactor từng bước nhỏ
Safe method
Strangler Fig: không rewrite toàn bộ một lúc. Tạo class mới → delegate từ class cũ → test pass → dần loại bỏ class cũ. Mỗi bước nhỏ là deployable.
claude "Refactor UserService — tách AuthService ra trước (ít risk nhất).

Bước 1: Tạo AuthService rỗng
  src/services/auth.service.ts
  Export: class AuthService
  Inject: UserRepository, TokenRepository, Redis

Bước 2: Di chuyển methods (KHÔNG xóa khỏi UserService):
  login() → AuthService.login()
  logout() → AuthService.logout()
  refreshToken() → AuthService.refreshToken()
  validateToken() → AuthService.validateToken()

Bước 3: UserService delegate sang AuthService:
  class UserService {
    constructor(private auth: AuthService) {}
    login(...) { return this.auth.login(...); } // delegate
  }

Bước 4: Chạy tất cả tests → phải pass 100%
  Nếu fail → fix trước khi tiếp tục

Bước 5: Update callers (controllers) dùng AuthService trực tiếp
  Grep tất cả nơi gọi userService.login/logout/refresh
  Update import + injection

Bước 6: Xóa methods đã delegate khỏi UserService
  Chạy tests lại → phải pass

Báo cáo sau mỗi bước. Nếu tests fail ở bước nào → dừng lại."
Rule: Mỗi bước nhỏ = 1 commit. Nếu bước nào fail có thể rollback ngay. Không để 2 ngày code mới merge.
🔧 Refactor TypeScript — thêm types, strict mode
TypeScript
claude "Enable TypeScript strict mode cho project.
Hiện tại tsconfig.json: strict: false → đổi thành strict: true

Workflow:
1. Đổi strict: true trong tsconfig.json
2. Chạy: npm run typecheck 2>&1 | head -100 (xem 100 lỗi đầu)
3. Group lỗi theo type: 'possibly undefined', 'implicit any', 'null check'...
4. Fix theo nhóm, từ dễ đến khó:
   - Dễ: thêm ! hoặc optional chaining ?.
   - Trung: thêm null checks
   - Khó: redesign function signature

5. Sau mỗi 20 lỗi fix: npm run typecheck (track progress)
6. Chạy full tests sau khi 0 errors
7. Commit: 'chore(ts): enable strict mode'

KHÔNG dùng @ts-ignore hoặc as any để tắt lỗi.
Nếu type phức tạp: dùng unknown + type guard."
Case 06 — Quality
Code review — AI làm first pass, bạn làm deep review
Claude xử lý mechanical review (style, patterns, common bugs) để bạn tập trung vào architectural decisions và business logic correctness.
PR workflow Async-friendly CI integration
👁️ Review PR của người khác — comprehensive checklist
Reviewer
claude "Review PR này. Tác giả: @teammate. Task: DEV-234 — Add payment retry.

Context:
- Stack: Node.js + TypeScript + Prisma
- Đọc CLAUDE.md để hiểu conventions

Đọc:
git diff main...feature/payment-retry

Review theo checklist nghiêm túc:

🔴 BLOCKING (phải fix trước merge):
□ Logic errors — code có làm đúng spec không?
□ Security: input validation, auth check, data exposure
□ Data integrity: transaction đúng chỗ chưa? Race condition?
□ Error handling: tất cả error paths được handle?
□ Breaking changes: public interface thay đổi không?

🟡 SHOULD FIX (nên fix trong PR này):
□ Performance: N+1 query, missing index, unnecessary computation
□ Conventions vi phạm (so với CLAUDE.md)
□ Missing tests cho logic quan trọng
□ Code duplication (DRY violation)

🟢 SUGGESTIONS (nice to have, optional):
□ Readability improvements
□ Better variable names
□ Simplification opportunities

Format output:
---
BLOCKING:
- [file:line] [mô tả vấn đề] → [suggestion cụ thể]

SHOULD FIX:
- [...]

SUGGESTIONS:
- [...]

POSITIVE (điều đã làm tốt):
- [...]
---"
🪞 Self-review trước khi tạo PR — bắt lỗi chính mình
Best practice
claude "Tôi vừa implement feature DEV-456. Tự review trước khi tạo PR.

git diff main...HEAD -- src/

Review với góc nhìn senior engineer khó tính:

1. CORRECTNESS — logic có đúng spec không?
   Spec: [tóm tắt yêu cầu]

2. EDGE CASES — những gì có thể fail?
   - Input null/undefined/empty?
   - Concurrent requests?
   - DB down giữa chừng?
   - User không đủ permission?

3. SECURITY REVIEW:
   - Ai có thể gọi endpoint này?
   - Data của user A có thể lộ ra user B không?
   - Input được sanitize chưa?

4. PERFORMANCE:
   - DB queries có efficient không?
   - Có thể gây timeout với data lớn không?

5. CODE QUALITY:
   - Vi phạm CLAUDE.md conventions không?
   - Test coverage đủ chưa?
   - Error messages có meaningful không?

Liệt kê tất cả issues. Tôi sẽ fix trước khi tạo PR."
🤖 Auto-review trong CI — mọi PR đều được review
CI/CD
# .github/workflows/claude-review.yml
name: Claude Code Review
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  ai-review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }

      - run: npm install -g @anthropic-ai/claude-code

      - name: Run AI review
        env: { ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} }
        run: |
          git diff origin/${{ github.base_ref }}...HEAD > diff.txt
          REVIEW=$(claude --print --model claude-haiku-4-5 \
            "Review code diff trong diff.txt.
             Tìm: security issues, logic errors, missing error handling.
             Format JSON: {blocking: [], warnings: [], suggestions: []}
             Mỗi item: {file, line, severity, message, suggestion}")
          echo "$REVIEW" > review.json

      - name: Post review comment
        uses: actions/github-script@v7
        with:
          script: |
            const review = require('./review.json');
            const blocking = review.blocking || [];
            if (blocking.length > 0) {
              const body = '## 🤖 AI Review\n\n**Blocking issues:**\n' +
                blocking.map(i => `- \`${i.file}:${i.line}\` ${i.message}`).join('\n');
              github.rest.issues.createComment({...context.repo,
                issue_number: context.issue.number, body});
            }
Dùng Haiku thay Sonnet cho CI review → 20x rẻ hơn. Haiku đủ tốt cho mechanical review.
Case 07 — Advanced
Performance optimization — đo trước, optimize sau
Không tối ưu theo bản năng. Đo, tìm bottleneck thực sự, tối ưu đúng chỗ, đo lại. Claude giúp automation cả quy trình này.
Measure first DB optimization Caching strategy
🔍 Điều tra performance — tìm đúng bottleneck
Bước đầu tiên
claude "API GET /api/dashboard trả về sau 3–5 giây. Cần dưới 500ms.

Điều tra theo thứ tự từ dễ đến khó:

LAYER 1: DB queries (nguyên nhân #1 phổ biến)
  Đọc: controller → service → repository của /dashboard endpoint
  Tìm:
  a) N+1 query: có loop nào bên trong mà query DB không?
     Dấu hiệu: findMany rồi forEach với findById
  b) Missing eager loading: có relation nào không được include?
  c) Select *: có dùng select: undefined (lấy toàn bộ fields)?
  d) Missing WHERE index: check prisma/schema.prisma có @index chưa?
  e) Không có limit/pagination: có thể load 10K records không?

LAYER 2: Computation
  Tìm: logic nào chạy nhiều lần trong loop?
  Tìm: calculation nào có thể cache hoặc precompute?

LAYER 3: External calls
  Grep: fetch, axios, got, http.request trong code path này
  Có gọi external API không? Có await sequential không?

Output:
- Ranked list của probable causes (by likelihood)
- Query count estimate cho 1 request
- Recommendation: quick win vs proper fix"
Fix N+1 query — pattern phổ biến nhất
claude "Đã xác định N+1 query trong OrderService.getDashboard():

Hiện tại (N+1):
  const orders = await orderRepo.findAll();
  for (const order of orders) {
    order.items = await itemRepo.findByOrderId(order.id); // N queries!
    order.user = await userRepo.findById(order.userId);   // N queries!
  }

Fix với Prisma eager loading:
1. Update repository method để include relations
2. Đảm bảo chỉ select fields cần thiết (không select *)
3. Thêm pagination (limit 50 mặc định)
4. Viết benchmark: đo query count trước/sau

Sau khi fix:
  npm run dev
  Gọi API với curl, check logs: query count phải giảm từ N+1 xuống 1-2 queries."
🗄️ DB index optimization — tăng tốc 10–100x với đúng index
DB
claude "Analyze DB indexes cho project này.

Bước 1: Đọc prisma/schema.prisma — map tất cả models và indexes hiện có
Bước 2: Đọc src/repositories/ — tìm tất cả WHERE clauses đang dùng
Bước 3: Cross-reference:
  - Mỗi WHERE clause có index tương ứng không?
  - WHERE có nhiều fields → cần composite index không?
  - ORDER BY field có index không?

Bước 4: Tìm missing indexes:
  Pattern nguy hiểm:
  - WHERE userId = ? AND status = ? AND createdAt > ? → cần composite index
  - WHERE email = ? → cần unique index (cũng dùng cho lookup)
  - ORDER BY createdAt DESC → cần index
  - LIKE '%keyword%' → full-text search, không index thường

Bước 5: Generate Prisma migration:
  Với mỗi missing index → thêm vào schema và tạo migration

KHÔNG tạo index cho tất cả fields — index có cost khi write."
Caching strategy — Redis cho hot data
Caching
claude "Implement caching strategy cho dashboard API.

Phân tích trước khi implement:
1. Đọc dashboard service — data nào thay đổi ít?
   - Config, categories → cache lâu (1h)
   - Order counts → cache ngắn (5 phút)
   - User-specific data → cache theo userId
   - Real-time data (live orders) → KHÔNG cache

2. Cache strategy phù hợp:
   - Cache-aside pattern: check cache → miss → query DB → set cache
   - Write-through: update DB → invalidate cache
   - Với BullMQ: warm cache asynchronously

3. Implement CacheService (src/lib/cache.ts):
   - Wrapper của Redis
   - Generic: get<T>, set<T>, del, delPattern
   - TTL mặc định theo tier (hot/warm/cold)
   - Key format: '{entity}:{id}:{version}' để easy invalidation

4. Apply vào dashboard repository:
   - Check cache trước khi query DB
   - Set cache sau query
   - Invalidate khi data thay đổi (order created/updated)

5. Test: đảm bảo stale data không được return sau update"
Case 08 — Advanced
Security audit — tìm lỗ hổng trước hacker
Security không phải checklist chạy 1 lần. Là mindset áp dụng vào mọi feature. Claude giúp systematic audit và integrate security check vào workflow hàng ngày.
Critical OWASP Top 10 Preventive
🔒 Full security audit — OWASP Top 10 cho Node.js
Run monthly
claude "Full security audit cho project. Tìm và fix theo priority.

🔴 CRITICAL — fix ngay lập tức:

A1 — Injection:
  Grep: raw SQL (template literals với user input), $queryRaw, eval(), exec()
  Grep: Prisma queries với user input trực tiếp (không parameterized)

A2 — Broken Authentication:
  Kiểm tra: JWT secret từ env? JWT verify đúng algorithm? Token expiry?
  Kiểm tra: refresh token rotation? Token blacklist khi logout?
  Kiểm tra: brute force protection trên login endpoint?

A3 — Sensitive Data Exposure:
  Grep: console.log, logger.info với password, token, card, ssn, secret
  Kiểm tra: response có trả về password hash không?
  Kiểm tra: error response có leak stack trace không?

A4 — Broken Access Control:
  Kiểm tra từng GET/POST/PUT/DELETE endpoint:
    - Có auth middleware không?
    - User chỉ xem được resource của mình không?
    - Admin endpoints có check role không?
  Tìm IDOR: GET /api/orders/:id — có check order.userId === req.user.id?

A5 — Security Misconfiguration:
  Kiểm tra: CORS config có allow * không?
  Kiểm tra: Helmet.js được dùng không?
  Kiểm tra: rate limiting trên auth endpoints?
  Kiểm tra: .env có bị commit vào git không? (git log --all -- .env)

A7 — Cross-Site Scripting (nếu có render HTML):
  Grep: innerHTML, dangerouslySetInnerHTML, res.send với user input

A8 — Insecure Deserialization:
  Grep: JSON.parse với user input không validate
  Grep: eval, Function constructor

A9 — Vulnerable Components:
  Chạy: npm audit --audit-level=high
  List: packages có CVE HIGH hoặc CRITICAL

Output: file, line, severity, description, fix.
Fix tất cả CRITICAL và HIGH trước khi tạo report."
🛡️ Security review cho từng feature mới — baked in
Preventive
Không đợi audit — review security sau mỗi feature implement. Thêm vào custom command /feature:
# Thêm security checklist vào cuối mọi feature command
**Security checklist (bắt buộc):**
□ Endpoint có auth middleware không?
□ Nếu resource thuộc về user: có check ownership không?
□ Input được validate bằng Zod trước khi xử lý không?
□ DB query có dùng parameterized không (không string concat)?
□ Response có leak data của user khác không?
□ Error response generic (không leak stack trace)?
□ Rate limiting cần thiết không (auth, payment, file upload)?
□ File upload: validate type, size, scan malware?
□ Money calculation: dùng integer, không float?

Nếu có issue → fix trước khi báo cáo xong feature.
Case 09 — Quality
Test coverage — viết test có giá trị thực sự
100% coverage không có nghĩa là 0 bugs. Test có giá trị = test bắt được regression, test theo behavior, test edge cases thực sự có thể xảy ra.
Behavior testing Not coverage theater Mutation testing
🧪 Viết test chất lượng cao — không phải coverage theater
Core
claude "Viết comprehensive tests cho src/services/pricing.service.ts

Đọc file trước. Sau đó viết tests theo principles:

PRINCIPLES (enforce nghiêm):
1. Test BEHAVIOR, không test implementation
   ✅ 'should return 10% discount when order > 1,000,000 VND'
   ❌ 'should call calculateTierDiscount with argument 1000000'

2. Mỗi test: 1 assertion CHÍNH (có thể có assertion phụ)
   Không viết test kiểm tra 5 thứ cùng lúc

3. Test name đủ rõ để làm documentation:
   describe('PricingService')
     describe('calculateDiscount')
       it('should return 0 when order total is below minimum threshold')
       it('should apply 10% when total is between 1M and 5M')
       it('should apply 15% + free shipping when total exceeds 5M')
       it('should stack VIP bonus on top of tier discount')
       it('should not exceed 100% total discount')
       it('should return error when discount config is missing')

4. Edge cases THỰC SỰ CÓ THỂ XẢY RA:
   - Input = 0, negative, very large number
   - Floating point: 999999.99 vs 1000000.00
   - VIP user với no tier discount
   - Multiple coupons stacked

5. Mock chỉ external dependencies:
   - DB → mock repository
   - Redis → mock cache
   - External API → mock
   KHÔNG mock: pure functions, calculations, domain logic

6. Test isolation: mỗi test hoàn toàn độc lập, không depend vào test khác

Sau khi viết: chạy npm test -- --testPathPattern=pricing
Coverage target: 95%+ cho pricing service (core business logic)"
🧬 Mutation testing mindset — test có bắt được bug không?
Advanced
claude "Áp dụng mutation testing mindset cho src/services/discount.ts.

Đọc: service file + test file tương ứng.

Simulation:
Với mỗi điều kiện quan trọng trong service:
  if (total > 1000000)  → thử đổi thành > 999999 hoặc >= 1000000
  if (status === 'VIP') → thử đổi thành !== 'VIP'
  discount * 0.15       → thử đổi thành * 0.10 hoặc * 0.20
  total - discount      → thử đổi thành total + discount

Question: với mỗi mutation đó, test hiện tại có FAIL không?
  - Nếu test fail khi mutate → test TỐT (bắt được bug)
  - Nếu test vẫn pass khi mutate → 'surviving mutant' → test YẾU

List tất cả surviving mutants.
Viết test cases để kill từng surviving mutant.

Kết quả tốt: không có surviving mutant nào trong business-critical code."
🏗️ Test data factory — hết cảnh hardcode data trong test
Infrastructure
claude "Build test data factory cho toàn project.

Đọc prisma/schema.prisma — hiểu tất cả models và relations.

Tạo tests/factories/index.ts:

Pattern cho mỗi model:
  interface UserOverrides { name?: string; email?: string; role?: UserRole; }
  function createUser(overrides?: UserOverrides): User {
    return {
      id: faker.string.uuid(),
      name: faker.person.fullName(),
      email: faker.internet.email(),
      role: 'CUSTOMER',
      createdAt: new Date(),
      deletedAt: null,
      ...overrides  // cho phép override bất kỳ field nào
    };
  }

Pre-built scenarios (test code phức tạp):
  function adminUser() { return createUser({ role: 'ADMIN' }); }
  function deletedUser() { return createUser({ deletedAt: new Date() }); }
  function orderWithItems(itemCount = 3) { ... }
  function paidOrder() { return createOrder({ status: 'PAID', paidAt: new Date() }); }
  function orderWithCoupon(couponType: 'FIXED' | 'PERCENT') { ... }

Rules:
- Mỗi factory phải tạo được valid object KHÔNG cần override
- Overrides là typed — IDE gợi ý được
- Không call DB trong factory — chỉ tạo object
- Cleanup riêng trong integration tests

Output: tests/factories/ với TypeScript đầy đủ types."
Case 10 — Optimization
Token mastery — tối ưu chi phí không giảm chất lượng
Hiểu token như hiểu memory trong programming. Không phải tiết kiệm bằng mọi giá — mà chi đúng chỗ, tránh lãng phí ở những chỗ không cần thiết.
Cost-efficient Smart routing Team ROI
Chi phí theo hành động thực tế
LS một thư mục
~200 tok
Grep một pattern toàn project
~400 tok
Đọc file 100 dòng
~600 tok
Chạy bash command + output
~400 tok
Đọc file 500 dòng
~2500 tok
Implement function trung bình
~3000 tok
Debug session 30 phút
~20K tok
Implement full feature (service+test)
~80K tok
Onboard legacy project (4 layers)
~30K tok
🎯 Model routing — dùng đúng model cho đúng task
20x savings
claude-haiku-4-5
$0.8/M
Format code, rename, thêm comment, lint fix, simple grep, tóm tắt ngắn
claude-sonnet-4-5
$3/M
Implement feature, debug, refactor, code review, security audit
claude-opus-4
$15/M
Architecture decisions, complex algorithm, ambiguous requirements cần reasoning sâu
# Haiku: task mechanical, không cần reasoning
claude --model claude-haiku-4-5 "format code theo prettier config"
claude --model claude-haiku-4-5 "thêm JSDoc cho tất cả public methods trong src/services/"
claude --model claude-haiku-4-5 "rename variable 'x' thành 'orderTotal' trong file này"
claude --model claude-haiku-4-5 "chạy npm audit và list HIGH/CRITICAL vulnerabilities"

# Sonnet: daily dev work
claude "implement feature X"
claude "debug lỗi Y"

# Opus: chỉ khi thực sự cần
claude --model claude-opus-4 \
  "design database schema cho multi-tenant SaaS với yêu cầu phức tạp..."
✂️ 15 kỹ thuật cắt giảm token — không giảm chất lượng
Catalog
  • CLAUDE.md đầy đủ: 30 phút đầu tư → tiết kiệm 2000–5000 token/session. Impact lớn nhất.
  • Scope rõ ràng: "đọc src/services/user.ts" thay vì để Claude tự grep toàn project.
  • Grep trước, đọc sau: grep để tìm file đúng, sau đó đọc đúng file. Không đọc ngẫu nhiên.
  • /clear sau mỗi task: context cũ = nhiễu = token tốn + quality giảm.
  • /compact khi context ~70%: giảm 60% token, giữ key information.
  • Haiku cho mechanical tasks: 20x rẻ hơn, đủ tốt cho 40% task hàng ngày.
  • Headless cho batch: claude --print "..." không có interactive overhead.
  • Dẫn file path, không paste content: Claude tự đọc → không double-count token.
  • Specify line range: "đọc src/service.ts dòng 100-150" thay vì cả file.
  • Batch cùng loại: review 5 files trong 1 prompt thay vì 5 prompts riêng.
  • Prompt cụ thể = ít iteration: mỗi "làm lại" = gấp đôi token spent.
  • Dùng TodoWrite: Claude track task list thay vì bạn nhắc lại trong prompt.
  • Tắt tools không cần: nếu chỉ cần analysis, không cần Write permission.
  • Pre-read với CLAUDE.md nested: Claude tự load context theo module.
  • Monitor /cost: check sau mỗi session phức tạp. Awareness là bước đầu tiên.
  • 📊 ROI thực tế — số liệu để thuyết phục manager
    Business case
    Viết unit test
    8x
    Thủ công 2h → Claude 15 phút. Với chất lượng cao hơn (edge cases không bỏ sót).
    Onboard codebase mới
    10x
    Đọc code 2 ngày → 4-layer analysis 2-3 giờ. Hiểu sâu hơn vì có systematic approach.
    Debug production bug
    4x
    Trung bình 3h → 45 phút. Đặc biệt với bugs liên quan nhiều files.
    Code review PR
    3x
    45 phút manual → AI first pass 5 phút + human deep review 15 phút. Chất lượng tốt hơn.
    Security audit
    5x
    Manual audit 1 ngày → Claude comprehensive scan 30 phút. Tìm được nhiều hơn.
    Chi phí Claude/dev/ngày
    $3–7
    Với thực chiến thực sự (feature + debug + review). Tiết kiệm 2–3 giờ/ngày = $30–60 value.
    Cách đo cho team: 2 sprint đầu track thời gian mỗi task type. So sánh với 2 sprint không dùng Claude. Số liệu thực tế thuyết phục hơn bất kỳ claim nào.
    🚫 Giới hạn — biết khi nào KHÔNG dùng Claude
    Biết để dùng đúng
  • Secrets và credentials: không dùng Claude với production secrets, API keys thật. Dùng placeholder trong prompt.
  • Code security-critical chưa verify: crypto implementation, auth flow, payment — Claude draft, senior engineer verify thủ công.
  • Business decisions: "feature này có nên build không?" → con người quyết định.
  • Architectural decisions lớn: "chuyển sang microservices không?" → Claude cho options và trade-offs, không phải quyết định.
  • Legacy code cực phức tạp: Claude có thể suggest fix nhưng không biết lịch sử business decisions. Verify với người đã viết code.
  • Hallucination vẫn xảy ra: API không tồn tại, function call sai signature, logic trông đúng nhưng sai. Luôn chạy test. Không deploy code chưa verify.
  • Mental model đúng: Claude là junior dev cực giỏi kỹ thuật, đọc nhiều code hơn bất kỳ ai. Nhưng không biết business context của bạn, không chịu trách nhiệm production. Bạn là Tech Lead. Claude là best engineer trong team.
    Tester · Case T1 — Đặc thù VAIX
    Đọc hiểu spec tiếng Nhật — không bỏ sót requirement
    Client Nhật viết spec cực kỳ chi tiết, dùng nhiều thuật ngữ đặc thù (仕様書, 基本設計, 詳細設計). Tester đọc sai spec → test sai → demo fail trước client. Claude giúp dịch, phân tích, và extract test-relevant info chính xác.
    🇯🇵 Đặc thù NhậtSpec analysisTránh bỏ sót
    📄 Dịch và phân tích 仕様書 (shiyousho) — tài liệu đặc tả
    Hay dùng nhất
    Client Nhật hay dùng 3 loại tài liệu: 基本設計書 (basic design — big picture), 詳細設計書 (detail design — implementation spec), 画面設計書 (screen design — UI spec). Tester cần biết extract gì từ mỗi loại.
    claude "Tôi có tài liệu 詳細設計書 (detail design spec) từ client Nhật.
    [upload file hoặc paste nội dung tiếng Nhật]
    
    Phân tích tài liệu này với vai trò TESTER, không phải developer:
    
    1. FEATURE LIST — liệt kê tất cả tính năng được mô tả:
       Format: [Tên feature tiếng Nhật] — [Mô tả tiếng Việt ngắn gọn]
    
    2. BUSINESS RULES — các quy tắc nghiệp vụ quan trọng:
       Đặc biệt chú ý: điều kiện (条件), ngoại lệ (例外), giới hạn (制限)
       Format: BR-001: [Phát biểu rõ ràng bằng tiếng Việt]
    
    3. INPUT/OUTPUT SPEC — mỗi màn hình/function:
       - Input fields: tên, kiểu dữ liệu, bắt buộc/không, validation rules
       - Expected output: format, điều kiện hiển thị
       - Error messages: khi nào xuất hiện, nội dung
    
    4. EDGE CASES ẨN — những gì spec KHÔNG nói rõ nhưng tester phải test:
       Ví dụ: 'nhập số âm', 'để trống', 'ký tự đặc biệt', 'quá giới hạn'
    
    5. AMBIGUITIES (不明点) — chỗ nào mơ hồ cần hỏi lại client:
       Format: [Câu hỏi tiếng Nhật] — [Lý do cần làm rõ]
    
    6. PRIORITY — feature nào critical cho demo đầu tiên?
    
    Output bằng tiếng Việt. Giữ nguyên thuật ngữ Nhật quan trọng kèm giải thích."
    Xử lý 画面設計書 — spec màn hình UI
    claude "Đây là 画面設計書 (screen design spec) cho màn hình [tên màn hình].
    [upload ảnh/PDF tài liệu]
    
    Extract thông tin cho tester:
    
    1. SCREEN ELEMENTS — mỗi element trên màn hình:
       | ID | Tên (JP) | Loại | Bắt buộc | Validation | Ghi chú |
    
    2. BUTTON ACTIONS — mỗi button/link làm gì:
       [Button名] → [Action] → [Kết quả hiển thị] → [Error nếu fail]
    
    3. DISPLAY CONDITIONS — element nào hiển thị theo điều kiện:
       Ví dụ: 'Nút DELETE chỉ hiển thị khi user là admin'
    
    4. NAVIGATION FLOW — từ màn hình này đi đến đâu:
       Điều kiện nào → navigate đến màn hình nào
    
    5. TEST-CRITICAL NOTES:
       - Trường nào client Nhật hay kiểm tra kỹ nhất?
       - Formatting rules (ngày tháng, tiền tệ, số điện thoại Nhật)
       - Ký tự đặc biệt: 全角/半角 (zenkaku/hankaku) rules"
    🔍 Tìm mâu thuẫn giữa các tài liệu — trước khi test
    Hay xảy ra
    Client Nhật thường có nhiều tài liệu từ nhiều đợt, đôi khi mâu thuẫn nhau. Tester phát hiện sớm = tránh được việc test sai rồi phải làm lại.
    claude "Tôi có 3 tài liệu liên quan đến cùng feature [tên]:
    - Doc A: 基本設計書 v1.2 [upload]
    - Doc B: 詳細設計書 v2.0 [upload]
    - Doc C: Meeting minutes từ ngày XX/XX [upload hoặc paste]
    
    So sánh và tìm:
    
    1. CONTRADICTIONS (矛盾) — nội dung mâu thuẫn trực tiếp:
       Format:
       ⚠️ Mâu thuẫn: [Chủ đề]
       Doc A (v1.2): [Nội dung]
       Doc B (v2.0): [Nội dung khác]
       → Cần confirm: [câu hỏi tiếng Nhật để hỏi client]
    
    2. GAPS (抜け漏れ) — thông tin có trong doc này nhưng không có trong doc kia:
       Tester cần biết áp dụng rule nào khi gap tồn tại
    
    3. EVOLUTION — doc nào mới hơn, rule nào được update?
       Recommend: doc nào nên dùng làm source of truth?
    
    4. UNCLEAR ITEMS — cần clarify trước khi viết test case
       Tạo sẵn câu hỏi tiếng Nhật (QA票 format) để gửi client"
    🇯🇵 Decode implicit requirements — văn hóa giao tiếp Nhật
    Culture-specific
    Client Nhật thường không nói thẳng "cái này sai" — họ dùng cách diễn đạt gián tiếp. Tester cần biết đọc tín hiệu này.
    Họ nói
    「少し気になるんですが...」
    "Tôi hơi lo ngại một chút..."

    「ご確認いただけますか」
    "Bạn có thể kiểm tra lại không?"

    「イメージと少し違いまして」
    "Hơi khác với hình dung của tôi..."

    「改善の余地があるかと」
    "Có lẽ còn chỗ có thể cải thiện..."
    Họ thực sự muốn nói
    → Đây là bug, cần fix


    → Tôi thấy có vấn đề


    → Không đúng yêu cầu


    → Phần này cần làm lại
    claude "Trong email/meeting notes từ client Nhật (dưới đây),
    phân tích các feedback và decode implicit meaning:
    
    [paste nội dung email tiếng Nhật]
    
    1. Với mỗi câu/đoạn có feedback:
       - Nội dung gốc (tiếng Nhật)
       - Dịch trực tiếp
       - Ý nghĩa thực sự (theo văn hóa giao tiếp Nhật)
       - Action cần làm: [Bug fix / Clarify / No action]
       - Priority: [Critical / High / Normal]
    
    2. Những gì client KHÔNG nói nhưng likely có vấn đề:
       (Dựa trên pattern giao tiếp Nhật)
    
    3. Draft trả lời email bằng tiếng Nhật:
       - Acknowledge feedback lịch sự
       - Confirm đã hiểu vấn đề
       - Cam kết timeline xử lý"
    Tester · Case T2
    Thiết kế test case — coverage cao, không bỏ sót
    Client Nhật yêu cầu test case phải cực kỳ chi tiết, có traceability đến requirement, format chuẩn. Họ thường review test case trước khi cho phép bắt đầu test chính thức.
    SystematicTraceability🇯🇵 Formal review
    📋 Sinh test case từ spec — format chuẩn cho client Nhật
    Core workflow
    claude "Sinh test case cho feature: [Tên feature] từ spec đã phân tích.
    
    Spec tham chiếu:
    - Requirement ID: REQ-045
    - Mô tả: User có thể tìm kiếm đơn hàng theo nhiều tiêu chí
    - Business rules: [liệt kê từ analysis trước]
    
    Sinh test case theo format Excel-ready (TSV):
    
    Columns:
    No | テストID | テスト項目 | テスト条件 | 操作手順 | 期待結果 | 優先度 | 対応要件ID | 備考
    
    Rules khi sinh:
    1. Mỗi test case = 1 điều kiện duy nhất
    2. Phủ đủ: positive cases + negative cases + boundary + edge cases
    3. 操作手順 phải đủ chi tiết để người khác thực hiện được (không assume)
    4. 期待結果 phải specific, measurable — không viết 'hiển thị đúng'
    5. Priority: 高(cao) / 中(trung) / 低(thấp)
    6. Đặt tên theo convention: TC-[FEATURE_CODE]-[001, 002...]
    
    Categories phải có:
    □ Normal cases (正常系): happy path với dữ liệu hợp lệ
    □ Abnormal cases (異常系): input không hợp lệ, thiếu data
    □ Boundary cases (境界値): min/max, đúng giới hạn, vượt giới hạn
    □ Edge cases: empty state, special characters (tiếng Nhật, symbols)
    □ Permission cases: role khác nhau thấy gì
    □ Concurrent cases: 2 user cùng thao tác
    
    Output TSV — paste thẳng vào Excel được."
    Boundary value analysis tự động
    claude "Field: 'số lượng đặt hàng'
    Spec: integer, min=1, max=9999, bắt buộc
    
    Tự động sinh test cases theo Boundary Value Analysis + Equivalence Partitioning:
    
    Equivalence classes:
    - Valid: 1 ≤ x ≤ 9999
    - Invalid-low: x < 1 (0, âm số)
    - Invalid-high: x > 9999
    - Invalid-type: không phải số (chữ, ký tự đặc biệt, tiếng Nhật)
    - Invalid-empty: để trống
    
    Boundary values: 0, 1, 2, 9998, 9999, 10000
    Special: -1, 0.5, 9999.9, '1' (全角số), ' ' (space), null
    
    Với mỗi value → expected behavior + error message cụ thể.
    Format: TC-QTY-001 đến TC-QTY-XXX, sẵn sàng cho Excel."
    Test case cho logic phức tạp — Decision Table
    claude "Feature: tính phí vận chuyển
    Rules từ spec:
    - Đơn < 500k VND + trong tỉnh → phí 30k
    - Đơn < 500k VND + liên tỉnh → phí 50k
    - Đơn >= 500k VND + trong tỉnh → miễn phí
    - Đơn >= 500k VND + liên tỉnh → phí 20k
    - Thành viên VIP: giảm 50% phí vận chuyển
    - Đơn hàng đặc biệt (kích thước lớn): phí x2
    
    Tạo Decision Table coverage:
    1. List tất cả conditions (điều kiện)
    2. List tất cả actions (kết quả)
    3. Generate minimum test cases để cover all combinations
    4. Highlight: combination nào dễ bug nhất?
    5. Tạo test case cho từng row của decision table"
    🗺️ Test coverage matrix — chứng minh đã test đủ
    🇯🇵 Client yêu cầu
    Client Nhật thường yêu cầu テスト網羅表 (test coverage matrix) — chứng minh mỗi requirement đều có test case tương ứng. Thiếu cái này → họ không accept release.
    claude "Tạo テスト網羅表 (test coverage matrix) cho sprint này.
    
    Requirements list: [paste từ spec hoặc Jira]
    Test cases đã có: [paste danh sách TC IDs]
    
    Tạo bảng traceability:
    
    | 要件ID | 要件内容 | テストケースID | カバレッジ | 備考 |
    | REQ-001 | ユーザーログイン | TC-AUTH-001, TC-AUTH-002, TC-AUTH-003 | ✅ | |
    | REQ-002 | パスワード変更 | TC-PWD-001 | ⚠️ 境界値未カバー | |
    
    Legend:
    ✅ Fully covered (正常系+異常系+境界値)
    ⚠️ Partially covered (thiếu loại nào đó)
    ❌ Not covered
    
    Summary:
    - Tổng requirements: X
    - Fully covered: Y (Z%)
    - Partially covered: A → list test cases còn thiếu
    - Not covered: B → lý do (out of scope / blocked / will test later)
    
    Xuất format phù hợp paste vào Excel gửi client."
    Tester · Case T3 — Đặc thù VAIX
    Viết bug report chuẩn Nhật — không bị reject
    Bug report viết thiếu thông tin → client Nhật reject ngay ("再現しません" — không reproduce được). Hoặc tệ hơn: họ im lặng và không tin tưởng team. Format Nhật cực kỳ formal, phải đủ 5W1H.
    🇯🇵 Format NhậtProfessionalTránh reject
    🐞 Sinh bug report tiếng Nhật — chuẩn format Redmine/Jira Nhật
    Dùng hàng ngày
    claude "Viết bug report chuẩn format Nhật từ thông tin sau:
    
    Bug tôi phát hiện:
    - Màn hình: [tên màn hình / URL]
    - Thao tác: [mô tả ngắn tôi đã làm gì]
    - Kết quả thực tế: [cái gì xảy ra]
    - Kết quả mong đợi: [cái gì phải xảy ra]
    - Screenshot: [tôi sẽ đính kèm]
    - Môi trường: staging / browser Chrome 120 / OS Windows 11
    
    Viết bug report TIẾNG NHẬT với format:
    
    【バグ報告】
    
    ■ タイトル: [Tóm tắt bug trong 1 dòng, rõ ràng, không mơ hồ]
    
    ■ 発生環境:
      - URL:
      - ブラウザ:
      - OS:
      - アカウント: [loại account, không ghi password]
      - 発生日時:
    
    ■ 再現手順: [Step by step, numbered, cực kỳ cụ thể]
      1.
      2.
      3.
    
    ■ 実際の結果: [Mô tả chính xác, khách quan, không subjective]
    
    ■ 期待される結果: [Theo spec nào? Reference REQ ID nếu có]
    
    ■ 再現率: [毎回 / 2回に1回 / まれに]
    
    ■ 優先度: [緊急 / 高 / 中 / 低]
    
    ■ 影響範囲: [Màn hình nào khác bị ảnh hưởng?]
    
    ■ 備考: [Thông tin thêm, hypothesis về nguyên nhân]
    
    Dùng kính ngữ phù hợp, tone professional."
    Khi client nói "再現しません" — bug không reproduce được
    claude "Client Nhật reply: '再現できませんでした。詳細な手順をご共有いただけますか?'
    (Không reproduce được. Bạn có thể chia sẻ thêm chi tiết không?)
    
    Bug gốc tôi báo: [mô tả]
    
    Viết email reply tiếng Nhật:
    1. Lịch sự acknowledge reply của họ
    2. Bổ sung thêm thông tin:
       - Exact steps với screenshots từng bước
       - Browser dev tools console log (nếu có)
       - Network request/response nếu liên quan API
       - Video recording URL (nếu có)
       - Exact data dùng để reproduce (anonymized)
       - Nghi ngờ: bug có thể chỉ xảy ra với điều kiện đặc biệt gì?
    3. Đề nghị: có thể schedule call/screen share để reproduce cùng?
    4. Cam kết follow up
    
    Tone: respectful, helpful, không defensive."
    ⚖️ Bug vs Spec — phân tích trước khi báo cáo
    Tránh tranh luận
    Tình huống hay xảy ra: dev nói "đúng spec", tester nói "không đúng yêu cầu", client hỏi "đây là bug hay spec thay đổi?". Claude giúp phân tích khách quan trước khi escalate.
    claude "Tôi phát hiện vấn đề này nhưng không chắc là Bug hay là Spec thay đổi:
    
    Hành vi hiện tại: [mô tả]
    Hành vi tôi expect: [mô tả]
    
    Tài liệu liên quan:
    - Spec cũ (v1.0): [paste đoạn liên quan]
    - Spec mới (v2.1): [paste đoạn liên quan]
    - Meeting notes ngày XX: [paste]
    
    Phân tích:
    1. Spec v1.0 nói gì về case này?
    2. Spec v2.1 có thay đổi gì không? Explicit hay implicit?
    3. Meeting notes có clarify không?
    4. Kết luận: BUG / SPEC CHANGE / AMBIGUOUS (cần hỏi client)?
    
    Nếu AMBIGUOUS:
    - Draft câu hỏi tiếng Nhật để hỏi client (QA票 format)
    - Include: reference đến spec version, describe discrepancy, ask for clarification
    - Tone không accusatory, không blame dev hay client"
    📊 Bug triage meeting — chuẩn bị agenda và summary
    🇯🇵 Weekly meeting
    claude "Chuẩn bị cho weekly bug triage meeting với client Nhật.
    
    Bug list hiện tại từ Redmine/Jira: [paste danh sách]
    
    Tạo:
    
    1. MEETING AGENDA (tiếng Nhật):
       日時: XX月XX日 XX:00-XX:00
       参加者: [list]
       議題:
       1. 先週のバグ対応状況報告 (5分)
       2. 新規バグの確認 (15分)
       3. 優先度の調整 (10分)
       4. その他 (5分)
    
    2. BUG STATUS SUMMARY TABLE:
       | No | バグID | タイトル | 優先度 | ステータス | 担当 | 対応予定日 | 備考 |
    
    3. KEY POINTS TO DISCUSS (2-3 items):
       - Bugs cần decision từ client
       - Bugs có risk delay release
       - Scope/spec questions cần clarify
    
    4. CLOSING STATUS sau meeting template:
       Cấu trúc sẵn để điền sau meeting, gửi minutes trong 24h."
    Tester · Case T4
    Regression testing & UAT support — chuẩn bị demo không fail
    Client Nhật cực kỳ nghiêm túc với UAT. Họ test theo script, note từng deviation dù nhỏ. Demo fail trước client = ảnh hưởng nghiêm trọng đến relationship. Chuẩn bị kỹ là ưu tiên số 1.
    🇯🇵 Demo-criticalRisk mitigationSmoke test
    🔁 Regression test plan sau mỗi release — không test thừa, không thiếu
    Smart regression
    claude "Release v2.3 sắp deploy. Xác định scope regression test.
    
    Changes trong v2.3 (từ git diff / release notes):
    [paste danh sách thay đổi]
    
    Codebase modules (từ CLAUDE.md hoặc tôi mô tả):
    - Module A: Order management
    - Module B: Payment
    - Module C: User management
    - Module D: Reporting
    
    Phân tích impact và sinh regression test plan:
    
    1. DIRECT IMPACT — modules bị thay đổi trực tiếp:
       → Test 100% test cases của module này
    
    2. INDIRECT IMPACT — modules phụ thuộc vào module bị đổi:
       (dùng dependency analysis)
       → Test critical paths của các module này
    
    3. NO IMPACT — modules không liên quan:
       → Smoke test chỉ, không full regression
    
    4. RISK-BASED PRIORITY:
       High: payment flow, login/auth, data mutation
       Medium: search, filter, display
       Low: UI cosmetics, non-critical features
    
    5. REGRESSION TEST SUITE:
       Estimated: X test cases
       Time estimate: Y giờ (với Z tester)
    
       Tạo sẵn checklist Excel với các TCs được recommend."
    🎯 UAT scenario preparation — script cho client Nhật tự test
    🇯🇵 UAT-critical
    Client Nhật thường muốn tự chạy UAT theo script của riêng họ — nhưng VAIX team phải chuẩn bị UAT document để họ có thể làm đúng cách.
    claude "Tạo UAT document (受入テスト仕様書) cho client Nhật.
    
    System: [tên hệ thống]
    Sprint/Version: v2.3
    Features in scope: [list]
    
    Format tài liệu TIẾNG NHẬT:
    
    # 受入テスト仕様書
    バージョン: 1.0
    作成日: YYYY/MM/DD
    対象システム: [tên]
    
    ## テスト環境
    URL: https://staging.xxx.com
    テストアカウント:
      管理者: [email protected] / [password sẽ cung cấp riêng]
      一般ユーザー: [email protected] / [password sẽ cung cấp riêng]
    
    ## テストシナリオ
    
    ### シナリオ1: [Feature Name]
    目的: [Mục đích test này là gì]
    前提条件: [Điều kiện cần có trước khi test]
    
    手順:
    | No | 操作 | 確認事項 | 期待結果 | 結果 (OK/NG) | 備考 |
    | 1  | ログイン画面を開く | URL正確に表示 | ログイン画面表示 | | |
    
    ### シナリオ2: ...
    
    ## 合否判定基準
    - すべてのシナリオがOKの場合: 合格
    - NGが1件以上の場合: 不合格 → 修正後再テスト
    
    Tạo 5-7 scenarios covering main user journeys.
    Include: normal flow + 2-3 error scenarios"
    🚨 Pre-demo checklist — 2 giờ trước khi demo với client
    Ngày demo
    claude "Demo với client Nhật sau 2 tiếng. Generate pre-demo checklist.
    
    Features sẽ demo: [list]
    Môi trường: staging
    URL: https://staging.xxx.com
    
    Tạo checklist chia theo thời gian:
    
    T-2h (2 giờ trước):
    □ Deploy thành công chưa? Check deployment logs.
    □ DB migration chạy xong chưa?
    □ Seed data demo đã chuẩn bị chưa? (realistic data, tiếng Nhật)
    □ Test account hoạt động không? (login thử)
    □ API external dependencies up không? (payment, email, SMS)
    
    T-1h:
    □ Chạy qua toàn bộ demo script 1 lần
    □ Check UI trên browser client hay dùng (IE11? Chrome? Edge?)
    □ Check trên resolution client hay dùng (1920x1080? 1366x768?)
    □ Tiếng Nhật hiển thị đúng encoding không?
    □ Screenshot/screen record backup plan nếu live demo fail
    
    T-30m:
    □ Clear browser cache
    □ Login sẵn với demo account
    □ Chuẩn bị sẵn data cho từng demo step
    □ Backup plan: có local demo hoặc video không?
    
    T-5m:
    □ Camera/mic test nếu remote demo
    □ Screen share test
    □ Slide backup mở sẵn
    
    Nếu BẤT KỲ item nào fail → escalate ngay, đừng demo khi chưa fix."
    Rule bất di bất dịch với client Nhật: Không bao giờ demo feature chưa test kỹ. Một lần fail demo = mất 3 tháng build trust.
    Tester · Case T5 — Đặc thù Nhật
    Test evidence & report — tài liệu hóa mọi thứ
    Client Nhật yêu cầu テスト成績書 (test result report) cực kỳ chi tiết — không phải để kiểm soát, mà là văn hóa. "Nếu không có tài liệu = không có thật." Đây cũng là cơ sở để release approval.
    🇯🇵 必須 (bắt buộc)Release gateAudit trail
    📸 テスト成績書 — test result report chuẩn Nhật
    Release required
    claude "Tổng hợp テスト成績書 (test result report) cho release v2.3.
    
    Raw data từ test execution:
    - Total test cases: [số]
    - Pass: [số]
    - Fail: [số]
    - Blocked: [số]
    - Not executed: [số]
    - Bugs found: [list bug IDs]
    - Bugs fixed: [list]
    - Bugs deferred: [list với lý do]
    
    Tạo report TIẾNG NHẬT:
    
    # テスト成績書
    システム名: [tên]
    バージョン: v2.3
    テスト期間: YYYY/MM/DD ~ YYYY/MM/DD
    作成者: [tên]
    承認者: [để trống cho manager điền]
    
    ## 1. テスト概要
    [Summary ngắn gọn — không quá 5 câu]
    
    ## 2. テスト実施結果
    | 項目 | 件数 | 割合 |
    | テストケース総数 | X | 100% |
    | 合格(OK) | Y | Z% |
    | 不合格(NG) | A | B% |
    | 未実施 | C | D% |
    
    ## 3. バグ統計
    | 優先度 | 検出数 | 修正済 | 保留 |
    | 緊急 | | | |
    | 高 | | | |
    
    ## 4. 未解決バグ(リリース時残存)
    [List bugs deferred với justification tại sao OK để release]
    
    ## 5. リリース判定
    → リリース可 / 条件付きリリース可 / リリース不可
    理由: [explanation]
    
    ## 6. 今後の課題
    [Items sẽ address trong next sprint]"
    Monthly quality report — báo cáo chất lượng tháng gửi client
    claude "Tổng hợp monthly quality report tháng [X].
    
    Data:
    - Bugs reported: [số, theo priority breakdown]
    - Bugs fixed: [số]
    - Open bugs: [số]
    - Test cases executed: [số]
    - Coverage rate: [%]
    - Previous month comparison: [data]
    
    Tạo report ngắn gọn tiếng Nhật (1 trang):
    
    品質レポート [YYYY年MM月]
    
    1. 今月のサマリー — highlights tháng này
    2. バグ推移グラフ (text chart) — trend so với 3 tháng trước
    3. 品質指標 — metrics chính
    4. 主な改善点 — những gì team đã cải thiện
    5. 課題と対策 — issues và plan
    6. 来月の計画 — plan tháng tới
    
    Tone: professional, không exaggerate, honest về issues."
    BA · Case B1 — Đặc thù VAIX
    Phân tích spec mơ hồ từ client Nhật — decode ẩn ý
    Client Nhật theo văn hóa high-context: họ không nói thẳng mọi thứ, giả định nhiều điều hiển nhiên, và spec thường thiếu edge cases. BA phải đọc được "điều không được viết" và làm rõ trước khi dev bắt tay code.
    🇯🇵 High-context cultureRequirements clarityTrước khi dev code
    🧩 Phân tích yêu cầu — tìm ẩn ý và gap trong spec Nhật
    Quan trọng nhất
    claude "Phân tích yêu cầu từ client Nhật (tiếng Nhật):
    [paste spec, email, hoặc meeting notes]
    
    Đóng vai BA có kinh nghiệm với client Nhật. Phân tích:
    
    1. EXPLICIT REQUIREMENTS — những gì được nói rõ:
       [List bằng tiếng Việt, reference đến đoạn gốc tiếng Nhật]
    
    2. IMPLICIT REQUIREMENTS — những gì KHÔNG nói nhưng client mặc định biết:
       Với client Nhật, typical assumptions:
       - 全角/半角 (zenkaku/hankaku) validation cho text inputs
       - Date format: YYYY年MM月DD日 hoặc YYYY/MM/DD
       - Number format: 1,000,000 (dấu phẩy phân cách nghìn)
       - Error messages phải bằng tiếng Nhật
       - Loading state cho mọi async operation
       - Confirmation dialog trước khi delete/submit quan trọng
       → List những implicit requirements likely cho project này
    
    3. AMBIGUITIES (不明点) — những chỗ mơ hồ:
       Với mỗi ambiguity:
       - Vấn đề: [mô tả chỗ mơ hồ]
       - Interpretation A: [cách hiểu 1]
       - Interpretation B: [cách hiểu 2]
       - Risk nếu chọn sai: [High/Medium/Low]
       - Câu hỏi cần hỏi client: [bằng tiếng Nhật, lịch sự]
    
    4. MISSING REQUIREMENTS — những gì spec không đề cập nhưng cần:
       - Error handling: khi API fail, user thấy gì?
       - Empty state: khi không có data, hiển thị gì?
       - Pagination: nếu có 10,000 records?
       - Permissions: ai được làm gì?
       - Audit log: có cần ghi lại action không?
    
    5. DEPENDENCY & ASSUMPTION:
       Feature này phụ thuộc vào feature nào khác chưa có?"
    Nhận diện "暗黙の了解" — điều hiển nhiên trong văn hóa Nhật
    Client Nhật mặc định biết
    • Input số: chỉ nhận 半角数字 (half-width digits), không nhận 全角 (全角:123)
    • Confirm dialog: "削除してよろしいですか?" trước mọi delete action
    • Back button sau submit: không được resubmit form
    • Session timeout: hiển thị warning 5 phút trước khi expire
    • Print friendly: mọi report page cần có CSS print
    BA phải hỏi rõ
    • Concurrent editing: 2 user edit cùng record → xử lý thế nào?
    • Data retention: records cũ giữ bao lâu? Ai được xóa?
    • Notification: email, SMS hay in-app? Template tiếng Nhật?
    • Export: Excel hay CSV? Encoding UTF-8 hay Shift-JIS?
    • Mobile: cần responsive hay chỉ desktop?
    📞 Sau meeting với client — chuẩn bị nhanh trong 15 phút
    Post-meeting
    claude "Vừa xong meeting 1 tiếng với client Nhật. Tôi có notes thô:
    [paste notes tiếng Việt/Nhật lộn xộn]
    
    Xử lý trong 15 phút:
    
    1. MEETING MINUTES (gửi client trong 24h):
       Tiếng Nhật, format chuẩn:
    
       議事録
       日時: YYYY/MM/DD HH:MM-HH:MM
       参加者: [list]
    
       ■ 決定事項 (Quyết định):
       1. ...
    
       ■ 宿題事項 (Action items):
       | No | 内容 | 担当 | 期限 |
    
       ■ 次回打ち合わせ (Next meeting):
       日時: [proposed]
       議題: [proposed agenda]
    
    2. INTERNAL SUMMARY (gửi team Việt):
       Tiếng Việt, informal:
       - Quyết định quan trọng: [list]
       - Action items của team mình: [list với deadline]
       - Red flags cần chú ý: [gì client có vẻ không happy?]
       - Questions cần confirm lại: [list]
    
    3. REQUIREMENT UPDATES:
       Spec nào thay đổi sau meeting này?
       Impact đến dev/test team: [brief]"
    BA · Case B2
    Viết User Story & Acceptance Criteria — chuẩn cho cả team Việt lẫn client Nhật
    User Story phải đủ rõ để dev hiểu, đủ formal để client Nhật accept, đủ testable để tester viết test case. BA là người cầu nối — user story là sản phẩm quan trọng nhất.
    BilingualTestable ACSprint-ready
    📝 Viết User Story chuẩn từ yêu cầu thô
    Core skill BA
    claude "Yêu cầu thô từ client Nhật:
    '管理者が月次レポートをExcelでエクスポートできるようにしたい。
    フィルター機能もつけてほしい。'
    (Muốn admin có thể export monthly report ra Excel. Cũng muốn có filter.)
    
    Đọc codebase hiện tại (src/services/, src/routes/) để hiểu context kỹ thuật.
    Viết User Story HOÀN CHỈNH:
    
    ---
    USER STORY: US-087
    Title: Admin export monthly report as Excel
    
    ## User Story
    As a システム管理者 (system administrator),
    I want to export monthly order reports as Excel files with filter options,
    So that I can analyze business performance offline and share with stakeholders.
    
    ## Context & Background
    [Mô tả context tại sao feature này quan trọng]
    [Reference đến existing functionality liên quan]
    
    ## Acceptance Criteria (BDD format, testable)
    Given [precondition rõ ràng]
    When [action cụ thể]
    Then [expected result measurable]
    And [additional assertions]
    
    Scenario 1: Export without filter (happy path)
    Given tôi đang login với role Admin
      And có ít nhất 1 order trong tháng được chọn
    When tôi click Export button
      And chọn tháng 2024/01
      And click Confirm
    Then file Excel được download tự động
      And filename format: 'orders-2024-01.xlsx'
      And file chứa tất cả orders trong tháng 01/2024
      And header row: [list columns cụ thể]
      And số tiền format: #,##0 (comma separated, no decimal)
      And date format: YYYY/MM/DD
    
    Scenario 2: Export with filter
    Scenario 3: No data for selected month
    Scenario 4: Large dataset (> 10,000 records)
    Scenario 5: Non-admin access attempt
    
    ## Out of Scope (明示的に除外)
    - Export to CSV format (future)
    - Scheduled/automated export (future)
    - Real-time data streaming
    
    ## Open Questions (確認事項)
    1. [Câu hỏi tiếng Nhật cho client]
    2. [Câu hỏi cho dev team]
    
    ## Technical Notes (for dev)
    - Existing: src/services/reporting.ts — có method getMonthlyOrders()
    - Need: Excel generation (suggest exceljs — đã có trong project)
    - Performance: streaming for > 1000 records
    
    ## Definition of Done
    □ All ACs pass
    □ Test cases written and pass
    □ Code reviewed
    □ Client demo accepted"
    🔢 Story point estimation — giải thích được với client Nhật
    Estimate
    claude "Estimate story points và effort cho sprint này.
    
    User stories cần estimate:
    US-087: Admin export Excel (mô tả trên)
    US-088: [mô tả]
    US-089: [mô tả]
    
    Đọc codebase để có kỹ thuật context trước khi estimate.
    
    Với mỗi story, phân tích:
    
    COMPLEXITY FACTORS:
    - Backend complexity: 1-5 (cần viết mới bao nhiêu?)
    - Frontend complexity: 1-5
    - Integration complexity: 1-5 (external services?)
    - Test complexity: 1-5 (bao nhiêu edge cases?)
    - Unknowns/risks: 1-5 (còn chỗ chưa rõ?)
    
    ESTIMATE: Fibonacci (1,2,3,5,8,13,21)
    
    JUSTIFICATION (quan trọng khi giải thích với client Nhật):
    US-087: 8 points vì:
      - Excel generation cần implement mới (~1 ngày dev)
      - Filter logic phức tạp: 5 conditions kết hợp (~0.5 ngày)
      - Performance handling > 10K records (~0.5 ngày)
      - Testing: 20+ test cases (~0.5 ngày)
      - Buffer cho review/bug fix: 0.5 ngày
      = ~3 ngày dev, tương đương 8 points
    
    SPRINT CAPACITY CHECK:
      Team velocity: [X] points/sprint
      Đề xuất: US-087, US-088 trong sprint này = [total] points
      US-089 defer sang sprint tiếp theo"
    BA · Case B3 — Đặc thù VAIX
    Quản lý 仕様変更 (spec change) — impact analysis & negotiation
    Đây là case BA sợ nhất khi làm với client Nhật: họ thay đổi spec giữa chừng, đôi khi mà không nhận ra đó là thay đổi ("これは最初からそういう仕様です" — "Từ đầu spec đã vậy rồi mà"). BA phải có documentation và analysis đủ tốt để handle.
    🇯🇵 Thường xảy raChange managementProtect team
    🔀 Impact analysis khi client thay đổi spec
    Xảy ra mọi sprint
    claude "Client Nhật vừa yêu cầu thay đổi:
    
    Spec cũ (v2.0, đã confirm ngày XX/XX):
    '検索結果は最大100件まで表示する'
    (Hiển thị tối đa 100 kết quả tìm kiếm)
    
    Spec mới (email ngày YY/YY):
    '検索結果は全件表示できるようにしてほしい'
    (Muốn hiển thị toàn bộ kết quả)
    
    Đọc codebase để hiểu current implementation.
    
    Phân tích impact TOÀN DIỆN:
    
    1. TECHNICAL IMPACT:
       □ Code cần thay đổi: [list files + effort estimate]
       □ Performance risk: hiện tại có bao nhiêu records max?
         Nếu 100K records → UI sẽ crash / timeout
       □ DB impact: query hiện tại có LIMIT không? Index đủ không?
       □ Frontend impact: cần virtual scrolling? Pagination thay thế?
    
    2. TESTING IMPACT:
       □ Test cases nào cần update/viết mới?
       □ Performance test cần thêm: load test với X records
    
    3. SCHEDULE IMPACT:
       □ Current sprint: feature này đang ở đâu? (dev / test / done?)
       □ Additional effort: [X giờ / ngày]
       □ Nếu phải deliver đúng deadline → gì phải defer?
    
    4. RISK ASSESSMENT:
       □ Technical risk: [High] — display all có thể gây performance issue nghiêm trọng
       □ Recommended approach: pagination với 'load more' hoặc 'export all'?
    
    5. RESPONSE TO CLIENT (tiếng Nhật):
       Viết email lịch sự:
       - Xác nhận đã nhận yêu cầu thay đổi
       - Trình bày impact (nhẹ nhàng nhưng rõ ràng)
       - Đề xuất alternative nếu có
       - Hỏi confirm về timeline và priority
       - KHÔNG từ chối thẳng, KHÔNG commit ngay không có plan"
    Nguyên tắc với client Nhật: Không bao giờ nói "Không". Luôn nói "Được, tuy nhiên... [impact]. Chúng tôi đề xuất [alternative]. Bạn có muốn discuss không?"
    📜 仕様変更依頼書 — tài liệu hóa spec change chính thức
    🇯🇵 Phải có
    Mọi spec change phải được document bằng 仕様変更依頼書 — không phải để gây khó dễ cho client, mà để bảo vệ cả hai bên khỏi misunderstanding sau này.
    claude "Tạo 仕様変更依頼書 (spec change request document) tiếng Nhật.
    
    Change request:
    - Màn hình: [tên]
    - Thay đổi: [mô tả]
    - Lý do client thay đổi: [nếu biết]
    - Impact: [từ analysis trước]
    
    Format:
    
    # 仕様変更依頼書
    文書番号: CR-2024-023
    作成日: YYYY/MM/DD
    依頼元: [client name]
    対応チーム: VAIX
    
    ## 1. 変更内容
    | 項目 | 変更前 | 変更後 |
    | 検索結果表示件数 | 最大100件 | 全件表示 |
    
    ## 2. 変更理由
    [Client lý do thay đổi]
    
    ## 3. 影響範囲
    | 影響対象 | 内容 | 工数 |
    | バックエンド | ページング処理変更 | X時間 |
    | フロントエンド | 仮想スクロール実装 | X時間 |
    | テスト | テストケース更新 | X時間 |
    | 合計 | | XX時間 |
    
    ## 4. スケジュール影響
    [Impact đến timeline hiện tại]
    
    ## 5. リスク
    [Technical và business risks]
    
    ## 6. 対応方針
    [Approach được đề xuất]
    
    ## 7. 承認
    | 役割 | 氏名 | 承認日 | サイン |
    | 依頼元担当 | | | |
    | VAIX PM | | | |
    
    Bên dưới thêm phiên bản tiếng Việt để team nội bộ dùng."
    BA · Case B4 — Đặc thù VAIX
    QA票 & Q&A Nhật — hỏi đúng, nhận được câu trả lời
    QA票 (QA-hyou) là danh sách câu hỏi gửi client theo format chuẩn Nhật. Hỏi sai cách, không có structure, hoặc dùng tiếng Nhật không chuẩn → client không trả lời, hoặc trả lời mơ hồ. Claude giúp viết QA票 professional.
    🇯🇵 Format chuẩnCommunicationGet clear answers
    Viết QA票 — format chuẩn để gửi client Nhật
    Dùng hàng tuần
    claude "Tôi có các ambiguities sau cần hỏi client Nhật:
    
    1. Khi user search không có kết quả, hiển thị gì?
    2. Giới hạn file upload là bao nhiêu MB?
    3. Date picker có cho phép chọn ngày trong quá khứ không?
    4. Nếu session expire khi đang điền form, data có bị mất không?
    
    Viết QA票 tiếng Nhật, format Excel-ready:
    
    # QA票 (質問票)
    プロジェクト名: [tên]
    作成日: YYYY/MM/DD
    作成者: [tên BA]
    バージョン: v1.0
    
    | No | カテゴリ | 質問内容 | 関連画面/機能 | 参照資料 | 優先度 | 回答期限 | 回答 | 対応内容 |
    
    Với mỗi câu hỏi:
    - Tiếng Nhật rõ ràng, kính ngữ phù hợp
    - Reference đến spec section nếu có
    - Describe: impact nếu không clarify (tại sao urgent?)
    - Provide example nếu cần (ví dụ A hay B?)
    - Priority: 高/中/低
    
    Câu hỏi phải:
    ✅ Cụ thể, có thể trả lời Yes/No hoặc chọn option
    ✅ Không hỏi nhiều việc trong 1 câu
    ✅ Include context đủ để client hiểu mà không cần đọc spec lại
    ❌ Không hỏi chung chung 'これで合っていますか' (đúng không?)"
    Khi client trả lời mơ hồ — follow-up đúng cách
    claude "Câu hỏi tôi hỏi:
    '検索結果が0件の場合、どのようなメッセージを表示すればよいですか?'
    (Khi không có kết quả, hiển thị message gì?)
    
    Client trả lời:
    '適切なメッセージを表示してください。'
    (Hãy hiển thị message phù hợp.)
    
    Đây là câu trả lời mơ hồ — chưa actionable.
    
    Viết follow-up email tiếng Nhật:
    1. Thank client cho reply
    2. Xác nhận đã hiểu intent
    3. Propose 2-3 options cụ thể (với mockup text nếu cần):
       Option A: '検索結果が見つかりませんでした。検索条件を変えてお試しください。'
       Option B: '該当するデータがありません。'
       Option C: [option khác]
    4. Hỏi client muốn chọn option nào?
    5. Nếu có deadline → mention lịch sự
    
    Tránh: đừng làm client cảm thấy bị pressure hoặc được cho là không trả lời đúng."
    📧 Business email tiếng Nhật — các tình huống thường gặp
    Communication
    claude "Viết email tiếng Nhật cho tình huống sau:
    
    TÌNH HUỐNG: [chọn 1]
    A) Xin lỗi về delay — delivery sẽ trễ 3 ngày vì bug phức tạp
    B) Báo cáo bug production đã xảy ra và plan fix
    C) Xin gia hạn deadline vì yêu cầu phức tạp hơn dự kiến
    D) Gửi release notes và xin client accept
    E) Escalate: cần giám đốc client confirm decision quan trọng
    
    Chi tiết tình huống: [mô tả]
    
    Email format chuẩn Nhật:
    
    件名: [Subject line — cụ thể, không mơ hồ]
    
    [Client name]様
    
    お世話になっております。VAIX [tên BA]でございます。
    
    [Opening — acknowledge relationship]
    
    [Body — 3-4 đoạn, mỗi đoạn 1 điểm chính]
    
    [Closing — action needed from client + deadline nếu có]
    
    お手数をおかけしますが、ご確認のほどよろしくお願いいたします。
    
    [Signature]
    
    Rules:
    - Không sử dụng casual language (だ/である)
    - Dùng ます/です consistently
    - お/ご prefix cho actions của client (ご確認, ご返信)
    - Không quá dài — 5-8 câu là đủ
    - CC: manager nếu important decision"
    BA · Case B5
    Tài liệu & Presentation — thuyết phục client Nhật
    Client Nhật đánh giá cao tài liệu được chuẩn bị kỹ. Một presentation cẩu thả = thiếu tôn trọng. BA tốt tại VAIX không chỉ phân tích giỏi mà còn biết đóng gói thông tin đẹp và đúng kỳ vọng văn hóa.
    🇯🇵 Cultural expectationPersuasionProfessional docs
    📊 Sprint review presentation — báo cáo tiến độ với client Nhật
    Bi-weekly
    claude "Chuẩn bị Sprint Review presentation cho client Nhật.
    
    Sprint data:
    - Sprint: Sprint 8 (2024/01/15 - 2024/01/26)
    - Committed: 32 points (8 stories)
    - Completed: 28 points (7 stories)
    - Not completed: US-089 (4 points) — lý do: external API issue
    - Bugs found: 3 (2 fixed, 1 deferred)
    - Next sprint plan: [list]
    
    Tạo presentation outline (tiếng Nhật, slide by slide):
    
    SLIDE 1: タイトル
    スプリント8レビュー | 2024年1月26日
    
    SLIDE 2: 今スプリントのサマリー
    [Metrics dạng visual — dùng số và icon, ít text]
    ✅ 完了: 7ストーリー / 28ポイント
    ⚠️ 持越し: 1ストーリー / 4ポイント
    
    SLIDE 3: 完了した機能のデモ
    [List features đã done + demo plan]
    
    SLIDE 4: 持越しストーリーの説明
    US-089: [tên] — 4ポイント
    原因: 外部API連携の問題 (External API issue)
    対策: ベンダーと調整中、来週中に解決見込み (Đang làm việc với vendor, dự kiến xong tuần tới)
    スプリント9での対応: 優先対応 (Ưu tiên xử lý)
    
    SLIDE 5: 品質状況
    [Bug metrics, test coverage]
    
    SLIDE 6: 次スプリントの計画
    [Stories planned + capacity]
    
    SLIDE 7: リスクと課題
    [Top 3 risks với mitigation plan]
    
    PRESENTATION TIPS cho client Nhật:
    - Không surprise bad news — nếu có vấn đề, thông báo TRƯỚC meeting
    - Demo live nếu có thể, screenshot nếu không chắc stable
    - Chuẩn bị Q&A answers cho câu hỏi likely"
    📈 Tạo tài liệu nghiệp vụ từ code — reverse engineering
    Từ code → docs
    Tình huống thực tế tại VAIX: dev đã implement xong nhưng không có tài liệu để gửi client. BA dùng Claude để reverse engineer tài liệu từ code.
    claude "Đọc toàn bộ src/services/ và src/routes/ của system này.
    
    Tạo ビジネスロジック仕様書 (business logic spec document) tiếng Nhật:
    
    # ビジネスロジック仕様書
    システム: [tên]
    作成日: YYYY/MM/DD
    バージョン: [từ git tag]
    
    ## 1. 機能一覧 (Feature list)
    | No | 機能名 | 概要 | 関連画面 | API エンドポイント |
    
    ## 2. ビジネスルール (Business rules)
    Với mỗi business rule tìm được trong code:
    
    ### BR-001: [Tên rule]
    説明: [Mô tả tiếng Nhật rõ ràng, không dùng code terms]
    条件: [Khi nào rule này apply]
    処理: [Rule làm gì]
    例外: [Exception cases]
    実装箇所: src/services/xxx.ts #行XX (để dev reference)
    
    ## 3. 状態遷移図 (State machine)
    Với mỗi entity có status:
    状態: [DRAFT] → [CONFIRMED] → [PAID] → [SHIPPED] → [DELIVERED]
    遷移条件: [mỗi transition, điều kiện]
    
    ## 4. エラー処理 (Error handling)
    | エラーコード | 発生条件 | 表示メッセージ | 対処方法 |
    
    Viết bằng tiếng Nhật, ngôn ngữ nghiệp vụ (không dùng technical jargon).
    Suitable để gửi thẳng cho client Nhật review."
    🤝 Proposal & estimate — thuyết phục client approve thêm budget
    Business dev
    claude "VAIX cần propose thêm budget/timeline cho Phase 2.
    
    Context:
    - Phase 1 đã xong: [mô tả]
    - Client muốn Phase 2: [yêu cầu]
    - Technical complexity chúng tôi đánh giá: [notes]
    - Mong muốn của VAIX: [budget range, timeline]
    
    Tạo 提案書 (proposal document) tiếng Nhật:
    
    # フェーズ2開発提案書
    提案日: YYYY/MM/DD
    提案者: VAIX株式会社 [tên]
    
    ## 1. エグゼクティブサマリー
    [3-4 câu: context, cái cần làm, giá trị mang lại]
    
    ## 2. フェーズ2スコープ
    [Feature list với priority]
    
    ## 3. 実装アプローチ
    [Technical approach — đủ để client tin, không quá technical]
    
    ## 4. スケジュール
    | マイルストーン | 内容 | 完了予定 |
    | M1 | 基本設計完了 | YYYY/MM/DD |
    | M2 | 開発完了 | YYYY/MM/DD |
    | M3 | テスト完了 | YYYY/MM/DD |
    
    ## 5. 見積もり (Estimate)
    | 項目 | 工数 | 単価 | 金額 |
    [Breakdown rõ ràng, đủ detail để client hiểu]
    
    ## 6. リスクと対策
    [Top 3 risks với mitigation]
    
    ## 7. 前提条件 (Preconditions)
    [Những gì VAIX cần từ client để làm tốt]
    
    Tone: confident but humble. Không oversell.
    Số liệu phải realistic — client Nhật sẽ hold bạn accountable."
    Documentation · Case D1 — Nền tảng
    Setup ngữ cảnh & văn phong — làm một lần, dùng mãi
    Người viết tài liệu tốn 30–50% thời gian để làm văn phong nhất quán, format đúng template, và tone phù hợp với từng loại tài liệu. Claude giải quyết toàn bộ nếu setup đúng ngữ cảnh từ đầu.
    Làm đầu tiênOne-time setupHigh ROI
    🧠 CLAUDE.md cho Documentation Team — context không bao giờ quên
    Setup đầu tiên
    Template CLAUDE.md cho Documentation Team VAIX
    # docs/CLAUDE.md — Documentation Team Context
    
    ## Company profile
    - Tên: VAIX GROUP — IT outsource Việt Nam cho thị trường Nhật Bản
    - Khách hàng: Công ty Nhật (SME đến Enterprise)
    - Ngôn ngữ: Tiếng Nhật (client) + Tiếng Việt (nội bộ)
    - Chuyên môn: AI/ML, Web system, Mobile, Business automation
    
    ## Document types thường tạo
    - 提案書: Proposal/đề xuất → formal, thuyết phục
    - 見積書: Báo giá → chi tiết, breakdown rõ ràng
    - 要件定義書: Requirements definition
    - 基本設計書/詳細設計書: Design documents
    - 議事録: Meeting minutes → gửi trong 24h
    - 進捗報告書: Progress report → monthly
    - テスト仕様書/成績書: Test spec/result
    
    ## Writing standards
    Tiếng Nhật:
    - Kính ngữ: です/ます体 cho tất cả tài liệu gửi client
    - Xưng hô: 弊社 = VAIX, 貴社 = client
    - Không casual expressions
    
    Tiếng Việt (nội bộ):
    - Tone: chuyên nghiệp nhưng thân thiện
    - Format ngày: DD/MM/YYYY
    
    ## Standard disclaimer (cuối tài liệu gửi client)
    本資料の内容は予告なく変更される場合があります。
    ご不明な点がございましたら、担当者までお問い合わせください。
    
    ## Version format
    v1.0 = Draft client review | v1.x = Revision | v2.0 = Major revision
    Luôn có 改訂履歴 trong tài liệu quan trọng
    Role-based persona — switch theo loại tài liệu
    # Persona cho báo giá / proposal
    claude "Trong session này, đóng vai Senior Sales Engineer:
    - 10 năm kinh nghiệm với client Nhật
    - Thuyết phục được nhưng không oversell
    - Mọi claim phải có backing (số liệu, reference, case study)
    - Tone: confident, professional, partner-oriented
    - Biết văn hóa giao tiếp business Nhật"
    
    # Persona cho technical spec
    claude "Đóng vai Senior System Architect viết tài liệu:
    - Precision là ưu tiên số 1. Ambiguity = enemy.
    - Mọi requirement phải testable và measurable
    - Khi thiếu thông tin → flag [TBD] rõ ràng, không assume
    - Dùng bảng và diagram thay vì prose dài"
    
    # Persona cho user manual
    claude "Đóng vai Technical Writer cho non-technical users:
    - Giả định người đọc KHÔNG biết IT
    - Mỗi step = 1 action duy nhất
    - Mọi technical term có giải thích
    - Screenshot placeholder: [図X-X: tên màn hình]"
    Chuẩn hóa văn phong toàn team — consistency audit
    claude "Audit văn phong 3 tài liệu sau và tạo Style Guide:
    Doc1: [paste] | Doc2: [paste] | Doc3: [paste]
    
    1. INCONSISTENCIES:
       - Cách xưng hô: 'chúng tôi' vs 'VAIX' → chọn 1
       - Ngày: DD/MM/YYYY vs YYYY/MM/DD → chọn 1
       - Heading: Title Case vs Sentence case
       - Bullet: '-' vs '•' vs số thứ tự
    
    2. STYLE GUIDE đề xuất:
       [Document conventions] → lưu vào CLAUDE.md
    
    3. Self-review checklist trước khi gửi:
       □ Xưng hô nhất quán? □ Format ngày đúng?
       □ Heading hierarchy đúng? □ Bảng có header?
       □ Tiếng Nhật kính ngữ đúng?"
    Documentation · Case D2 — High stakes
    Phân tích dự án mới & báo giá — win the deal
    Báo giá cho client Nhật không chỉ là điền số. Họ đọc rất kỹ, compare với vendors khác, và đánh giá cách bạn hiểu vấn đề. Proposal tốt = trust builder.
    Business critical🇯🇵 Japan marketRevenue impact
    🔍 Phân tích RFP/yêu cầu mới — hiểu trước khi báo giá
    Bước đầu tiên
    claude "Phân tích RFP/yêu cầu mới từ client Nhật:
    [upload hoặc paste tài liệu]
    
    1. PROJECT SUMMARY: Client là ai? Muốn build gì? Giải quyết vấn đề gì?
    2. TECHNICAL REQUIREMENTS: Platform, tech preferences, integrations, NFRs?
    3. BUSINESS REQUIREMENTS: Timeline, budget signal, success metrics?
    4. GAPS — thông tin còn thiếu → list câu hỏi cần hỏi
    5. ASSUMPTIONS — những gì tôi phải assume → list rõ ràng
    6. RISK ASSESSMENT (internal):
       - Technical: công nghệ mới, integration phức tạp?
       - Scope: requirements mơ hồ, scope creep risk?
       - Resource: cần skill gì? VAIX có không?
    7. COMPETITIVE POSITIONING: VAIX có lợi thế gì?
    8. PRELIMINARY ESTIMATE: S/M/L/XL rough range"
    💴 Viết 見積書 — chi tiết, minh bạch, thuyết phục
    🇯🇵 Japan format
    claude "Tạo 見積書 chuẩn Nhật:
    
    # 御見積書
    見積番号: EST-2024-089 | 作成日: YYYY年MM月DD日
    有効期限: 30日間
    
    | No | 項目 | 内容 | 数量 | 単価 | 金額 |
    | 1 | 要件定義・設計 | 要件定義書・基本設計書 | 1式 | ¥500,000 | ¥500,000 |
    | 2 | バックエンド開発 | Node.js + PostgreSQL | X人月 | ¥600,000/月 | ¥X,XXX,000 |
    | 3 | フロントエンド開発 | React + TypeScript | X人月 | ¥550,000/月 | ¥X,XXX,000 |
    | 4 | テスト | 単体・結合・受入 | 1式 | ¥300,000 | ¥300,000 |
    | 5 | プロジェクト管理 | PM・報告 | X人月 | ¥400,000/月 | ¥XXX,000 |
    | | 小計 | | | | ¥X,XXX,000 |
    | | 消費税(10%) | | | | ¥XXX,000 |
    | | **合計** | | | | **¥X,XXX,000** |
    
    スコープ内: [list cụ thể]
    スコープ外: インフラ費用 / 第三者ライセンス / 追加開発
    
    納品物: | 成果物 | 納期 |
    | 要件定義書 | MM/DD | 基本設計書 | MM/DD | ソースコード | MM/DD |
    
    備考: 要件定義完了後に再見積もりの可能性があります。"
    3 options pricing — anchor strategy
    claude "Tạo 3 options báo giá cho cùng project:
    
    Option A — Basic (最小構成): Scope tối thiểu, timeline ngắn, budget thấp
    Option B — Standard (標準構成) [RECOMMENDED]: Full scope, timeline hợp lý
    Option C — Premium (フルオプション): Full + CI/CD + monitoring + docs đầy đủ
    
    Với mỗi option: 3 dòng tóm tắt tiếng Nhật + breakdown + timeline.
    Format bảng so sánh: client dễ decide.
    
    Mục tiêu: Option B trông most reasonable (anchor effect từ C)."
    📋 提案書 — thuyết phục không chỉ bằng giá
    Win deal
    claude "Viết 提案書 đầy đủ tiếng Nhật:
    
    Structure thuyết phục:
    
    ## エグゼクティブサマリー
    [3-5 câu standalone: vấn đề → giải pháp → why VAIX → kết quả kỳ vọng]
    
    ## 1. 現状課題の理解 [QUAN TRỌNG NHẤT]
    現状: [pain points — show client 'họ hiểu chúng ta']
    課題の影響: [business impact nếu không giải quyết]
    
    ## 2. 提案するソリューション
    [Overview + text architecture diagram + top 5-7 features với business value]
    
    ## 3. 導入効果 [Quantified]
    - 業務効率化: XX% 作業時間削減
    - コスト削減: 年間XX万円削減見込み
    
    ## 4. プロジェクト体制
    [Team structure + brief bio key members — builds trust]
    [Similar projects đã làm — 実績 rất quan trọng với Nhật]
    
    ## 5. スケジュール + 御見積
    
    ## 6. 次のステップ
    ['ご質問があれば○月○日までにご連絡ください' — cụ thể, không để lửng]"
    Documentation · Case D3
    Viết spec & requirements — foundation của project
    要件定義書 và 基本設計書 là tài liệu quan trọng nhất — mọi thứ sau đó đều dựa vào đây. Viết sai = build sai = cost overrun và mất trust client Nhật.
    RequirementsDesign docs🇯🇵 IPA standard
    📜 要件定義書 — từ meeting notes đến formal requirements
    Tài liệu quan trọng nhất
    claude "Tổng hợp 要件定義書 từ: meeting notes + emails + wireframes.
    [paste các nguồn]
    
    # システム要件定義書
    文書管理番号: REQ-2024-001 | バージョン: 1.0
    
    | 改訂履歴 | 版 | 日付 | 変更内容 | 作成者 |
    
    ## 1. システム概要
    1.1 目的 | 1.2 対象範囲 (in/out scope) | 1.3 用語定義
    
    ## 2. 業務要件
    現状業務フロー (As-Is) → 課題 → 新業務フロー (To-Be)
    
    ## 3. 機能要件 (cho mỗi feature)
    | 要件ID | FR-001 |
    | 機能名 | |
    | 概要 | |
    | 入力/処理/出力 | |
    | 例外処理 | |
    | 優先度 | 必須/重要/希望 |
    
    ## 4. 非機能要件
    性能 | セキュリティ | 可用性 | 保守性 | 移行要件
    
    ## 5. 制約条件 & 前提条件
    
    ## 6. 未決事項 (Open Items)
    | No | 内容 | 確認先 | 期限 | ステータス |
    
    CRITICAL: Đánh dấu [TBD] cho items chưa confirmed.
    KHÔNG assume — flag explicit."
    Review & improve docs — quality gate trước khi gửi client
    Quality gate
    claude "Review tài liệu sau với góc nhìn client Nhật khó tính:
    [paste tài liệu]
    
    1. CLARITY — chỗ nào mơ hồ, có thể hiểu nhiều cách?
    2. COMPLETENESS — thiếu: version history, glossary, assumptions, open items?
    3. ACCURACY — số liệu, dates, cross-references đúng không?
    4. TONE (tiếng Nhật) — kính ngữ nhất quán? Câu quá dài?
    5. FORMAT — heading hierarchy, bảng có header, numbering nhất quán?
    
    Priority fixes: top 5 phải sửa ngay.
    Sau đó viết lại phần có vấn đề nhất."
    Documentation · Case D4
    Use case & process flow — ngôn ngữ chung business-technical
    Client Nhật đặc biệt coi trọng 業務フロー diagrams — đây là bằng chứng bạn hiểu nghiệp vụ của họ. Use case tốt = ít phải giải thích hơn, ít rework hơn.
    Use casesProcess flow🇯🇵 Business flow
    👤 Use Case document đầy đủ — actor đến alternate flow
    Core document
    claude "Viết Use Case document cho hệ thống [tên].
    Actors: Customer / Staff / Manager / System
    
    Format mỗi use case:
    ---
    UC-001: 注文登録 (Đặt hàng mới)
    
    | 要件 | 内容 |
    | アクター | Customer |
    | 概要 | 商品を選択して注文を確定する |
    | 事前条件 | ログイン済み |
    | 事後条件 | 注文登録+確認メール送信 |
    
    基本フロー:
    1. カートでCheckoutをクリック
    2. 注文確認画面を表示
    3. 配送先・支払いを確認
    4. Order Confirmをクリック
    5. システムが在庫確認
    6. 注文登録+注文番号発行
    7. 確認メール送信
    
    代替フロー A1: Step5で在庫不足
      → 在庫不足通知 → 注文内容変更 or キャンセル
    
    例外フロー E1: 決済エラー
      → エラー表示 → 注文保存せず → 再試行を促す
    ---
    Tạo tất cả UCs. Group theo Actor và Feature area."
    🔄 業務フロー As-Is → To-Be + User Manual tiếng Nhật
    🇯🇵 Must-have
    claude "Quy trình hiện tại (As-Is): [mô tả]
    Pain points: [list]
    
    Vẽ swimlane diagram (text format):
    
    === AS-IS: 現行業務フロー ===
    | 顧客 | 営業担当 | 管理部 | システム |
    | 電話注文 | | | |
    | ↓ | | | |
    | | 注文票手書き | | |
    | | ↓ | | |
    | | | 在庫確認(Excel) | |
    ❌ Problems: [inefficiencies] | ⏱️ Time: X時間
    
    === TO-BE: 新業務フロー ===
    | 顧客 | システム | 管理部 |
    | オンライン注文 | | |
    | ↓ | | |
    | | 自動在庫確認 | |
    | | ↓ | |
    | | 承認通知 | → 管理部承認 |
    ✅ Improvements | ⏱️ New time: Y分"
    操作マニュアル — hướng dẫn cho non-IT users Nhật
    claude "Viết 操作マニュアル cho màn hình [tên]. Target: non-IT staff.
    
    Rules:
    - Mỗi step = 1 action. 操作 → 画面の変化.
    - Screenshot placeholder: [図X-X: 画面名]
    - Warning: ⚠️ 注意: / Tip: 💡 ポイント:
    - Không IT jargon
    
    Format:
    ## X.1 [機能名]
    **目的**: [1文で]
    **前提条件**: [何が必要か]
    
    操作手順:
    1. [画面名]を開きます。→ [表示内容]が表示されます。
    2. [操作]をクリックします。⚠️ 注意: [note if any]
    
    | 項目名 | 入力内容 | 必須/任意 |
    
    エラーが表示された場合:
    | エラーメッセージ | 原因 | 対処方法 |"
    Documentation · Case D5 — Multiplier
    Template & chuẩn hóa — build once, use forever
    Template tốt = multiplier. Mỗi document mới chỉ mất 20% thời gian so với viết từ đầu. Claude không chỉ điền template mà còn tạo, refine, và maintain template library.
    Productivity multiplierTeam assetReusable
    📐 議事録 template — điền trong 10 phút, gửi được ngay
    Hay dùng nhất
    # .claude/templates/gijiroku.md
    # Usage: /fill-minutes [meeting notes]
    
    # 議事録 {{MEETING_TITLE}}
    
    | 項目 | 内容 |
    | 日時 | {{DATE}} {{START}}-{{END}} |
    | 場所/方法 | {{LOCATION_OR_ZOOM}} |
    | 出席者 | {{CLIENT_ATTENDEES}} (貴社) / {{VAIX_ATTENDEES}} (弊社) |
    | 作成者 | {{AUTHOR}} (VAIX GROUP) |
    
    ## 1. 協議内容・決定事項
    
    ### {{TOPIC_1}}
    協議内容: {{DISCUSSION}}
    決定事項 ✅: {{DECISIONS}}
    未決事項 ⚠️: {{OPEN_ITEMS}} → 確認先: {{WHO}} / 期限: {{DATE}}
    
    ## 2. アクションアイテム
    | No | 内容 | 担当 | 所属 | 期限 |
    
    ## 3. 次回予定
    日時: {{NEXT_MEETING}} | 議題(案): {{NEXT_AGENDA}}
    
    ---
    本議事録に誤りがある場合は{{DEADLINE}}までにご連絡ください。
    ご連絡なき場合は内容にご同意いただいたものとします。
    VAIX GROUP / {{AUTHOR}} / {{EMAIL}}
    Auto-fill template từ notes thô — 10 phút → done
    claude "Điền template 議事録 từ notes thô:
    
    TEMPLATE: [paste template trên]
    
    NOTES (tiếng Việt lộn xộn):
    Meeting với Tanaka-san và Yamamoto-san của Softbank.
    Bên VAIX: Hùng, Minh và tôi. Zoom từ 14:00-15:30.
    Sprint 7 kết quả: 7/8 stories xong. US-089 delay vì Stripe API.
    Tanaka-san OK nhưng muốn daily update Slack.
    Sprint 8: thêm US-093 (export CSV), cần estimate lại, sẽ confirm ngày mai.
    Demo sprint 8: 2/2.
    
    Actions:
    - Hùng: Slack daily 17h từ hôm nay
    - Mình: estimate US-093 trước ngày mai 12h
    - Yamamoto: confirm staging trước 31/1
    
    Output: 議事録 tiếng Nhật hoàn chỉnh, sẵn sàng gửi client."
    🌐 Dịch & localize tài liệu — không chỉ dịch, còn adapt culture
    Multilingual
    claude "Localize tài liệu này cho client Nhật (không chỉ dịch):
    [paste document]
    
    Localization checklist:
    □ DATE: MM/DD/YYYY → YYYY年MM月DD日
    □ CURRENCY: USD → JPY
    □ EXAMPLES: John/New York → 田中/東京
    □ TONE: direct Mỹ → polite formal Nhật
    □ STRUCTURE: Nhật prefer Summary → Details (không phải Details → Conclusion)
    □ KÍNH NGỮ: thêm appropriate 敬語
    □ NUMBERS: 1,000 format với comma separator
    
    Output: bản tiếng Nhật đã adapted, kèm bảng 2 cột so sánh gốc/dịch
    cho reviewer check dễ."
    Advanced · Feature A1 — Foundation
    CLAUDE.md & Memory System — AI nhớ mọi thứ, mãi mãi
    Claude Code không có memory tự nhiên giữa sessions — mỗi lần mở terminal là "Claude mới". CLAUDE.md là cách inject memory vĩnh cửu. Hiểu sâu memory system = thiết kế workflow hiệu quả hơn 3x.
    FoundationPersistent contextZero-repeat setup
    🧠 Memory hierarchy — 4 tầng Claude đọc context theo thứ tự
    Hiểu cơ chế
    1
    Global (~/.claude/CLAUDE.md)
    Config toàn bộ máy. Coding style cá nhân, tool preferences. Đọc TRƯỚC mọi file khác.
    2
    Project root (./CLAUDE.md)
    Context project — commit vào git, share team. Tech stack, conventions, business rules. File quan trọng nhất.
    3
    Subdirectory (./src/payments/CLAUDE.md)
    Context module cụ thể. Override hoặc extend root. Claude làm trong folder này → đọc cả 2 và merge.
    4
    Runtime (prompt của bạn)
    Ghi đè tất cả. "Bỏ qua CLAUDE.md dùng Python" → Claude dùng Python session này.
    # Verify Claude đang đọc files nào
    claude "List tất cả CLAUDE.md files đang active.
    Summarize key rules từ mỗi file theo priority."
    
    # Import syntax — tái sử dụng context
    # Trong CLAUDE.md:
    @shared/company-standards.md
    @.claude/security-rules.md
    @../shared-libs/CLAUDE.md
    Dynamic memory trong session — TodoWrite + compact strategy
    claude "Session hôm nay: implement 5 features.
    Dùng TodoWrite để track:
    - [ ] US-087: Excel export
    - [ ] US-088: Email notification
    - [ ] US-089: Bulk delete
    Update [x] sau mỗi feature xong.
    Khi tôi hỏi 'status?' → TodoRead và report."
    
    # Trước /compact — save state
    claude "Tóm tắt trước khi compact:
    1. Đã xong gì (với file paths)
    2. Đang ở đâu
    3. Còn lại gì
    4. Key decisions đã đưa ra
    Lưu vào .claude/session-state.md rồi /compact"
    Advanced · Feature A2
    Slash commands nâng cao — encode best practices thành 1 click
    Custom slash commands không chỉ là $ARGUMENTS đơn giản. Commands có thể có conditional logic, multi-step workflows, và kết hợp nhiều tools. Đây là cách encode team best practices vào automation.
    AutomationTeam productivityBest practices encoded
    ⌨️ Advanced patterns — vượt qua simple $ARGUMENTS
    Advanced
    Command với conditional — /deploy staging|production
    # .claude/commands/deploy.md
    Deploy: $ARGUMENTS
    
    1. Xác định môi trường:
       - 'staging' → skip approval, tiếp tục
       - 'production' → hỏi confirm từ tôi trước
       - Khác → báo lỗi, dừng
    
    2. Pre-deploy checks:
       npm run typecheck || abort
       npm run lint || abort
       npm test || abort
       git status → uncommitted changes warning
    
    3. Build + deploy theo môi trường
    
    4. Post-deploy: health check 60s, smoke test
    
    5. Report: git tag nếu production, update CHANGELOG
    Command tạo feature tour doc — /onboard-feature
    # .claude/commands/onboard-feature.md
    Tạo feature tour cho developer mới: $ARGUMENTS
    
    1. Grep tất cả files liên quan đến $ARGUMENTS
    2. Map dependency graph: file → imports → imports
    3. Tìm entry points: route/controller nào expose feature?
    4. Đọc test files → extract behaviors từ test descriptions
    5. Tìm CHANGELOG entries liên quan
    6. Tìm TODO/FIXME trong feature files
    
    Output: docs/feature-tours/$ARGUMENTS.md
    ## Files (sorted by importance)
    ## Data flow
    ## Key business rules (từ tests)
    ## Known issues / tech debt
    ## How to test manually
    Daily standup automation — /standup
    # .claude/commands/standup.md
    Generate standup report.
    
    1. git log --since="yesterday 18:00" --oneline --author="$(git config user.name)"
    2. TodoRead — current task list
    3. Tổng hợp:
    
    **STANDUP — [hôm nay]**
    ✅ DONE: [từ git log — nhóm theo feature]
    🔄 IN PROGRESS: [từ todo — đang làm]
    ⏭️ NEXT: [từ todo — chưa bắt đầu]
    ⚠️ BLOCKERS: [task nào stale > 2 ngày?]
    
    # Gọi mỗi sáng: /standup → copy paste Slack trong 30 giây
    Namespace commands — tổ chức theo role
    .claude/commands/
    ├── dev/feature.md     # /dev:feature
    ├── dev/fix.md         # /dev:fix
    ├── qa/testcase.md     # /qa:testcase
    ├── qa/bugreport.md    # /qa:bugreport
    ├── ba/analyze.md      # /ba:analyze
    ├── docs/proposal.md   # /docs:proposal
    ├── docs/minutes.md    # /docs:minutes
    └── ops/deploy.md      # /ops:deploy
    Advanced · Feature A3
    Agent & Sub-agents — Claude quản lý Claude
    Agent mode là nơi Claude Code thực sự trở thành "engineer trong team": tự lập kế hoạch, spawn helpers, xử lý song song, tổng hợp kết quả. Powerful nhất và cũng dễ dùng sai nhất.
    PowerfulAutonomousUse with caution
    🤖 5 agent patterns thực chiến
    Core patterns
    Pattern 1: Large-scale migration không cần giám sát
    claude --dangerously-skip-permissions "
    MISSION: Migrate toàn project từ CommonJS sang ESM.
    STRATEGY:
    1. Inventory: tìm tất cả require() trong .js files
    2. Start từ leaf modules (không có dependencies)
    3. Convert từng file: require→import, module.exports→export
    4. Sau mỗi 10 files: npm run typecheck → nếu fail, fix trước
    5. Commit sau mỗi module group hoàn chỉnh
    DONE CRITERIA: typecheck && npm test đều pass
    LOG: progress vào .claude/migration-log.md"
    Pattern 2: Parallel sub-agents — divide and conquer
    claude "Implement notification system. Spawn 3 sub-agents parallel:
    
    SUB-AGENT 1 — Backend:
      src/services/notification.ts + src/routes/notification.ts
      Output: Working API + unit tests
    
    SUB-AGENT 2 — Queue Worker:
      src/workers/notification.worker.ts
      Channels: email (SendGrid), push (Firebase), in-app
      Output: Worker + retry logic
    
    SUB-AGENT 3 — Frontend:
      src/client/components/Notifications/
      Output: React components + Storybook
    
    ORCHESTRATOR:
      - Monitor qua TodoRead
      - Integration test sau khi tất cả xong
      - Resolve shared interface conflicts
      - Final: npm run build && npm test phải pass"
    Pattern 3: Autonomous PR review pipeline
    claude --print "
    Phase 1: git diff main...HEAD > /tmp/pr-diff.txt
              npm run typecheck > /tmp/ts-errors.txt
              npm run lint > /tmp/lint-errors.txt
    
    Phase 2: Identify affected test files → run only those
    
    Phase 3: Review diff với: security, logic, performance, conventions
    
    Phase 4: Output pr-review.md:
      - Summary of changes
      - Blocking issues vs suggestions
      - Approval: APPROVE / REQUEST CHANGES / NEEDS DISCUSSION
    " | tee pr-review.md
    Pattern 4: Self-healing codebase (cron job)
    claude --print --dangerously-skip-permissions "
    HEALTH CHECK daily:
    1. npm run typecheck → fix errors, commit
    2. npm run lint → auto-fix, commit
    3. npm audit → patch CRITICAL deps, test
    4. Dead code (ts-prune) → remove + test
    Commit: 'chore: automated health check [date]'
    Summary → health-report.txt"
    Agent safety matrix
    ✅ An toàn
    • Branch riêng (feature/, fix/)
    • Có git để rollback
    • Permissions giới hạn qua settings.json
    • Không production credentials
    • Task có automated tests verify
    ❌ Không dùng
    • Main/production branch
    • Có production credentials trong env
    • Task ambiguous, không có done criteria
    • Security-critical code (auth, payment)
    Advanced · Feature A4
    MCP Servers — Claude kết nối toàn bộ hệ sinh thái
    MCP (Model Context Protocol) là cầu nối giữa Claude và external tools. Thay vì copy-paste data vào prompt, Claude trực tiếp query và action trên GitHub, Jira, Slack, DB, Figma...
    Ecosystem integrationZero copy-pasteDirect action
    🔌 Setup MCP + 4 kịch bản thực chiến
    Setup + use cases
    // ~/.claude/settings.json
    {
      "mcpServers": {
        "github": {
          "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"],
          "env": { "GITHUB_TOKEN": "ghp_YOUR_TOKEN" }
        },
        "postgres": {
          "command": "npx", "args": ["-y", "@modelcontextprotocol/server-postgres"],
          "env": { "DATABASE_URL": "postgresql://readonly:pwd@localhost/db" }
        },
        "slack": {
          "command": "npx", "args": ["-y", "@modelcontextprotocol/server-slack"],
          "env": { "SLACK_BOT_TOKEN": "xoxb-..." }
        }
      }
    }
    Postgres MCP: LUÔN dùng read-only user. Không để Claude có thể DROP TABLE production.
    Kịch bản 1: GitHub — từ issue đến merged PR
    claude "GitHub workflow tự động:
    1. Đọc issue #234 đầy đủ
    2. Implement feature theo requirements
    3. Tạo PR: title 'feat(#234): ...' + description + Closes #234
    4. Label: 'ready-for-review', assign reviewers
    5. Notify Slack #dev-team"
    Kịch bản 2: Postgres — debug data issue không cần DBA
    claude "User id=12345 báo không thấy orders tháng trước.
    Investigate với Postgres MCP (read-only):
    1. Check user exists + account status
    2. Query orders trong khoảng thời gian
    3. Check audit_logs xem có delete không
    4. Check soft-deleted orders (deleted_at IS NOT NULL)
    Root cause + data recovery script nếu cần"
    Kịch bản 3: Build custom MCP cho Redmine của VAIX
    claude "Tạo custom MCP server kết nối Redmine nội bộ VAIX.
    
    Tools cần expose:
    1. list_issues(project_id, status?, priority?) → issues[]
    2. get_issue(id) → full detail
    3. create_issue(project, subject, description, priority, assignee)
    4. update_issue(id, status?, note?)
    
    Tech: TypeScript + @modelcontextprotocol/sdk
    Output: src/ + README + Dockerfile
    Test: npx @modelcontextprotocol/inspector node dist/index.js"
    Advanced · Feature A5 — Expert
    Hooks & Automation Pipeline — Claude nhúng vào mọi quy trình
    Claude Code Hooks chạy code tự động tại lifecycle events: trước/sau tool call, session start/end. Đây là cách build "AI-native workflows" thực sự — không cần bạn trigger thủ công.
    ExpertZero-touchCI/CD native
    🪝 3 hooks thiết thực — auto-lint, safety guard, session log
    Production-ready
    // .claude/settings.json — hooks config
    {
      "hooks": {
        "PostToolUse": [{
          "matcher": "Write",
          "hooks": [{ "type": "command", "command": "bash .claude/hooks/post-write.sh" }]
        }],
        "PreToolUse": [{
          "matcher": "Bash",
          "hooks": [{ "type": "command", "command": "bash .claude/hooks/pre-bash.sh" }]
        }],
        "Stop": [{ "hooks": [{ "type": "command", "command": "bash .claude/hooks/session-end.sh" }] }]
      }
    }
    Hook 1: Auto-lint sau mỗi file Claude ghi
    #!/bin/bash
    # .claude/hooks/post-write.sh
    WRITTEN_FILE="$CLAUDE_TOOL_INPUT_PATH"
    if [[ "$WRITTEN_FILE" == *.ts || "$WRITTEN_FILE" == *.tsx ]]; then
      npx eslint "$WRITTEN_FILE" --fix --quiet 2>&1
      [ $? -ne 0 ] && echo "LINT_ERROR: $WRITTEN_FILE" >> .claude/lint-issues.log
    fi
    Hook 2: Safety guard — chặn commands nguy hiểm
    #!/bin/bash
    # .claude/hooks/pre-bash.sh
    CMD="$CLAUDE_TOOL_INPUT_COMMAND"
    BLOCKED=("rm -rf" "DROP TABLE" "DROP DATABASE" "git push --force" "chmod 777")
    for p in "${BLOCKED[@]}"; do
      if echo "$CMD" | grep -qi "$p"; then
        echo "BLOCKED: '$p' in command. Confirm manually."
        exit 1  # exit 1 = Claude bị block
      fi
    done
    exit 0  # exit 0 = allow
    Hook 3: Auto session log khi Claude kết thúc
    #!/bin/bash
    # .claude/hooks/session-end.sh
    FILES_CHANGED=$(git diff --name-only HEAD 2>/dev/null | wc -l)
    cat >> .claude/session-history.md << EOF
    
    ## $(date +"%Y-%m-%d %H:%M")
    Files changed: $FILES_CHANGED
    $(git diff --name-only HEAD 2>/dev/null)
    ---
    EOF
    🏭 4 kịch bản automation nâng cao — thinking outside the box
    Creative use cases
    Kịch bản 1: Full pipeline Jira → Code → Deployed
    Jira assigned
    Claude reads
    Auto branch
    Agent implements
    Hooks: lint/test
    PR created
    Review + merge
    #!/bin/bash
    # auto-implement.sh
    TICKET="$1"  # DEV-1234
    git checkout -b "feature/$TICKET" main
    claude --dangerously-skip-permissions --print "
      MCP Jira: đọc ticket $TICKET.
      Implement theo requirements.
      Chạy npm test phải pass.
      Commit: feat($TICKET): [title từ ticket]"
    git push origin "feature/$TICKET"
    gh pr create --title "feat($TICKET): ..." --body "Closes $TICKET"
    claude --print "MCP Jira: update $TICKET → 'In Review'"
    Kịch bản 2: Living documentation — docs tự cập nhật
    # .claude/commands/sync-docs.md — chạy weekly
    Sync documentation với code hiện tại.
    
    1. So sánh docs/api-reference.md với routes trong src/routes/:
       - Endpoints có trong docs nhưng không còn trong code → remove
       - Endpoints trong code chưa có trong docs → add
       - Response schema đã thay đổi → update
    
    2. Tương tự cho:
       docs/env-vars.md ↔ src/lib/config.ts
       docs/db-schema.md ↔ prisma/schema.prisma
       docs/business-rules.md ↔ src/services/
    
    3. Tạo PR: 'docs: sync with codebase [date]'
    
    # Result: docs luôn accurate, không bao giờ outdated
    Kịch bản 3: AI-powered incident postmortem
    claude "Incident postmortem cho sự cố hôm qua.
    
    Data: Sentry logs + deployment timeline + git log trong window
    
    Tạo postmortem SRE-standard:
    
    # Incident Postmortem: [tên]
    Severity: P1 | Duration: X giờ | Affected: [users]
    
    ## Timeline [reconstruct từ logs]
    ## Root Cause (5 Whys)
    ## Contributing Factors
    ## What Went Well [detection nhanh? rollback smooth?]
    ## Action Items: | Action | Owner | Due |
    ## Lessons Learned"
    Kịch bản 4: Auto changelog từ git log
    git log v2.2.0...HEAD --pretty=format:"%s|%an|%ad" --date=short | claude --print "
    Tổng hợp CHANGELOG.md entry:
    ## [2.3.0] - $(date +%Y-%m-%d)
    
    ### Added [feat: commits]
    ### Changed [refactor: commits quan trọng]
    ### Fixed [fix: commits]
    ### Security [security: commits]
    
    Loại bỏ: chore, docs, style.
    Viết business-friendly, không phải raw commit messages."