Files
claude-howto/vi/07-plugins
Thiên Toán a70777e9bc Add Vietnamese (Tiếng Việt) Localization (#42)
* feat(i18n): add Vietnamese localization infrastructure

Add comprehensive infrastructure for Vietnamese translation of the
claude-howto documentation:

Features:
- Parallel vi/ directory structure for Vietnamese content
- Modified build_epub.py with --lang flag for Vietnamese EPUB
- Vietnamese-specific pre-commit hooks for quality checks
- Translation support files (glossary, style guide, queue tracker)
- sync_translations.py script to detect outdated translations

Infrastructure:
- vi/ directory with all 10 module subdirectories
- TRANSLATION_NOTES.md: comprehensive glossary and style guide
- TRANSLATION_QUEUE.md: progress tracking for 66+ files
- vi/README.md: Vietnamese landing page

EPUB Build:
- Added --lang CLI flag (en/vi) to build_epub.py
- Language-specific metadata (title, subtitle)
- Automatic root path adjustment for vi/ directory
- Dynamic output filename (claude-howto-guide-vi.epub)

Quality Assurance:
- Vietnamese markdown linting
- Vietnamese cross-reference checking
- Vietnamese Mermaid syntax validation
- Vietnamese link checking
- Vietnamese EPUB build validation

Ready for translation work to begin.

* feat(vi): translate INDEX.md to Vietnamese

Complete Vietnamese translation of INDEX.md - the comprehensive
index of all example files in the repository.

Translation follows vi/TRANSLATION_NOTES.md guidelines:
- Technical terms kept per glossary (slash command → "lệnh slash")
- File paths and code blocks preserved in English
- Table structure and formatting maintained
- All 882 lines translated

Content includes:
- Complete file tree (10 modules, 100+ files)
- Feature coverage matrix
- Quick start guides by use case
- Learning path progression
- Search by keyword sections

Progress: 1/5 core documents completed

* feat(vi): translate CATALOG.md to Vietnamese

Complete Vietnamese translation of CATALOG.md - the quick reference
guide to all Claude Code features.

Translation follows vi/TRANSLATION_NOTES.md guidelines:
- Technical terms kept per glossary (slash command → "lệnh slash")
- All command names preserved (/help, /optimize, etc.)
- Code blocks, JSON examples, and bash commands unchanged
- All tables and formatting maintained
- 517 lines translated with complete feature coverage

Content includes:
- Summary statistics (99 built-in + 43 examples = 117 total)
- Complete built-in commands reference (55+ commands)
- Custom commands examples (8 commands)
- Permission modes (6 modes)
- Subagents (6 built-in + 10 custom)
- Skills (5 bundled + 4 custom)
- Plugins (3 complete plugins)
- MCP servers (1 built-in + 8 common servers)
- Hooks (25 events + 7 example hooks)
- Memory files (7 types)
- New features (March 2026) - 17 new features
- Installation priority guide
- Complete one-command installation

Progress: 2/5 core documents completed

* docs(vi): translate learning roadmap to Vietnamese

- Add complete Vietnamese translation of LEARNING-ROADMAP.md (747 lines)
- Include self-assessment quiz for level determination
- Translate three learning levels: Beginner, Intermediate, Advanced
- Translate all milestones (1A, 1B, 2A, 2B, 3A, 3B) with hands-on exercises
- Preserve Mermaid diagram for learning path visualization
- Maintain progress tracking checklists and learning tips

* docs(vi): translate quick reference guide to Vietnamese

- Add complete Vietnamese translation of QUICK_REFERENCE.md (507 lines)
- Include installation quick commands for all features
- Translate feature cheat sheet with usage examples
- Translate common use cases (code review, documentation, DevOps, etc.)
- Preserve all code snippets, commands, and file paths in English
- Maintain file locations reference diagram
- Include learning path and new features (March 2026) sections
- Keep tips & tricks, feature matrix, and checklist intact

* docs(vi): translate module 01 - slash commands to Vietnamese

- Add complete Vietnamese translation of 01-slash-commands/README.md (553 lines)
- Translate slash commands overview and architecture
- Include 55+ built-in commands reference table with Vietnamese descriptions
- Translate bundled skills section (5 skills)
- Document custom commands (now skills) migration path
- Include frontmatter reference, arguments, and dynamic context sections
- Preserve all command names, code examples, and Mermaid diagrams
- Translate 8 available commands in folder with usage examples
- Include installation, troubleshooting, and best practices sections

* docs(vi): update translation queue progress - Module 01 README done

- Mark 01-slash-commands/README.md as completed (2026-04-02)
- Update Module 01 progress: 1/9 files (11%)
- Update overall progress: 6/66 files (9%)
- Update Priority 2 progress: 1/31 files (3%)
- Add recent completion note to queue header

* docs(vi): translate slash command - commit to Vietnamese

- Translate commit.md slash command to Vietnamese
- Keep all git commands and technical syntax intact
- Translate instructions and descriptions
- Maintain conventional commits format documentation

* docs(vi): translate slash command - doc-refactor to Vietnamese

- Translate doc-refactor.md slash command to Vietnamese
- Keep all technical terms and file paths intact
- Translate documentation refactoring instructions
- Maintain structure and numbering

* docs(vi): translate slash command - generate-api-docs to Vietnamese

- Translate generate-api-docs.md slash command to Vietnamese
- Keep all technical terms and file paths intact
- Translate API documentation generation instructions
- Maintain output format specifications

* docs(vi): translate slash command - optimize to Vietnamese

- Translate optimize.md slash command to Vietnamese
- Keep all technical terms and code concepts intact
- Translate code optimization instructions
- Maintain issue priority and response format

* docs(vi): translate slash command - pr to Vietnamese

- Translate pr.md slash command to Vietnamese
- Keep all commands and technical syntax intact
- Translate PR preparation checklist instructions
- Maintain conventional commits format documentation

* docs(vi): translate slash command - push-all to Vietnamese

- Translate push-all.md slash command to Vietnamese (153 lines)
- Keep all git commands and technical syntax intact
- Translate comprehensive workflow with safety checks
- Maintain API key validation patterns and error handling
- Preserve when to use/avoid sections and alternatives

* docs(vi): translate slash command - setup-ci-cd to Vietnamese

- Translate setup-ci-cd.md slash command to Vietnamese
- Keep all tool names and technical terms intact
- Translate CI/CD pipeline implementation instructions
- Maintain pre-commit hooks and GitHub Actions sections

* docs(vi): translate slash command - unit-test-expand to Vietnamese

- Translate unit-test-expand.md slash command to Vietnamese
- Keep all framework names and technical terms intact
- Translate test coverage expansion instructions
- Maintain testing frameworks and scenario sections

* docs(vi): update translation queue - Module 01 complete (100%)

- Mark all 9 Module 01 files as completed (2026-04-02)
- Update Module 01 progress: 9/9 files (100%) 
- Update overall progress: 14/66 files (21%)
- Update Priority 2 progress: 9/31 files (29%)
- Update header with Module 01 completion milestone

Module 01: Slash Commands - All files translated:
 README.md (overview, built-in commands, skills)
 commit.md (git commit with context)
 doc-refactor.md (documentation restructuring)
 generate-api-docs.md (API documentation generator)
 optimize.md (code optimization analysis)
 pr.md (pull request preparation)
 push-all.md (stage, commit, push with safety)
 setup-ci-cd.md (CI/CD pipeline implementation)
 unit-test-expand.md (test coverage expansion)

* docs(vi): translate module 02 - memory guide to Vietnamese

- Add complete Vietnamese translation of 02-memory/README.md (1162 lines)
- Translate memory system overview and architecture
- Include quick reference for memory commands (/init, /memory, #)
- Document complete memory hierarchy (8 levels with precedence)
- Translate auto memory section with architecture diagrams
- Include practical examples (project, directory-specific, personal memory)
- Add best practices, installation instructions, and troubleshooting
- Preserve all code examples, file paths, and technical terms
- Maintain Mermaid diagrams and tables

* docs(vi): translate example project CLAUDE.md to Vietnamese

- Translate project-CLAUDE.md example memory file
- Keep all technical terms, commands, and code style intact
- Translate descriptions and explanations
- Maintain project configuration structure

* docs(vi): translate example personal CLAUDE.md to Vietnamese

- Translate personal-CLAUDE.md example memory file
- Keep all technical terms, tools, and preferences intact
- Translate descriptions and explanations
- Maintain personal preferences structure

* docs(vi): translate example directory-specific CLAUDE.md to Vietnamese

- Translate directory-api-CLAUDE.md example memory file
- Keep all technical terms, API standards, and code examples intact
- Translate descriptions and explanations
- Maintain API module standards structure

* docs(vi): update translation queue - Module 02 complete (100%)

- Mark all 4 Module 02 files as completed (2026-04-02)
- Update Module 02 progress: 4/4 files (100%) 
- Update overall progress: 18/66 files (27%)
- Update Priority 2 progress: 13/31 files (42%)
- Update header with Module 02 completion milestone

Module 02: Memory - All files translated:
 README.md (1162 lines - comprehensive memory guide)
 project-CLAUDE.md (example project memory)
 personal-CLAUDE.md (example personal preferences)
 directory-api-CLAUDE.md (example directory-specific rules)

* docs(vi): translate module 03 - skills guide to Vietnamese

- Add complete Vietnamese translation of 03-skills/README.md (805 lines)
- Translate Agent Skills overview and architecture
- Include progressive disclosure loading mechanism (3 levels)
- Document skill types, locations, and automatic discovery
- Translate skill creation process and SKILL.md format
- Include required and optional frontmatter fields
- Document skill content types (reference vs task)
- Translate controlling skill invocation and string substitutions
- Include dynamic context injection with shell commands
- Document running skills in subagents with context: fork
- Translate 6 practical examples with directory structures
- Add supporting files, management, and best practices sections
- Preserve all code examples, YAML frontmatter, and Mermaid diagrams
- Maintain tables, troubleshooting guides, and security considerations

* docs(vi): translate skill - blog-draft to Vietnamese

- Translate blog-draft/SKILL.md to Vietnamese (275 lines)
- Keep all workflow steps and technical structure intact
- Translate instructions and descriptions
- Maintain version tracking and file structure
- Preserve all markdown formatting and code examples

* docs(vi): translate skill - brand-voice to Vietnamese

- Translate brand-voice/SKILL.md to Vietnamese (73 lines)
- Keep brand identity, tone, and vocabulary intact
- Translate writing guidelines and examples
- Maintain preferred/avoided terms sections
- Preserve good/bad examples with explanations

* docs(vi): translate skill - claude-md to Vietnamese

- Translate claude-md/SKILL.md to Vietnamese (213 lines)
- Keep all golden rules and core principles intact
- Translate execution flow and content strategy
- Maintain WHAT/WHY/HOW structure
- Preserve quality constraints and validation checklist
- Keep anti-patterns and output format sections

* docs(vi): translate skill - code-review to Vietnamese

- Translate code-review/SKILL.md to Vietnamese (71 lines)
- Keep all review categories and template intact
- Translate security, performance, quality, maintainability sections
- Maintain review template structure
- Preserve version history

* docs(vi): translate skill - refactor to Vietnamese

- Translate refactor/SKILL.md to Vietnamese (427 lines)
- Keep all Martin Fowler refactoring methodology intact
- Translate 6-phase workflow with detailed steps
- Maintain core principles and safety rules
- Preserve code smell catalog and refactoring techniques
- Keep quick start example with before/after code
- Maintain version history and references sections

* docs(vi): update translation queue - Module 03 complete (100%)

- Mark all 6 Module 03 files as completed (2026-04-02)
- Update Module 03 progress: 6/6 files (100%) 
- Update overall progress: 24/66 files (36%)
- Update Priority 2 progress: 19/31 files (61%)
- Update header with Module 03 completion milestone

Module 03: Skills - All files translated:
 README.md (805 lines - comprehensive skills guide)
 blog-draft/SKILL.md (275 lines - blog post creation workflow)
 brand-voice/SKILL.md (73 lines - brand voice consistency)
 claude-md/SKILL.md (213 lines - CLAUDE.md best practices)
 code-review/SKILL.md (71 lines - comprehensive code review)
 refactor/SKILL.md (427 lines - Fowler refactoring methodology)

* docs(vi): translate Module 04 Subagents README

Complete Vietnamese translation of subagents reference guide:
- Configuration and built-in subagents (general-purpose, Plan, Explore, Bash, statusline-setup, Claude Code Guide)
- Agent management with /agents command
- Automatic delegation vs explicit invocation
- Resumable agents and chaining
- Persistent memory across agent sessions
- Background subagents for parallel work
- Worktree isolation for safe experimentation
- Agent Teams (experimental feature)
- Best practices and usage patterns

* docs(vi): complete Module 04 Subagents translation

Translate all 6 subagent example definitions:
- code-reviewer.md: Expert code review specialist
- debugger.md: Root cause analysis and debugging
- documentation-writer.md: Technical documentation creation
- implementation-agent.md: Full-stack feature implementation
- secure-reviewer.md: Security-focused code review
- test-engineer.md: Comprehensive test coverage

Update translation queue progress:
- Module 04: 7/7 files (100%) 
- Overall: 31/66 files (47%)
- Next: Module 05 (MCP)

* docs(vi): complete Module 05 MCP translation

Translate comprehensive MCP (Model Context Protocol) guide:
- Overview and architecture diagrams
- Installation methods (HTTP, Stdio, SSE, WebSocket)
- OAuth 2.0 authentication support
- MCP tool search and dynamic updates
- Elicitation and prompt slash commands
- Configuration management (local, project, user scopes)
- Practical examples (GitHub, Database, Filesystem, Slack MCPs)
- MCP vs Memory decision matrix
- Code execution approach for solving context bloat
- MCPorter runtime reference
- Security best practices and troubleshooting

Translate 4 MCP configuration JSON examples:
- filesystem-mcp.json: File operations
- github-mcp.json: GitHub integration
- database-mcp.json: SQL queries
- multi-mcp.json: Multiple servers configuration

Update translation queue progress:
- Module 05: 5/5 files (100%) 
- Overall: 36/66 files (55%)
- Next: Module 06 (Hooks)

* docs(vi): complete Module 06 Hooks translation

Translate comprehensive Hooks guide:
- Overview and architecture
- Configuration structure (user, project, local scopes)
- Four hook types: command, HTTP, prompt, agent
- 25 hook events with matcher patterns
- Component-scoped hooks and subagent frontmatter
- JSON input/output format and exit codes
- Environment variables and best practices
- Security considerations and debugging
- Installation instructions

Copy 9 hook example files (code, no translation needed):
- format-code.sh: Auto-format code after write/edit
- log-bash.sh: Bash command logging
- notify-team.sh: Team notifications
- pre-commit.sh: Pre-commit validation
- security-scan.sh: Security scanning
- validate-prompt.sh: Prompt validation
- context-tracker.py: Token usage tracking
- context-tracker-tiktoken.py: Accurate token counting

Update translation queue progress:
- Module 06: 9/9 files (100%) 
- Overall: 45/67 files (67%)
- Next: Module 07 (Plugins)

* docs(vi): complete Module 07 Plugins translation

Translate comprehensive Plugins guide:
- Overview and architecture diagrams
- Plugin loading process and lifecycle
- Plugin types (Official, Community, Organization, Personal)
- Plugin definition structure and manifest
- Plugin structure example with all directories
- LSP server configuration and examples
- Plugin options (v2.1.83+) with userConfig
- Persistent plugin data via CLAUDE_PLUGIN_DATA
- Inline plugins via settings (v2.1.80+)
- Standalone vs Plugin approach comparison
- Practical examples (PR Review, DevOps, Documentation plugins)
- Plugin marketplace and distribution
- Marketplace configuration and definition schema
- Plugin source types and distribution methods
- Plugin CLI commands and installation methods
- Plugin features comparison table
- Testing, hot-reload, and managed settings
- Plugin security restrictions
- Publishing workflow and best practices
- Complete troubleshooting guide

Copy all plugin subdirectories (code, no translation needed):
- devops-automation/: Deployment workflows, incident management
- documentation/: API docs, README generation, templates
- pr-review/: Pull request review automation

Update translation queue progress:
- Module 07: 10+/10+ files (100%) 
- Overall: 55+/67 files (82%)
- Next: Module 08-10 (Checkpoints, Advanced Features, CLI)

* docs(vi): complete Modules 08-10 translation

Module 08: Checkpoints and Rewind (2 files)
- Overview and architecture
- Access methods (keyboard shortcut, slash command)
- Five rewind options (restore code+conversation, conversation, code, summarize, cancel)
- Automatic checkpoints and retention policies
- Use cases and practical examples
- Integration with git and best practices

Module 09: Advanced Features (3 files)
- Planning Mode: Two-phase implementation approach
- Extended Thinking: Deep reasoning for complex problems
- Auto Mode: Background safety classifier
- Background Tasks, Scheduled Tasks
- Permission Modes (default, acceptEdits, plan, auto, dontAsk, bypassPermissions)
- Print Mode, Session Management
- Voice Dictation, Channels, Remote Control
- Web Sessions, Desktop App, Task List
- Git Worktrees, Sandboxing, Managed Settings

Module 10: CLI Reference (1 file)
- CLI commands reference
- Core flags and options
- Interactive vs Print Mode
- Model selection and configuration
- System prompt customization
- Tool & permission management
- Output formats and scripting

Update translation queue progress:
- Modules 08-10: 6/6 files (100%) 
- All Modules 01-10: 61+/61+ files (100%) 
- Overall: 61+/67 files (91%)
- Remaining: Supporting docs (6 files)

* docs(vi): complete supporting documentation translation

Translate all 5 supporting documents:
- CONTRIBUTING.md: Contribution guidelines
- SECURITY.md: Security policy and vulnerability reporting
- CODE_OF_CONDUCT.md: Community standards and harassment policy
- STYLE_GUIDE.md: Documentation formatting conventions
- CHANGELOG.md: Version history (v2.2.0, v2.1.1, v2.1.0, v2.0.0)

Update translation queue to 100% completion:
- All Modules 01-10: 61+ files (100%) 
- Supporting Docs: 5/5 files (100%) 
- Overall: 67+/67 files (100%) 
- Status: HOÀN THÀNH 

* fix(vi): fix mermaid syntax and broken cross-references in Vietnamese translation

Fix invalid `#` comment in mermaid block (use `%%` instead) and update
cross-reference script to support Unicode/Vietnamese diacritics in anchor
generation. Fix broken anchor links across vi/ documentation files.

* fix(vi): remove inline mermaid comment causing parse error

Inline %% comments on node definition lines are not supported by the
mermaid parser. The surrounding HTML comment already explains this is
an incorrect example.
2026-04-06 21:34:18 +02:00
..

Claude How To

Claude Code Plugins / Plugins Claude Code

Thư mục này chứa các ví dụ plugin hoàn chỉnh đóng gói nhiều tính năng Claude Code thành các gói có thể cài đặt liền mạch.

Tổng Quan / Overview

Claude Code Plugins là các bộ sưu tập được đóng gói của các tùy chỉnh (slash commands, subagents, MCP servers, và hooks) cài đặt với một lệnh duy nhất. Chúng đại diện cho cơ chế mở rộng cấp cao nhất—kết hợp nhiều tính năng thành các gói gắn kết, có thể chia sẻ.

Kiến Trúc Plugin / Plugin Architecture

graph TB
    A["Plugin"]
    B["Slash Commands"]
    C["Subagents"]
    D["MCP Servers"]
    E["Hooks"]
    F["Configuration"]

    A -->|bundles| B
    A -->|bundles| C
    A -->|bundles| D
    A -->|bundles| E
    A -->|bundles| F

Quy Trình Tải Plugin / Plugin Loading Process

sequenceDiagram
    participant User
    participant Claude as Claude Code
    participant Plugin as Plugin Marketplace
    participant Install as Installation
    participant SlashCmds as Slash Commands
    participant Subagents
    participant MCPServers as MCP Servers
    participant Hooks
    participant Tools as Configured Tools

    User->>Claude: /plugin install pr-review
    Claude->>Plugin: Download plugin manifest
    Plugin-->>Claude: Return plugin definition
    Claude->>Install: Extract components
    Install->>SlashCmds: Configure
    Install->>Subagents: Configure
    Install->>MCPServers: Configure
    Install->>Hooks: Configure
    SlashCmds-->>Tools: Ready to use
    Subagents-->>Tools: Ready to use
    MCPServers-->>Tools: Ready to use
    Hooks-->>Tools: Ready to use
    Tools-->>Claude: Plugin installed ✅

Các Loại Plugin & Phân Phối / Plugin Types & Distribution

Loại Phạm Vi Chia Sẻ Quyền Ví Dụ
Chính Thức Toàn cầu Tất cả người dùng Anthropic PR Review, Security Guidance
Cộng Đồng Công khai Tất cả người dùng Cộng Đồng DevOps, Data Science
Tổ Chức Nội bộ Các thành viên nhóm Công ty Tiêu chuẩn nội bộ, công cụ
Cá Nhân Cá nhân Người dùng duy nhất Nhà phát triển Workflows tùy chỉnh

Cấu Trúc Định Nghĩa Plugin / Plugin Definition Structure

Plugin manifest sử dụng định dạng JSON trong .claude-plugin/plugin.json:

{
  "name": "my-first-plugin",
  "description": "A greeting plugin",
  "version": "1.0.0",
  "author": {
    "name": "Your Name"
  },
  "homepage": "https://example.com",
  "repository": "https://github.com/user/repo",
  "license": "MIT"
}

Ví Dụ Cấu Trúc Plugin / Plugin Structure Example

my-plugin/
├── .claude-plugin/
│   └── plugin.json       # Manifest (tên, mô tả, phiên bản, tác giả)
├── commands/             # Skills như các file Markdown
│   ├── task-1.md
│   ├── task-2.md
│   └── workflows/
├── agents/               # Định nghĩa agent tùy chỉnh
│   ├── specialist-1.md
│   ├── specialist-2.md
│   └── configs/
├── skills/               # Agent Skills với các file SKILL.md
│   ├── skill-1.md
│   └── skill-2.md
├── hooks/                # Event handlers trong hooks.json
│   └── hooks.json
├── .mcp.json             # Cấu hình MCP server
├── .lsp.json             # Cấu hình LSP server
├── settings.json         # Cài đặt mặc định
├── templates/
│   └── issue-template.md
├── scripts/
│   ├── helper-1.sh
│   └── helper-2.py
├── docs/
│   ├── README.md
│   └── USAGE.md
└── tests/
    └── plugin.test.js

Cấu hình LSP server / LSP server configuration

Plugins có thể bao gồm hỗ trợ Language Server Protocol (LSP) để thông minh code thời gian thực. LSP servers cung cấp chẩn đoán, điều hướng code, và thông tin ký hiệu khi bạn làm việc.

Vị trí cấu hình:

  • File .lsp.json trong thư mục gốc plugin
  • Key lsp inline trong plugin.json

Tham khảo trường / Field reference

Trường Bắt Buộc Mô Tả
command Binary LSP server (phải trong PATH)
extensionToLanguage Ánh xạ các phần mở rộng file đến ID ngôn ngữ
args Không Các đối số dòng lệnh cho server
transport Không Phương thức giao tiếp: stdio (mặc định) hoặc socket
env Không Biến môi trường cho tiến trình server
initializationOptions Không Các tùy chọn được gửi trong quá trình khởi tạo LSP
settings Không Cấu hình workspace được chuyển đến server
workspaceFolder Không Ghi đè đường dẫn thư mục workspace
startupTimeout Không Thời gian tối đa (ms) để chờ khởi động server
shutdownTimeout Không Thời gian tối đa (ms) để tắt graceful
restartOnCrash Không Tự động khởi động lại nếu server bị lỗi
maxRestarts Không Số lần khởi động lại tối đa trước khi bỏ cuộc

Các cấu hình ví dụ / Example configurations

Go (gopls):

{
  "go": {
    "command": "gopls",
    "args": ["serve"],
    "extensionToLanguage": {
      ".go": "go"
    }
  }
}

Python (pyright):

{
  "python": {
    "command": "pyright-langserver",
    "args": ["--stdio"],
    "extensionToLanguage": {
      ".py": "python",
      ".pyi": "python"
    }
  }
}

TypeScript:

{
  "typescript": {
    "command": "typescript-language-server",
    "args": ["--stdio"],
    "extensionToLanguage": {
      ".ts": "typescript",
      ".tsx": "typescriptreact",
      ".js": "javascript",
      ".jsx": "javascriptreact"
    }
  }
}

Các plugin LSP có sẵn / Available LSP plugins

Marketplace chính thức bao gồm các plugin LSP được cấu hình trước:

Plugin Ngôn Ngữ Server Binary Lệnh Cài Đặt
pyright-lsp Python pyright-langserver pip install pyright
typescript-lsp TypeScript/JavaScript typescript-language-server npm install -g typescript-language-server typescript
rust-lsp Rust rust-analyzer Cài đặt qua rustup component add rust-analyzer

Khả năng LSP / LSP capabilities

Khi được cấu hình, LSP servers cung cấp:

  • Chẩn đoán tức thì — lỗi và cảnh báo xuất hiện ngay sau khi chỉnh sửa
  • Điều hướng code — đi đến định nghĩa, tìm tham chiếu, implementations
  • Thông tin hover — chữ ký kiểu và tài liệu khi hover
  • Liệt kê ký hiệu — duyệt các ký hiệu trong file hoặc workspace hiện tại

Tùy Chọn Plugin (v2.1.83+) / Plugin Options

Plugins có thể khai báo các tùy chọn có thể cấu hình bởi người dùng trong manifest qua userConfig. Các giá trị được đánh dấu sensitive: true được lưu trữ trong system keychain thay vì các file settings plain-text:

{
  "name": "my-plugin",
  "version": "1.0.0",
  "userConfig": {
    "apiKey": {
      "description": "API key for the service",
      "sensitive": true
    },
    "region": {
      "description": "Deployment region",
      "default": "us-east-1"
    }
  }
}

Dữ Liệu Plugin Liên Tục (${CLAUDE_PLUGIN_DATA}) (v2.1.78+)

Plugins có quyền truy cập đến một thư mục trạng thái liên tục qua biến môi trường ${CLAUDE_PLUGIN_DATA}. Thư mục này là duy nhất cho mỗi plugin và tồn tại qua các phiên, làm cho nó phù hợp cho caches, databases, và các trạng thái liên tục khác:

{
  "hooks": {
    "PostToolUse": [
      {
        "command": "node ${CLAUDE_PLUGIN_DATA}/track-usage.js"
      }
    ]
  }
}

Thư mục được tạo tự động khi plugin được cài đặt. Các file được lưu trữ ở đây tồn tại cho đến khi plugin được gỡ cài đặt.

Plugin Inline qua Settings (source: 'settings') (v2.1.80+)

Plugins có thể được định nghĩa inline trong các file settings như các mục marketplace sử dụng trường source: 'settings'. Điều này cho phép nhúng định nghĩa plugin trực tiếp mà không cần repository hoặc marketplace riêng:

{
  "pluginMarketplaces": [
    {
      "name": "inline-tools",
      "source": "settings",
      "plugins": [
        {
          "name": "quick-lint",
          "source": "./local-plugins/quick-lint"
        }
      ]
    }
  ]
}

Cài Đặt Plugin / Plugin Settings

Plugins có thể gửi một file settings.json để cung cấp cấu hình mặc định. Điều này hiện hỗ trợ key agent, thiết lập agent luồng chính cho plugin:

{
  "agent": "agents/specialist-1.md"
}

Khi một plugin bao gồm settings.json, các mặc định của nó được áp dụng khi cài đặt. Người dùng có thể ghi đè các cài đặt này trong cấu hình project hoặc user của riêng họ.

Cách Tiếp Cận Standalone vs Plugin / Standalone vs Plugin Approach

Cách Tiếp Cận Tên Lệnh Cấu Hình Tốt Nhất Cho
Standalone /hello Thiết lập thủ công trong CLAUDE.md Cá nhân, cụ thể project
Plugins /plugin-name:hello Tự động qua plugin.json Chia sẻ, phân phối, sử dụng nhóm

Sử dụng slash commands standalone cho workflows cá nhân nhanh. Sử dụng plugins khi bạn muốn đóng gói nhiều tính năng, chia sẻ với một nhóm, hoặc xuất bản để phân phối.

Ví Dụ Thực Tiễn / Practical Examples

Ví Dụ 1: Plugin PR Review / Example 1: PR Review Plugin

File: .claude-plugin/plugin.json

{
  "name": "pr-review",
  "version": "1.0.0",
  "description": "Complete PR review workflow with security, testing, and docs",
  "author": {
    "name": "Anthropic"
  },
  "repository": "https://github.com/your-org/pr-review",
  "license": "MIT"
}

File: commands/review-pr.md

---
name: Review PR
description: Start comprehensive PR review with security and testing checks
---

# PR Review

Lệnh này khởi tạo một pull request review hoàn chỉnh bao gồm:

1. Phân tích bảo mật
2. Xác minh phủ vùng test
3. Cập nhật tài liệu
4. Kiểm tra chất lượng code
5. Đánh giá tác động hiệu suất

File: agents/security-reviewer.md

---
name: security-reviewer
description: Security-focused code review
tools: read, grep, diff
---

# Security Reviewer

Chuyên về việc tìm các lỗ hổng bảo mật:
- Vấn đề xác thực/ủy quyền
- Lộ dữ liệu
- Các tấn công tiêm nhiễm
- Cấu hình bảo mật

Cài Đặt:

/plugin install pr-review

# Result:
# ✅ 3 slash commands installed
# ✅ 3 subagents configured
# ✅ 2 MCP servers connected
# ✅ 4 hooks registered
# ✅ Ready to use!

Ví Dụ 2: Plugin DevOps / Example 2: DevOps Plugin

Các Thành Phần:

devops-automation/
├── commands/
│   ├── deploy.md
│   ├── rollback.md
│   ├── status.md
│   └── incident.md
├── agents/
│   ├── deployment-specialist.md
│   ├── incident-commander.md
│   └── alert-analyzer.md
├── mcp/
│   ├── github-config.json
│   ├── kubernetes-config.json
│   └── prometheus-config.json
├── hooks/
│   ├── pre-deploy.js
│   ├── post-deploy.js
│   └── on-error.js
└── scripts/
    ├── deploy.sh
    ├── rollback.sh
    └── health-check.sh

Ví Dụ 3: Plugin Tài Liệu / Example 3: Documentation Plugin

Các Thành Phần Được Đóng Gói:

documentation/
├── commands/
│   ├── generate-api-docs.md
│   ├── generate-readme.md
│   ├── sync-docs.md
│   └── validate-docs.md
├── agents/
│   ├── api-documenter.md
│   ├── code-commentator.md
│   └── example-generator.md
├── mcp/
│   ├── github-docs-config.json
│   └── slack-announce-config.json
└── templates/
    ├── api-endpoint.md
    ├── function-docs.md
    └── adr-template.md

Marketplace Plugin / Plugin Marketplace

Thư mục plugin do Anthropic quản lý chính thức là anthropics/claude-plugins-official. Các quản trị viên enterprise cũng có thể tạo các plugin marketplaces riêng để phân phối nội bộ.

graph TB
    A["Plugin Marketplace"]
    B["Official<br/>anthropics/claude-plugins-official"]
    C["Community<br/>Marketplace"]
    D["Enterprise<br/>Private Registry"]

    A --> B
    A --> C
    A --> D

    B -->|Categories| B1["Development"]
    B -->|Categories| B2["DevOps"]
    B -->|Categories| B3["Documentation"]

    C -->|Search| C1["DevOps Automation"]
    C -->|Search| C2["Mobile Dev"]
    C -->|Search| C3["Data Science"]

    D -->|Internal| D1["Company Standards"]
    D -->|Internal| D2["Legacy Systems"]
    D -->|Internal| D3["Compliance"]

    style A fill:#e1f5fe,stroke:#333,color:#333
    style B fill:#e8f5e9,stroke:#333,color:#333
    style C fill:#f3e5f5,stroke:#333,color:#333
    style D fill:#fff3e0,stroke:#333,color:#333

Cấu Hình Marketplace / Marketplace Configuration

Người dùng enterprise và nâng cao có thể kiểm soát hành vi marketplace qua các cài đặt:

Cài Đặt Mô Tả
extraKnownMarketplaces Thêm các nguồn marketplace bổ sung ngoài mặc định
strictKnownMarketplaces Kiểm soát marketplace nào người dùng được phép thêm
deniedPlugins Blocklist do quản trị viên quản lý để ngăn cài đặt các plugin cụ thể

Các Tính Năng Marketplace Thêm / Additional Marketplace Features

  • Git timeout mặc định: Tăng từ 30s lên 120s cho các repository plugin lớn
  • npm registries tùy chỉnh: Plugins có thể chỉ định URLs registry npm tùy chỉnh để giải quyết dependency
  • Version pinning: Khóa plugins đến các phiên bản cụ thể cho các môi trường có thể tái sản xuất

Schema định nghĩa marketplace / Marketplace definition schema

Plugin marketplaces được định nghĩa trong .claude-plugin/marketplace.json:

{
  "name": "my-team-plugins",
  "owner": "my-org",
  "plugins": [
    {
      "name": "code-standards",
      "source": "./plugins/code-standards",
      "description": "Enforce team coding standards",
      "version": "1.2.0",
      "author": "platform-team"
    },
    {
      "name": "deploy-helper",
      "source": {
        "source": "github",
        "repo": "my-org/deploy-helper",
        "ref": "v2.0.0"
      },
      "description": "Deployment automation workflows"
    }
  ]
}
Trường Bắt Buộc Mô Tả
name Tên marketplace trong kebab-case
owner Tổ chức hoặc người dùng duy trì marketplace
plugins Mảng các mục plugin
plugins[].name Tên plugin (kebab-case)
plugins[].source Nguồn plugin (chuỗi đường dẫn hoặc object nguồn)
plugins[].description Không Mô tả plugin ngắn
plugins[].version Không Chuỗi phiên bản semantic
plugins[].author Không Tên tác giả plugin

Các loại nguồn plugin / Plugin source types

Plugins có thể được sourced từ nhiều vị trí:

Nguồn Cú Pháp Ví Dụ
Đường dẫn tương đối Chuỗi đường dẫn "./plugins/my-plugin"
GitHub { "source": "github", "repo": "owner/repo" } { "source": "github", "repo": "acme/lint-plugin", "ref": "v1.0" }
Git URL { "source": "url", "url": "..." } { "source": "url", "url": "https://git.internal/plugin.git" }
Git subdirectory { "source": "git-subdir", "url": "...", "path": "..." } { "source": "git-subdir", "url": "https://github.com/org/monorepo.git", "path": "packages/plugin" }
npm { "source": "npm", "package": "..." } { "source": "npm", "package": "@acme/claude-plugin", "version": "^2.0" }
pip { "source": "pip", "package": "..." } { "source": "pip", "package": "claude-data-plugin", "version": ">=1.0" }

Các nguồn GitHub và git hỗ trợ các trường tùy chọn ref (nhánh/tag) và sha (hash commit) để version pinning.

Các phương thức phân phối / Distribution methods

GitHub (khuyến nghị):

# Người dùng thêm marketplace của bạn
/plugin marketplace add owner/repo-name

Các dịch vụ git khác (yêu cầu URL đầy đủ):

/plugin marketplace add https://gitlab.com/org/marketplace-repo.git

Repository riêng tư: Được hỗ trợ qua các git credential helpers hoặc token môi trường. Người dùng phải có quyền truy cập đọc đến repository.

Nộp marketplace chính thức: Gửi plugins đến marketplace do Anthropic quản lý để phân phối rộng hơn.

Chế độ nghiêm ngặt / Strict mode

Kiểm soát cách các định nghĩa marketplace tương tác với các file plugin.json cục bộ:

Cài Đặt Hành Vi
strict: true (mặc định) plugin.json cục bộ là có thẩm quyền; mục marketplace bổ sung nó
strict: false Mục marketplace là định nghĩa plugin hoàn chỉnh

Hạn chế tổ chức với strictKnownMarketplaces:

Giá Trị Hiệu Ứng
Không được đặt Không có hạn chế — người dùng có thể thêm bất kỳ marketplace nào
Mảng rỗng [] Khóa — không cho phép marketplaces
Mảng các mẫu Allowlist — chỉ các marketplaces khớp có thể được thêm
{
  "strictKnownMarketplaces": [
    "my-org/*",
    "github.com/trusted-vendor/*"
  ]
}

Cảnh Báo: Trong chế độ nghiêm ngặt với strictKnownMarketplaces, người dùng chỉ có thể cài đặt plugins từ các marketplaces được allowlist. Điều này hữu ích cho các môi trường doanh nghiệp yêu cầu phân phối plugin được kiểm soát.

Vòng Đời & Cài Đặt Plugin / Plugin Installation & Lifecycle

graph LR
    A["Discover"] -->|Browse| B["Marketplace"]
    B -->|Select| C["Plugin Page"]
    C -->|View| D["Components"]
    D -->|Install| E["/plugin install"]
    E -->|Extract| F["Configure"]
    F -->|Activate| G["Use"]
    G -->|Check| H["Update"]
    H -->|Available| G
    G -->|Done| I["Disable"]
    I -->|Later| J["Enable"]
    J -->|Back| G

So Sánh Tính Năng Plugin / Plugin Features Comparison

Tính Năng Slash Command Skill Subagent Plugin
Cài Đặt Copy thủ công Copy thủ công Cấu hình thủ công Một lệnh
Thời Gian Thiết Lập 5 phút 10 phút 15 phút 2 phút
Đóng Gói File đơn File đơn File đơn Nhiều
Phiên Bản Hóa Thủ công Thủ công Thủ công Tự động
Chia Sẻ Nhóm Copy file Copy file Copy file Cài đặt ID
Cập Nhật Thủ công Thủ công Thủ công Tự động có sẵn
Phụ Thuộc Không Không Không Có thể bao gồm
Marketplace Không Không Không
Phân Phối Repository Repository Repository Marketplace

Các Lệnh CLI Plugin / Plugin CLI Commands

Tất cả các thao tác plugin có sẵn như các lệnh CLI:

claude plugin install <name>@<marketplace>   # Cài đặt từ marketplace
claude plugin uninstall <name>               # Gỡ bỏ plugin
claude plugin list                           # Liệt kê các plugin đã cài đặt
claude plugin enable <name>                  # Kích hoạt plugin đã bị vô hiệu hóa
claude plugin disable <name>                 # Vô hiệu hóa plugin
claude plugin validate                       # Xác thực cấu trúc plugin

Các Phương Thức Cài Đặt / Installation Methods

Từ Marketplace

/plugin install plugin-name
# hoặc từ CLI:
claude plugin install plugin-name@marketplace-name

Kích Hoạt / Vô Hiệu Hóa (với phạm vi tự phát hiện)

/plugin enable plugin-name
/plugin disable plugin-name

Plugin Cục Bộ (cho phát triển)

# Cờ CLI để test cục bộ (có thể lặp lại cho nhiều plugins)
claude --plugin-dir ./path/to/plugin
claude --plugin-dir ./plugin-a --plugin-dir ./plugin-b

Từ Git Repository

/plugin install github:username/repo

Khi Nào Tạo Một Plugin / When to Create a Plugin

graph TD
    A["Should I create a plugin?"]
    A -->|Need multiple components| B{"Multiple commands<br/>or subagents<br/>or MCPs?"}
    B -->|Yes| C["✅ Create Plugin"]
    B -->|No| D["Use Individual Feature"]
    A -->|Team workflow| E{"Share with<br/>team?"}
    E -->|Yes| C
    E -->|No| F["Keep as Local Setup"]
    A -->|Complex setup| G{"Needs auto<br/>configuration?"}
    G -->|Yes| C
    G -->|No| D

Các Trường Hợp Sử Dụng Plugin / Plugin Use Cases

Trường Hợp Sử Dụng Khuyến Nghị Tại Sao
Team Onboarding Use Plugin Thiết lập tức thì, tất cả cấu hình
Framework Setup Use Plugin Đóng gói các lệnh cụ thể framework
Enterprise Standards Use Plugin Phân phối trung tâm, kiểm soát phiên bản
Quick Task Automation Use Command Quá phức tạp
Single Domain Expertise Use Skill Quá nặng, sử dụng skill thay thế
Specialized Analysis Use Subagent Tạo thủ công hoặc sử dụng skill
Live Data Access Use MCP Standalone, đừng đóng gói

Testing Một Plugin / Testing a Plugin

Trước khi xuất bản, test plugin của bạn cục bộ sử dụng cờ CLI --plugin-dir (có thể lặp lại cho nhiều plugins):

claude --plugin-dir ./my-plugin
claude --plugin-dir ./my-plugin --plugin-dir ./another-plugin

Điều này khởi chạy Claude Code với plugin của bạn được tải, cho phép bạn:

  • Xác minh tất cả các lệnh slash có sẵn
  • Test subagents và agents hoạt động chính xác
  • Xác nhận MCP servers kết nối đúng
  • Xác thực thực thi hook
  • Kiểm tra các cấu hình LSP server
  • Kiểm tra các lỗi cấu hình

Hot-Reload

Plugins hỗ trợ hot-reload trong quá trình phát triển. Khi bạn sửa đổi các file plugin, Claude Code có thể phát hiện các thay đổi tự động. Bạn cũng có thể force reload với:

/reload-plugins

Điều này đọc lại tất cả các plugin manifests, commands, agents, skills, hooks, và cấu hình MCP/LSP mà không cần khởi động lại phiên.

Cài Đặt Được Quản Lý Cho Plugins / Managed Settings for Plugins

Các quản trị viên có thể kiểm soát hành vi plugin trên một tổ chức sử dụng các cài đặt được quản lý:

Cài Đặt Mô Tả
enabledPlugins Allowlist của các plugin được kích hoạt theo mặc định
deniedPlugins Blocklist của các plugin không thể được cài đặt
extraKnownMarketplaces Thêm các nguồn marketplace bổ sung ngoài mặc định
strictKnownMarketplaces Hạn chế marketplace nào người dùng được phép thêm
allowedChannelPlugins Kiểm soát plugins nào được phép theo kênh phát hành

Các cài đặt này có thể được áp dụng ở cấp tổ chức qua các file cấu hình được quản lý và có ưu tiên hơn các cài đặt cấp người dùng.

Bảo Mật Plugin / Plugin Security

Các subagent plugin chạy trong một sandbox bị hạn chế. Các key frontmatter sau không được phép trong định nghĩa subagent plugin:

  • hooks -- Subagents không thể đăng ký event handlers
  • mcpServers -- Subagents không thể cấu hình MCP servers
  • permissionMode -- Subagents không thể ghi đè mô hình quyền

Điều này đảm bảo rằng plugins không thể leo thang đặc quyền hoặc sửa đổi môi trường host vượt quá phạm vi được khai báo của chúng.

Xuất Bản Một Plugin / Publishing a Plugin

Các bước để xuất bản:

  1. Tạo cấu trúc plugin với tất cả các thành phần
  2. Viết manifest .claude-plugin/plugin.json
  3. Tạo README.md với tài liệu
  4. Test cục bộ với claude --plugin-dir ./my-plugin
  5. Gửi đến plugin marketplace
  6. Được review và phê duyệt
  7. Xuất bản trên marketplace
  8. Người dùng có thể cài đặt với một lệnh

Ví dụ gửi:

# PR Review Plugin

## Mô Tả
Workflow PR review hoàn chỉnh với các kiểm tra bảo mật, testing, và tài liệu.

## Những Gì Được Bao Gồm
- 3 lệnh slash cho các loại review khác nhau
- 3 subagents chuyên biệt
- Tích hợp GitHub và CodeQL MCP
- Các hooks quét bảo mật tự động

## Cài Đặt
```bash
/plugin install pr-review

Tính Năng

Phân tích bảo mật Kiểm tra phủ vùng test Xác minh tài liệu Đánh giá chất lượng code Phân tích tác động hiệu suất

Sử Dụng

/review-pr
/check-security
/check-tests

Yêu Cầu

  • Claude Code 1.0+
  • Truy cập GitHub
  • CodeQL (tùy chọn)

## Plugin vs Cấu Hình Thủ Công / Plugin vs Manual Configuration

**Thiết Lập Thủ Công (2+ giờ):**
- Cài đặt các lệnh slash từng cái một
- Tạo subagents riêng lẻ
- Cấu hình MCPs riêng biệt
- Thiết lập hooks thủ công
- Tài liệu hóa mọi thứ
- Chia sẻ với nhóm (hy vọng họ cấu hình đúng)

**Với Plugin (2 phút):**
```bash
/plugin install pr-review
# ✅ Mọi thứ được cài đặt và cấu hình
# ✅ Sẵn sàng sử dụng ngay lập tức
# ✅ Nhóm có thể tái sản xuất thiết lập chính xác

Thực Hành Tốt Nhất / Best Practices

Nên Làm / Do's

  • Sử dụng tên plugin rõ ràng, mô tả
  • Bao gồm README toàn diện
  • Phiên bản hóa plugin của bạn đúng cách (semver)
  • Test tất cả các thành phần cùng nhau
  • Tài liệu hóa các yêu cầu rõ ràng
  • Cung cấp các ví dụ sử dụng
  • Bao gồm xử lý lỗi
  • Gắn thẻ phù hợp để khám phá
  • Duy trì tương thích ngược
  • Giữ các plugin tập trung và gắn kết
  • Bao gồm các tests toàn diện
  • Tài liệu hóa tất cả các dependencies

Không Nên Làm / Don'ts

  • Đừng đóng gói các tính năng không liên quan
  • Đừng hardcode credentials
  • Đừng bỏ qua testing
  • Đừng quên tài liệu
  • Đừng tạo các plugin dư thừa
  • Đừng bỏ qua versioning
  • Đừng làm phức tạp quá mức các dependencies thành phần
  • Đừng quên xử lý các lỗi một cách graceful

Hướng Dẫn Cài Đặt / Installation Instructions

Cài Đặt Từ Marketplace

  1. Duyệt các plugins có sẵn:

    /plugin list
    
  2. Xem chi tiết plugin:

    /plugin info plugin-name
    
  3. Cài đặt một plugin:

    /plugin install plugin-name
    

Cài Đặt Từ Đường Dẫn Cục Bộ

/plugin install ./path/to/plugin-directory

Cài Đặt Từ GitHub

/plugin install github:username/repo

Liệt Kê Các Plugins Đã Cài Đặt

/plugin list --installed

Cập Nhật Một Plugin

/plugin update plugin-name

Vô Hiệu Hóa/Kích Hoạt Một Plugin

# Vô hiệu hóa tạm thời
/plugin disable plugin-name

# Kích hoạt lại
/plugin enable plugin-name

Gỡ Cài Đặt Một Plugin

/plugin uninstall plugin-name

Các tính năng Claude Code sau hoạt động cùng với plugins:

  • Slash Commands - Các lệnh riêng lẻ được đóng gói trong plugins
  • Memory - Ngữ cảnh liên tục cho plugins
  • Skills - Chuyên môn lĩnh vực có thể được bọc trong plugins
  • Subagents - Các agents chuyên biệt được bao gồm như các thành phần plugin
  • MCP Servers - Các tích hợp Model Context Protocol được đóng gói trong plugins
  • Hooks - Event handlers kích hoạt workflows plugin

Workflow Ví Dụ Hoàn Chỉnh / Complete Example Workflow

Workflow Plugin PR Review Đầy Đủ / PR Review Plugin Full Workflow

1. User: /review-pr

2. Plugin executes:
   ├── pre-review.js hook validates git repo
   ├── GitHub MCP fetches PR data
   ├── security-reviewer subagent analyzes security
   ├── test-checker subagent verifies coverage
   └── performance-analyzer subagent checks performance

3. Results synthesized and presented:
   ✅ Security: No critical issues
   ⚠️  Testing: Coverage 65% (recommend 80%+)
   ✅ Performance: No significant impact
   📝 12 recommendations provided

Xử Lý Sự Cố / Troubleshooting

Plugin Won't Install

  • Kiểm tra tính tương thích phiên bản Claude Code: /version
  • Xác minh cú pháp plugin.json với một trình xác thực JSON
  • Kiểm tra kết nối internet (cho plugins từ xa)
  • Review quyền: ls -la plugin/

Components Not Loading

  • Xác minh các đường dẫn trong plugin.json khớp với cấu trúc thư mục thực tế
  • Kiểm tra quyền file: chmod +x scripts/
  • Review cú pháp file thành phần
  • Kiểm tra logs: /plugin debug plugin-name

MCP Connection Failed

  • Xác minh các biến môi trường được đặt đúng
  • Kiểm tra cài đặt và sức khỏe MCP server
  • Test kết nối MCP độc lập với /mcp test
  • Review cấu hình MCP trong thư mục mcp/

Commands Not Available After Install

  • Đảm bảo plugin được cài đặt thành công: /plugin list --installed
  • Kiểm tra nếu plugin được kích hoạt: /plugin status plugin-name
  • Khởi động lại Claude Code: exit và mở lại
  • Kiểm tra xung đột đặt tên với các lệnh hiện có

Hook Execution Issues

  • Xác minh các file hook có các quyền đúng
  • Kiểm tra cú pháp hook và tên sự kiện
  • Review logs hook để biết chi tiết lỗi
  • Test hooks thủ công nếu có thể

Tài Nguyên Thêm / Additional Resources