Claude Gateway Onboarding

Thiết lập Claude Code cho Developer và BA

Kết nối qua gateway, cài bộ tối ưu token, kiểm tra khả năng đọc code/tài liệu, và dùng session history để tiếp tục công việc.

Gateway URL

https://claude.gateway.delfi.vn

Token cá nhân

Thay bằng token sk-gw do admin cấp.

Tiết kiệm token

RTK giảm tool output, Caveman giảm output trả lời.

Session history

Xem lại chat và copy prompt tiếp tục tại /sessions.

Bắt đầu nhanh

Dùng phần này cho máy đã có Claude Code. Chọn một trong hai cách cấu hình gateway.

1Nhận token

Admin cấp token dạng sk-gw-....

2Cấu hình gateway

Set env hoặc sửa ~/.claude/settings.json.

3Cài tối ưu

RTK, CodeGraph, Caveman theo nhu cầu.

4Kiểm tra logs

So sánh In/Out/Cache trên Gateway dashboard.

Windows PowerShell environment
# PowerShell
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://claude.gateway.delfi.vn", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-gw-token-cua-ban", "User")

# Close all PowerShell/CMD/Windows Terminal/VS Code windows, then open a new terminal.
$env:ANTHROPIC_BASE_URL
$env:ANTHROPIC_AUTH_TOKEN
claude
macOS/Linux shell environment
export ANTHROPIC_BASE_URL="https://claude.gateway.delfi.vn"
export ANTHROPIC_AUTH_TOKEN="sk-gw-token-cua-ban"

curl -s https://claude.gateway.delfi.vn/health
claude --model claude-sonnet-4-6
~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://claude.gateway.delfi.vn",
    "ANTHROPIC_AUTH_TOKEN": "sk-gw-token-cua-ban"
  }
}

Trên Windows, ưu tiên biến môi trường User. Nếu dùng file cấu hình, đặt tại C:\Users\<ten>\.claude\settings.json. Sau khi đổi cấu hình, đóng toàn bộ terminal/VS Code rồi mở lại.

Công cụ cần cài

CodeGraphĐọc cấu trúc code nhanh hơn

Phù hợp khi hỏi kiến trúc, impact, class/function liên quan.

RTKGiảm tool-output tokens

Hook vào Bash tool. Dùng tốt với git, rg, test logs, file read.

CavemanGiảm output tokens

Ép câu trả lời ngắn hơn. Không giảm input/context/cache.

Windows native setup
# PowerShell: install prerequisites for native Windows
winget install --id Git.Git -e
winget install --id OpenJS.NodeJS.LTS -e

# Tell Claude Code where Git Bash is, then restart terminal / VS Code
[Environment]::SetEnvironmentVariable("CLAUDE_CODE_GIT_BASH_PATH", "C:\Program Files\Git\bin\bash.exe", "User")

# Git Bash: install CodeGraph
curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
codegraph install
cd <project>
codegraph init

# Git Bash: install RTK
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
export PATH="$HOME/.local/bin:$PATH"
rtk --version
rtk init -g
rtk gain

# PowerShell or Git Bash: install Caveman plugin
claude plugin marketplace add JuliusBrussee/caveman
claude plugin install caveman@caveman
macOS/Linux - CodeGraph setup
curl -fsSL https://raw.githubusercontent.com/colbymchenry/codegraph/main/install.sh | sh
codegraph install
cd <project>
codegraph init
macOS/Linux - RTK setup
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"
rtk --version
rtk init -g
rtk gain
macOS/Linux - Caveman setup
node -v
claude plugin marketplace add JuliusBrussee/caveman
claude plugin install caveman@caveman

# Fallback installer if plugin install fails
curl -fsSL https://raw.githubusercontent.com/JuliusBrussee/caveman/main/install.sh | bash

Trên Windows native, hãy cài Git for Windows để Claude Code dùng Bash tool; RTK hook tốt nhất khi command chạy qua Bash. Nếu Claude Code đang dùng PowerShell tool, yêu cầu dùng Bash + RTK hoặc chạy trong Git Bash/WSL.

Workflow cho Developer

Mục tiêu là đọc code có kiểm soát: hỏi cấu trúc trước, đọc file sau, chạy command qua RTK khi output có thể dài.

Windows - kiểm tra RTK trong project
# Git Bash inside your project
cd /c/path/to/project
rtk git status
rtk grep "Route::" .
rtk read routes/web.php

# In Claude Code prompt:
Dung Bash + RTK de inspect repo. Chay git status, tim "Route::" va doc routes/web.php bang rtk. Tra loi ngan: cac route chinh la gi?
Kiểm tra RTK trong project
cd <project>
rtk git status
rtk grep "Route::" .
rtk read routes/web.php
Prompt inspect repo

Dùng khi bắt đầu task trong repo mới hoặc module lạ.

Prompt
Dung CodeGraph va Bash + RTK truoc. Khong dung Read/Grep built-in neu khong can.
Hay inspect repo nay: chay rtk git status, rtk grep "Route::" . va rtk read routes/web.php.
Tra loi ngan: app nay co cac module chinh nao?
Prompt sửa lỗi

Giữ phạm vi hẹp, bắt Claude đọc đúng file và chạy test cần thiết.

Prompt
Dung CodeGraph de tim code lien quan truoc. Sau do dung Bash + RTK de doc file/log can thiet. Sua dung pham vi loi, chay test nho nhat co the, bao ro file da doi.

Workflow cho BA

BA không cần đọc toàn bộ source. Hãy yêu cầu Claude chuyển code/tài liệu thành actor, luồng nghiệp vụ, dữ liệu và màn hình liên quan.

Prompt phân tích nghiệp vụ
Prompt BA
Doc repo va tai lieu hien co. Giai thich bang ngon ngu BA:
- Cac actor chinh
- Luong nghiep vu quan trong
- Du lieu nao duoc tao/sua/xoa
- Man hinh nao lien quan
Tra loi ngan, co bullet ro rang.
Prompt tạo checklist UAT
Prompt UAT
Tu repo va tai lieu hien co, tao checklist UAT cho module dang xet. Nhom theo happy path, validation, permission, edge cases. Ghi ro du lieu test can tao.
Nhu cầuPrompt nên dùngKết quả mong đợi
Hiểu moduleBA workflow promptActor, luồng, dữ liệu, màn hình
Review featureChecklist UATTest cases theo nhóm
Viết tài liệuYêu cầu output dạng markdown/tableTài liệu dễ gửi team

Test so sánh token

Chạy cùng một câu hỏi trước/sau khi bật RTK hoặc Caveman, sau đó xem Gateway Web GUI phần logs để so sánh IN, OUT, CW, CR.

Prompt so sánh Caveman
Lan 1 khong Caveman:
Giai thich module lease/rental cua repo nay, noi ro model, route, component lien quan.

Lan 2 co Caveman:
/caveman lite
Giai thich module lease/rental cua repo nay, noi ro model, route, component lien quan.

Sau do xem Gateway logs de so sanh OUT tokens.
RTK giảm phần nào?

Giảm input do tool output dài được compact trước khi đưa vào context.

Caveman giảm phần nào?

Giảm output do Claude trả lời ngắn hơn. Không xử lý cache/context lớn.

Lỗi thường gặp

LỗiNguyên nhânCách xử lý
401 authentication_errorToken sai hoặc user bị khóaKiểm tra ANTHROPIC_AUTH_TOKEN, liên hệ admin
403 model not allowedModel ngoài danh sách gateway cho phépDùng claude --model claude-sonnet-4-6 hoặc đổi model trong /model
/caveman không cóPlugin chưa loadRestart Claude Code/VS Code, cài lại plugin nếu cần
Token lớn nhưng cost thấpCache-read/context lớnXem cột Cache. Gateway mặc định không chặn quota bằng cache-read.