docs(vi): sync Vietnamese documentation with English source (#60)
- Fix untranslated terms in CODE_OF_CONDUCT (witness, criticism, feedback, stalking) - Remove Arabic text accidentally left in Retaliation section - Add missing Scope content to CODE_OF_CONDUCT - Add Vietnamese footers to all module READMEs - Translate footers: Last Updated → Cập Nhật Lần Cuối, Compatible Models → Các Mô Hình Tương Thích - Add missing Vietnamese files: CLAUDE.md, LICENSE, RELEASE_NOTES.md, clean-code-rules.md, resources.md - Add missing images: pr-slash-command.png, memory-*.png, claude-howto-logo.png - Fix CODE_OF_CONDUCT closing message to Vietnamese
This commit is contained in:
@@ -131,7 +131,7 @@ claude -p --model opus --fallback-model sonnet "analyze architecture"
|
||||
claude --model opusplan "design and implement the caching layer"
|
||||
```
|
||||
|
||||
## Tùy Chọn System Prompt / System Prompt Customization
|
||||
## Tùy Chỉnh System Prompt / System Prompt Customization
|
||||
|
||||
| Cờ | Mô Tả | Ví Dụ |
|
||||
|------|-------------|---------|
|
||||
@@ -139,6 +139,29 @@ claude --model opusplan "design and implement the caching layer"
|
||||
| `--system-prompt-file` | Tải prompt từ file (chế độ in) | `claude -p --system-prompt-file ./prompt.txt "query"` |
|
||||
| `--append-system-prompt` | Append vào prompt mặc định | `claude --append-system-prompt "Always use TypeScript"` |
|
||||
|
||||
### Ví Dụ System Prompt / System Prompt Examples
|
||||
|
||||
```bash
|
||||
# Complete custom persona
|
||||
claude --system-prompt "You are a senior security engineer. Focus on vulnerabilities."
|
||||
|
||||
# Append specific instructions
|
||||
claude --append-system-prompt "Always include unit tests with code examples"
|
||||
|
||||
# Load complex prompt from file
|
||||
claude -p --system-prompt-file ./prompts/code-reviewer.txt "review main.py"
|
||||
```
|
||||
|
||||
### So Sánh Các Cờ System Prompt / System Prompt Flags Comparison
|
||||
|
||||
| Cờ | Hành Vi | Interactive | Print |
|
||||
|------|----------|-------------|-------|
|
||||
| `--system-prompt` | Thay thế toàn bộ system prompt | ✅ | ✅ |
|
||||
| `--system-prompt-file` | Thay thế bằng prompt từ file | ❌ | ✅ |
|
||||
| `--append-system-prompt` | Thêm vào system prompt mặc định | ✅ | ✅ |
|
||||
|
||||
**Chỉ sử dụng `--system-prompt-file` trong chế độ in. Trong chế độ tương tác, sử dụng `--system-prompt` hoặc `--append-system-prompt`.**
|
||||
|
||||
## Công Cụ & Quản Lý Quyền / Tool & Permission Management
|
||||
|
||||
| Cờ | Mô Tả | Ví Dụ |
|
||||
@@ -175,10 +198,641 @@ claude --disallowedTools "Bash(rm -rf:*)" "Bash(git push --force:*)"
|
||||
| `--input-format` | Chỉ định định dạng đầu vào (chế độ in) | `text`, `stream-json` | `claude -p --input-format stream-json` |
|
||||
| `--verbose` | Bật ghi nhật chi tiết | | `claude --verbose` |
|
||||
| `--include-partial-messages` | Bao gồm các sự kiện streaming | Yêu cầu `stream-json` | `claude -p --output-format stream-json --include-partial-messages "query"` |
|
||||
| `--json-schema` | Nhận JSON được validate theo schema | | `claude -p --json-schema '{"type":"object"}' "query"` |
|
||||
| `--max-budget-usd` | Giới hạn chi phí tối đa cho chế độ in | | `claude -p --max-budget-usd 5.00 "query"` |
|
||||
|
||||
### Ví Dụ Định Dạng Đầu Ra / Output Format Examples
|
||||
|
||||
```bash
|
||||
# Plain text (mặc định)
|
||||
claude -p "explain this code"
|
||||
|
||||
# JSON cho sử dụng lập trình
|
||||
claude -p --output-format json "list all functions in main.py"
|
||||
|
||||
# Streaming JSON để xử lý real-time
|
||||
claude -p --output-format stream-json "generate a long report"
|
||||
|
||||
# Structured output với schema validation
|
||||
claude -p --json-schema '{"type":"object","properties":{"bugs":{"type":"array"}}}' \
|
||||
"find bugs in this code and return as JSON"
|
||||
```
|
||||
|
||||
## Workspace & Thư Mục / Workspace & Directory
|
||||
|
||||
| Cờ | Mô Tả | Ví Dụ |
|
||||
|------|-------------|---------|
|
||||
| `--add-dir` | Thêm thư mục làm việc bổ sung | `claude --add-dir ../apps ../lib` |
|
||||
| `--setting-sources` | Nguồn cài đặt phân cách bằng dấu phẩy | `claude --setting-sources user,project` |
|
||||
| `--settings` | Tải cài đặt từ file hoặc JSON | `claude --settings ./settings.json` |
|
||||
| `--plugin-dir` | Tải plugins từ thư mục (có thể lặp lại) | `claude --plugin-dir ./my-plugin` |
|
||||
|
||||
### Ví Dụ Đa Thư Mục / Multi-Directory Example
|
||||
|
||||
```bash
|
||||
# Làm việc trên nhiều thư mục project
|
||||
claude --add-dir ../frontend ../backend ../shared "find all API endpoints"
|
||||
|
||||
# Tải custom settings
|
||||
claude --settings '{"model":"opus","verbose":true}' "complex task"
|
||||
```
|
||||
|
||||
## Cấu Hình MCP / MCP Configuration
|
||||
|
||||
| Cờ | Mô Tả | Ví Dụ |
|
||||
|------|-------------|---------|
|
||||
| `--mcp-config` | Tải MCP servers từ JSON | `claude --mcp-config ./mcp.json` |
|
||||
| `--strict-mcp-config` | Chỉ sử dụng MCP config được chỉ định | `claude --strict-mcp-config --mcp-config ./mcp.json` |
|
||||
| `--channels` | Đăng ký các plugin kênh MCP | `claude --channels discord,telegram` |
|
||||
|
||||
### Ví Dụ MCP / MCP Examples
|
||||
|
||||
```bash
|
||||
# Tải GitHub MCP server
|
||||
claude --mcp-config ./github-mcp.json "list open PRs"
|
||||
|
||||
# Strict mode - chỉ servers được chỉ định
|
||||
claude --strict-mcp-config --mcp-config ./production-mcp.json "deploy to staging"
|
||||
```
|
||||
|
||||
## Quản Lý Session / Session Management
|
||||
|
||||
| Cờ | Mô Tả | Ví Dụ |
|
||||
|------|-------------|---------|
|
||||
| `--session-id` | Sử dụng session ID cụ thể (UUID) | `claude --session-id "550e8400-..."` |
|
||||
| `--fork-session` | Tạo session mới khi resume | `claude --resume abc123 --fork-session` |
|
||||
|
||||
### Ví Dụ Session / Session Examples
|
||||
|
||||
```bash
|
||||
# Tiếp tục hội thoại cuối
|
||||
claude -c
|
||||
|
||||
# Resume named session
|
||||
claude -r "feature-auth" "continue implementing login"
|
||||
|
||||
# Fork session để thử nghiệm
|
||||
claude --resume feature-auth --fork-session "try alternative approach"
|
||||
|
||||
# Sử dụng specific session ID
|
||||
claude --session-id "550e8400-e29b-41d4-a716-446655440000" "continue"
|
||||
```
|
||||
|
||||
### Session Fork
|
||||
|
||||
Tạo một nhánh từ session hiện có để thử nghiệm:
|
||||
|
||||
```bash
|
||||
# Fork một session để thử cách tiếp cận khác
|
||||
claude --resume abc123 --fork-session "try alternative implementation"
|
||||
|
||||
# Fork với custom message
|
||||
claude -r "feature-auth" --fork-session "test with different architecture"
|
||||
```
|
||||
|
||||
**Trường Hợp Sử Dụng:**
|
||||
- Thử các implementation khác mà không mất session gốc
|
||||
- Thử nghiệm với các cách tiếp cận khác nhau song song
|
||||
- Tạo các nhánh từ công việc thành công cho các biến thể
|
||||
- Test các thay đổi breaking mà không ảnh hưởng đến main session
|
||||
|
||||
Session gốc vẫn không thay đổi, và fork trở thành một session độc lập mới.
|
||||
|
||||
## Tính Năng Nâng Cao / Advanced Features
|
||||
|
||||
| Cờ | Mô Tả | Ví Dụ |
|
||||
|------|-------------|---------|
|
||||
| `--chrome` | Bật tích hợp trình duyệt Chrome | `claude --chrome` |
|
||||
| `--no-chrome` | Tắt tích hợp trình duyệt Chrome | `claude --no-chrome` |
|
||||
| `--ide` | Tự động kết nối đến IDE nếu có | `claude --ide` |
|
||||
| `--max-turns` | Giới hạn agentic turns (non-interactive) | `claude -p --max-turns 3 "query"` |
|
||||
| `--debug` | Bật debug mode với filtering | `claude --debug "api,mcp"` |
|
||||
| `--enable-lsp-logging` | Bật verbose LSP logging | `claude --enable-lsp-logging` |
|
||||
| `--betas` | Beta headers cho API requests | `claude --betas interleaved-thinking` |
|
||||
| `--plugin-dir` | Tải plugins từ thư mục (có thể lặp lại) | `claude --plugin-dir ./my-plugin` |
|
||||
| `--enable-auto-mode` | Mở khóa chế độ quyền tự động | `claude --enable-auto-mode` |
|
||||
| `--effort` | Đặt mức độ suy nghĩ | `claude --effort high` |
|
||||
| `--bare` | Chế độ tối thiểu (bỏ qua hooks, skills, plugins, MCP, auto memory, CLAUDE.md) | `claude --bare` |
|
||||
| `--channels` | Đăng ký các plugin kênh MCP | `claude --channels discord` |
|
||||
| `--tmux` | Tạo tmux session cho worktree | `claude --tmux` |
|
||||
| `--fork-session` | Tạo session ID mới khi resume | `claude --resume abc --fork-session` |
|
||||
| `--max-budget-usd` | Chi phí tối đa (chế độ in) | `claude -p --max-budget-usd 5.00 "query"` |
|
||||
| `--json-schema` | Validate JSON output | `claude -p --json-schema '{"type":"object"}' "q"` |
|
||||
|
||||
### Ví Dụ Nâng Cao / Advanced Examples
|
||||
|
||||
```bash
|
||||
# Giới hạn autonomous actions
|
||||
claude -p --max-turns 5 "refactor this module"
|
||||
|
||||
# Debug API calls
|
||||
claude --debug "api" "test query"
|
||||
|
||||
# Bật IDE integration
|
||||
claude --ide "help me with this file"
|
||||
```
|
||||
|
||||
## Cấu Hình Agents / Agents Configuration
|
||||
|
||||
Cờ `--agents` chấp nhận một JSON object định nghĩa custom subagents cho một session.
|
||||
|
||||
### Agents JSON Format
|
||||
|
||||
```json
|
||||
{
|
||||
"agent-name": {
|
||||
"description": "Required: when to invoke this agent",
|
||||
"prompt": "Required: system prompt for the agent",
|
||||
"tools": ["Optional", "array", "of", "tools"],
|
||||
"model": "optional: sonnet|opus|haiku"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Các Trường Bắt Buộc:**
|
||||
- `description` - Mô tả tự nhiên khi nào sử dụng agent này
|
||||
- `prompt` - System prompt định nghĩa role và hành vi của agent
|
||||
|
||||
**Các Trường Tùy Chọn:**
|
||||
- `tools` - Array của available tools (kế thừa tất cả nếu omit)
|
||||
- Format: `["Read", "Grep", "Glob", "Bash"]`
|
||||
- `model` - Model sử dụng: `sonnet`, `opus`, hoặc `haiku`
|
||||
|
||||
### Complete Agents Example
|
||||
|
||||
```json
|
||||
{
|
||||
"code-reviewer": {
|
||||
"description": "Expert code reviewer. Use proactively after code changes.",
|
||||
"prompt": "You are a senior code reviewer. Focus on code quality, security, and best practices.",
|
||||
"tools": ["Read", "Grep", "Glob", "Bash"],
|
||||
"model": "sonnet"
|
||||
},
|
||||
"debugger": {
|
||||
"description": "Debugging specialist for errors and test failures.",
|
||||
"prompt": "You are an expert debugger. Analyze errors, identify root causes, and provide fixes.",
|
||||
"tools": ["Read", "Edit", "Bash", "Grep"],
|
||||
"model": "opus"
|
||||
},
|
||||
"documenter": {
|
||||
"description": "Documentation specialist for generating guides.",
|
||||
"prompt": "You are a technical writer. Create clear, comprehensive documentation.",
|
||||
"tools": ["Read", "Write"],
|
||||
"model": "haiku"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Ví Dụ Lệnh Agents / Agents Command Examples
|
||||
|
||||
```bash
|
||||
# Define custom agents inline
|
||||
claude --agents '{
|
||||
"security-auditor": {
|
||||
"description": "Security specialist for vulnerability analysis",
|
||||
"prompt": "You are a security expert. Find vulnerabilities and suggest fixes.",
|
||||
"tools": ["Read", "Grep", "Glob"],
|
||||
"model": "opus"
|
||||
}
|
||||
}' "audit this codebase for security issues"
|
||||
|
||||
# Load agents from file
|
||||
claude --agents "$(cat ~/.claude/agents.json)" "review the auth module"
|
||||
|
||||
# Combine with other flags
|
||||
claude -p --agents "$(cat agents.json)" --model sonnet "analyze performance"
|
||||
```
|
||||
|
||||
### Agent Priority
|
||||
|
||||
Khi nhiều agent definitions tồn tại, chúng được load theo thứ tự ưu tiên này:
|
||||
1. **CLI-defined** (`--agents` flag) - Session-specific
|
||||
2. **User-level** (`~/.claude/agents/`) - All projects
|
||||
3. **Project-level** (`.claude/agents/`) - Current project
|
||||
|
||||
CLI-defined agents override cả user và project agents cho session.
|
||||
|
||||
---
|
||||
|
||||
## Các Trường Hợp Sử Dụng Giá Trị Cao / High-Value Use Cases
|
||||
|
||||
### 1. Tích Hợp CI/CD
|
||||
|
||||
Sử dụng Claude Code trong CI/CD pipelines để tự động review code, testing, và documentation.
|
||||
|
||||
**GitHub Actions Example:**
|
||||
|
||||
```yaml
|
||||
name: AI Code Review
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Claude Code
|
||||
run: npm install -g @anthropic-ai/claude-code
|
||||
|
||||
- name: Run Code Review
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
run: |
|
||||
claude -p --output-format json \
|
||||
--max-turns 1 \
|
||||
"Review the changes in this PR for:
|
||||
- Security vulnerabilities
|
||||
- Performance issues
|
||||
- Code quality
|
||||
Output as JSON with 'issues' array" > review.json
|
||||
|
||||
- name: Post Review Comment
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const review = JSON.parse(fs.readFileSync('review.json', 'utf8'));
|
||||
// Process and post review comments
|
||||
```
|
||||
|
||||
**Jenkins Pipeline:**
|
||||
|
||||
```groovy
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('AI Review') {
|
||||
steps {
|
||||
sh '''
|
||||
claude -p --output-format json \
|
||||
--max-turns 3 \
|
||||
"Analyze test coverage and suggest missing tests" \
|
||||
> coverage-analysis.json
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Script Piping
|
||||
|
||||
Xử lý files, logs, và data thông qua Claude để phân tích.
|
||||
|
||||
**Phân Tích Log:**
|
||||
|
||||
```bash
|
||||
# Analyze error logs
|
||||
tail -1000 /var/log/app/error.log | claude -p "summarize these errors and suggest fixes"
|
||||
|
||||
# Find patterns in access logs
|
||||
cat access.log | claude -p "identify suspicious access patterns"
|
||||
|
||||
# Analyze git history
|
||||
git log --oneline -50 | claude -p "summarize recent development activity"
|
||||
```
|
||||
|
||||
**Xử Lý Code:**
|
||||
|
||||
```bash
|
||||
# Review a specific file
|
||||
cat src/auth.ts | claude -p "review this authentication code for security issues"
|
||||
|
||||
# Generate documentation
|
||||
cat src/api/*.ts | claude -p "generate API documentation in markdown"
|
||||
|
||||
# Find TODOs and prioritize
|
||||
grep -r "TODO" src/ | claude -p "prioritize these TODOs by importance"
|
||||
```
|
||||
|
||||
### 3. Multi-Session Workflows
|
||||
|
||||
Quản lý các project phức tạp với nhiều conversation threads.
|
||||
|
||||
```bash
|
||||
# Start a feature branch session
|
||||
claude -r "feature-auth" "let's implement user authentication"
|
||||
|
||||
# Later, continue the session
|
||||
claude -r "feature-auth" "add password reset functionality"
|
||||
|
||||
# Fork to try an alternative approach
|
||||
claude --resume feature-auth --fork-session "try OAuth instead"
|
||||
|
||||
# Switch between different feature sessions
|
||||
claude -r "feature-payments" "continue with Stripe integration"
|
||||
```
|
||||
|
||||
### 4. Custom Agent Configuration
|
||||
|
||||
Định nghĩa specialized agents cho workflows của team bạn.
|
||||
|
||||
```bash
|
||||
# Save agents config to file
|
||||
cat > ~/.claude/agents.json << 'EOF'
|
||||
{
|
||||
"reviewer": {
|
||||
"description": "Code reviewer for PR reviews",
|
||||
"prompt": "Review code for quality, security, and maintainability.",
|
||||
"model": "opus"
|
||||
},
|
||||
"documenter": {
|
||||
"description": "Documentation specialist",
|
||||
"prompt": "Generate clear, comprehensive documentation.",
|
||||
"model": "sonnet"
|
||||
},
|
||||
"refactorer": {
|
||||
"description": "Code refactoring expert",
|
||||
"prompt": "Suggest and implement clean code refactoring.",
|
||||
"tools": ["Read", "Edit", "Glob"]
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Use agents in session
|
||||
claude --agents "$(cat ~/.claude/agents.json)" "review the auth module"
|
||||
```
|
||||
|
||||
### 5. Batch Processing
|
||||
|
||||
Xử lý nhiều queries với settings nhất quán.
|
||||
|
||||
```bash
|
||||
# Process multiple files
|
||||
for file in src/*.ts; do
|
||||
echo "Processing $file..."
|
||||
claude -p --model haiku "summarize this file: $(cat $file)" >> summaries.md
|
||||
done
|
||||
|
||||
# Batch code review
|
||||
find src -name "*.py" -exec sh -c '
|
||||
echo "## $1" >> review.md
|
||||
cat "$1" | claude -p "brief code review" >> review.md
|
||||
' _ {} \;
|
||||
|
||||
# Generate tests for all modules
|
||||
for module in $(ls src/modules/); do
|
||||
claude -p "generate unit tests for src/modules/$module" > "tests/$module.test.ts"
|
||||
done
|
||||
```
|
||||
|
||||
### 6. Phát Triển Có Nhận Thức Bảo Mật
|
||||
|
||||
Sử dụng permission controls cho hoạt động an toàn.
|
||||
|
||||
```bash
|
||||
# Read-only security audit
|
||||
claude --permission-mode plan \
|
||||
--tools "Read,Grep,Glob" \
|
||||
"audit this codebase for security vulnerabilities"
|
||||
|
||||
# Block dangerous commands
|
||||
claude --disallowedTools "Bash(rm:*)" "Bash(curl:*)" "Bash(wget:*)" \
|
||||
"help me clean up this project"
|
||||
|
||||
# Restricted automation
|
||||
claude -p --max-turns 2 \
|
||||
--allowedTools "Read" "Glob" \
|
||||
"find all hardcoded credentials"
|
||||
```
|
||||
|
||||
### 7. JSON API Integration
|
||||
|
||||
Sử dụng Claude như một programmable API cho các công cụ của bạn với `jq` parsing.
|
||||
|
||||
```bash
|
||||
# Get structured analysis
|
||||
claude -p --output-format json \
|
||||
--json-schema '{"type":"object","properties":{"functions":{"type":"array"},"complexity":{"type":"string"}}}' \
|
||||
"analyze main.py and return function list with complexity rating"
|
||||
|
||||
# Integrate with jq for processing
|
||||
claude -p --output-format json "list all API endpoints" | jq '.endpoints[]'
|
||||
|
||||
# Use in scripts
|
||||
RESULT=$(claude -p --output-format json "is this code secure? answer with {secure: boolean, issues: []}" < code.py)
|
||||
if echo "$RESULT" | jq -e '.secure == false' > /dev/null; then
|
||||
echo "Security issues found!"
|
||||
echo "$RESULT" | jq '.issues[]'
|
||||
fi
|
||||
```
|
||||
|
||||
### Ví Dụ jq Parsing
|
||||
|
||||
Parse và xử lý JSON output của Claude bằng `jq`:
|
||||
|
||||
```bash
|
||||
# Extract specific fields
|
||||
claude -p --output-format json "analyze this code" | jq '.result'
|
||||
|
||||
# Filter array elements
|
||||
claude -p --output-format json "list issues" | jq -r '.issues[] | select(.severity=="high")'
|
||||
|
||||
# Extract multiple fields
|
||||
claude -p --output-format json "describe the project" | jq -r '.{name, version, description}'
|
||||
|
||||
# Convert to CSV
|
||||
claude -p --output-format json "list functions" | jq -r '.functions[] | [.name, .lineCount] | @csv'
|
||||
|
||||
# Conditional processing
|
||||
claude -p --output-format json "check security" | jq 'if .vulnerabilities | length > 0 then "UNSAFE" else "SAFE" end'
|
||||
|
||||
# Extract nested values
|
||||
claude -p --output-format json "analyze performance" | jq '.metrics.cpu.usage'
|
||||
|
||||
# Process entire array
|
||||
claude -p --output-format json "find todos" | jq '.todos | length'
|
||||
|
||||
# Transform output
|
||||
claude -p --output-format json "list improvements" | jq 'map({title: .title, priority: .priority})'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Các Mô Hình / Models
|
||||
|
||||
Claude Code hỗ trợ nhiều mô hình với các capabilities khác nhau:
|
||||
|
||||
| Mô Hình | ID | Context Window | Ghi Chú |
|
||||
|-------|-----|----------------|---------|
|
||||
| Opus 4.6 | `claude-opus-4-6` | 1M tokens | Most capable, adaptive effort levels |
|
||||
| Sonnet 4.6 | `claude-sonnet-4-6` | 1M tokens | Balanced speed and capability |
|
||||
| Haiku 4.5 | `claude-haiku-4-5` | 1M tokens | Fastest, best for quick tasks |
|
||||
|
||||
### Chọn Mô Hình / Model Selection
|
||||
|
||||
```bash
|
||||
# Use short names
|
||||
claude --model opus "complex architectural review"
|
||||
claude --model sonnet "implement this feature"
|
||||
claude --model haiku -p "format this JSON"
|
||||
|
||||
# Use opusplan alias (Opus plans, Sonnet executes)
|
||||
claude --model opusplan "design and implement the API"
|
||||
|
||||
# Toggle fast mode during session
|
||||
/fast
|
||||
```
|
||||
|
||||
### Effort Levels (Opus 4.6)
|
||||
|
||||
Opus 4.6 hỗ trợ adaptive reasoning với các effort levels:
|
||||
|
||||
```bash
|
||||
# Set effort level via CLI flag
|
||||
claude --effort high "complex review"
|
||||
|
||||
# Set effort level via slash command
|
||||
/effort high
|
||||
|
||||
# Set effort level via environment variable
|
||||
export CLAUDE_CODE_EFFORT_LEVEL=high # low, medium, high, or max (Opus 4.6 only)
|
||||
```
|
||||
|
||||
Từ khóa "ultrathink" trong prompts kích hoạt deep reasoning. Mức `max` effort chỉ dành cho Opus 4.6.
|
||||
|
||||
---
|
||||
|
||||
## Các Biến Môi Trường Quan Trọng / Key Environment Variables
|
||||
|
||||
| Biến | Mô Tả |
|
||||
|----------|-------------|
|
||||
| `ANTHROPIC_API_KEY` | API key cho authentication |
|
||||
| `ANTHROPIC_MODEL` | Override default model |
|
||||
| `ANTHROPIC_CUSTOM_MODEL_OPTION` | Custom model option for API |
|
||||
| `ANTHROPIC_DEFAULT_OPUS_MODEL` | Override default Opus model ID |
|
||||
| `ANTHROPIC_DEFAULT_SONNET_MODEL` | Override default Sonnet model ID |
|
||||
| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Override default Haiku model ID |
|
||||
| `MAX_THINKING_TOKENS` | Set extended thinking token budget |
|
||||
| `CLAUDE_CODE_EFFORT_LEVEL` | Set effort level (`low`/`medium`/`high`/`max`) |
|
||||
| `CLAUDE_CODE_SIMPLE` | Minimal mode, set by `--bare` flag |
|
||||
| `CLAUDE_CODE_DISABLE_AUTO_MEMORY` | Disable automatic CLAUDE.md updates |
|
||||
| `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS` | Disable background task execution |
|
||||
| `CLAUDE_CODE_DISABLE_CRON` | Disable scheduled/cron tasks |
|
||||
| `CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS` | Disable git-related instructions |
|
||||
| `CLAUDE_CODE_DISABLE_TERMINAL_TITLE` | Disable terminal title updates |
|
||||
| `CLAUDE_CODE_DISABLE_1M_CONTEXT` | Disable 1M token context window |
|
||||
| `CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK` | Disable non-streaming fallback |
|
||||
| `CLAUDE_CODE_ENABLE_TASKS` | Enable task list feature |
|
||||
| `CLAUDE_CODE_TASK_LIST_ID` | Named task directory shared across sessions |
|
||||
| `CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION` | Toggle prompt suggestions (`true`/`false`) |
|
||||
| `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` | Enable experimental agent teams |
|
||||
| `CLAUDE_CODE_NEW_INIT` | Use new initialization flow |
|
||||
| `CLAUDE_CODE_SUBAGENT_MODEL` | Model for subagent execution |
|
||||
| `CLAUDE_CODE_PLUGIN_SEED_DIR` | Directory for plugin seed files |
|
||||
| `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB` | Env vars to scrub from subprocesses |
|
||||
| `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE` | Override auto-compaction percentage |
|
||||
| `CLAUDE_STREAM_IDLE_TIMEOUT_MS` | Stream idle timeout in milliseconds |
|
||||
| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Character budget for slash command tools |
|
||||
| `ENABLE_TOOL_SEARCH` | Enable tool search capability |
|
||||
| `MAX_MCP_OUTPUT_TOKENS` | Maximum tokens for MCP tool output |
|
||||
|
||||
---
|
||||
|
||||
## Tham Chiếu Nhanh / Quick Reference
|
||||
|
||||
### Các Lệnh Phổ Biến Nhất
|
||||
|
||||
```bash
|
||||
# Interactive session
|
||||
claude
|
||||
|
||||
# Quick question
|
||||
claude -p "how do I..."
|
||||
|
||||
# Continue conversation
|
||||
claude -c
|
||||
|
||||
# Process a file
|
||||
cat file.py | claude -p "review this"
|
||||
|
||||
# JSON output for scripts
|
||||
claude -p --output-format json "query"
|
||||
```
|
||||
|
||||
### Kết Hợp Cờ / Flag Combinations
|
||||
|
||||
| Trường Hợp Sử Dụng | Lệnh |
|
||||
|----------|---------|
|
||||
| Quick code review | `cat file | claude -p "review"` |
|
||||
| Structured output | `claude -p --output-format json "query"` |
|
||||
| Safe exploration | `claude --permission-mode plan` |
|
||||
| Autonomous with safety | `claude --enable-auto-mode --permission-mode auto` |
|
||||
| CI/CD integration | `claude -p --max-turns 3 --output-format json` |
|
||||
| Resume work | `claude -r "session-name"` |
|
||||
| Custom model | `claude --model opus "complex task"` |
|
||||
| Minimal mode | `claude --bare "quick query"` |
|
||||
| Budget-capped run | `claude -p --max-budget-usd 2.00 "analyze code"` |
|
||||
|
||||
---
|
||||
|
||||
## Xử Lý Sự Cố / Troubleshooting
|
||||
|
||||
### Command Not Found
|
||||
|
||||
**Vấn đề:** `claude: command not found`
|
||||
|
||||
**Giải pháp:**
|
||||
- Cài đặt Claude Code: `npm install -g @anthropic-ai/claude-code`
|
||||
- Kiểm tra PATH bao gồm npm global bin directory
|
||||
- Thử chạy với full path: `npx claude`
|
||||
|
||||
### API Key Issues
|
||||
|
||||
**Vấn đề:** Authentication failed
|
||||
|
||||
**Giải pháp:**
|
||||
- Đặt API key: `export ANTHROPIC_API_KEY=your-key`
|
||||
- Kiểm tra key hợp lệ và có đủ credits
|
||||
- Xác minh key permissions cho model được yêu cầu
|
||||
|
||||
### Session Not Found
|
||||
|
||||
**Vấn đề:** Cannot resume session
|
||||
|
||||
**Giải pháp:**
|
||||
- Liệt kê các sessions có sẵn để tìm đúng tên/ID
|
||||
- Sessions có thể hết hạn sau một thời gian không hoạt động
|
||||
- Sử dụng `-c` để tiếp tục session gần nhất
|
||||
|
||||
### Output Format Issues
|
||||
|
||||
**Vấn đề:** JSON output is malformed
|
||||
|
||||
**Giải pháp:**
|
||||
- Sử dụng `--json-schema` để enforce structure
|
||||
- Thêm instructions JSON rõ ràng trong prompt
|
||||
- Sử dụng `--output-format json` (không chỉ yêu cầu JSON trong prompt)
|
||||
|
||||
### Permission Denied
|
||||
|
||||
**Vấn đề:** Tool execution blocked
|
||||
|
||||
**Giải pháp:**
|
||||
- Kiểm tra `--permission-mode` setting
|
||||
- Xem lại `--allowedTools` và `--disallowedTools` flags
|
||||
- Sử dụng `--dangerously-skip-permissions` cho automation (cẩn thận)
|
||||
|
||||
---
|
||||
|
||||
## Tài Nguyên Thêm / Additional Resources
|
||||
|
||||
- [Tài Liệu CLI Chính Thức](https://code.claude.com/docs/en/cli-reference)
|
||||
- [Tài Liệu MCP](../05-mcp/) - Cấu hình MCP servers
|
||||
- [Slash Commands](../01-slash-commands/) - Các phím tắt có thể tái sử dụng
|
||||
- [Plugins](../07-plugins/) - Các gói mở rộng có thể cài đặt
|
||||
- **[Official CLI Reference](https://code.claude.com/docs/en/cli-reference)** - Complete command reference
|
||||
- **[Headless Mode Documentation](https://code.claude.com/docs/en/headless)** - Automated execution
|
||||
- **[Slash Commands](../01-slash-commands/)** - Custom shortcuts within Claude
|
||||
- **[Memory Guide](../02-memory/)** - Persistent context via CLAUDE.md
|
||||
- **[MCP Protocol](../05-mcp/)** - External tool integrations
|
||||
- **[Advanced Features](../09-advanced-features/)** - Planning mode, extended thinking
|
||||
- **[Hướng Dẫn Subagents](../04-subagents/)** - Thực thi tác vụ được ủy quyền
|
||||
|
||||
---
|
||||
|
||||
*Phần của series hướng dẫn [Claude How To](../)*
|
||||
|
||||
---
|
||||
|
||||
**Cập Nhật Lần Cuối**: Tháng 4 năm 2026
|
||||
**Phiên Bản Claude Code**: 2.1+
|
||||
**Các Mô Hình Tương Thích**: Claude Sonnet 4.6, Claude Opus 4.6, Claude Haiku 4.5
|
||||
|
||||
Reference in New Issue
Block a user