Mục tiêu học tập
Sau bài này, bạn sẽ có thể:- ✅ Chia sẻ skill với team bằng cách commit
.claude/skills/vào Git repository - ✅ Phân phối skill qua plugin marketplace cho cộng đồng rộng hơn
- ✅ Deploy skill cho toàn tổ chức qua enterprise managed settings với priority cao nhất
- ✅ Configure custom subagent dùng skill — hiểu gotcha “subagent không inherit skill tự động”
- ✅ Chọn phương pháp share phù hợp cho từng scenario (team / cross-repo / enterprise)
Mở đầu: Từ “skill của tôi” sang “skill của team”
Một skillpr-review mà chỉ mình bạn có là tốt. Cùng skill đó share cho cả team 12 người — giờ thành game changer:
- Mọi PR review output cùng format (reviewer mới không phải “học style”)
- Feedback tone nhất quán (không có review harsh chỗ này, soft chỗ khác)
- Compliance check (security, a11y) không bị miss
- New hire onboard nhanh: clone repo về, skill đã nằm trong
.claude/skills/, Claude của họ review đúng style từ ngày đầu
“Skills become much more valuable when they’re shared. A PR review skill that only you use is helpful, but that same skill shared across your entire team standardizes code review and creates a consistent experience across your organization.”Bài này cover 3 phương pháp share, từ đơn giản nhất (Git commit) tới mạnh nhất (enterprise deploy). Plus: cách wire skill vào subagent — điểm gây surprise nhất.
3 phương pháp share — Tổng quan
| Phương pháp | Phạm vi | Priority | Dễ setup | Use case |
|---|---|---|---|---|
| 1. Repository commit | Team cùng repo | Project (tầng 3) | ⭐⭐⭐⭐⭐ | Team standards, project workflow |
| 2. Plugin marketplace | Cross-repo, cross-team | Plugins (tầng 4) | ⭐⭐⭐ | Reusable skill cho cộng đồng |
| 3. Enterprise managed | Toàn tổ chức | Enterprise (tầng 1) | ⭐⭐ | Mandatory standards, compliance |
Phương pháp 1: Commit skill vào repository
Đây là cách đơn giản nhất, phổ biến nhất, và đủ cho 80% trường hợp team.Cấu trúc thư mục
Workflow chia sẻ
Step 1: Tạo skill như đã học ở Bài 15.2/15.4, nhưng đặt ở.claude/skills/ (project) thay vì ~/.claude/skills/ (personal):
Ưu điểm
- Zero friction: dev đã biết Git, không cần học tool mới
- Version control:
git log .claude/skills/cho lịch sử thay đổi skill - PR review cho skill: skill mới được team review như code khác
- Rollback được:
git revertnếu skill mới phá vỡ workflow - Branch per skill: thử nghiệm skill mới trên feature branch
Nhược điểm
- Phụ thuộc repo: chỉ dùng được khi clone repo này → không dùng cho skill cross-project
- Scope limit: team nhỏ OK. Tổ chức 500 người dùng nhiều repo → không scale
Prompt tip cho việc setup lần đầu
Litton (AI University) gợi ý: Trong VS Code Claude Code, bạn có thể bảo Claude tự tạo structure:.claude/skills/ với sample skill mẫu. Sau đó bạn replace content.
⚠️ Gotcha: Enable skill trong settings
Trước khi skill hoạt động, bạn (và mỗi team member) phải enable skill feature: Settings → Search skill → Check “use agent skills”. Nếu quên bước này, skill không trigger dù đã đúng tất cả. Otto: “Then only you will be able to do anything here.”Case study: Team engineering 12 người
Trước khi share skill:- 12 dev, 12 style review PR hơi khác nhau
- New hire mất 2 tuần hiểu “style review của team này”
- Tech lead paste lại review instruction ~40 lần/tuần trong các session Claude
.claude/skills/pr-review:
- 12 dev cùng format review output
- New hire: ngày 1 clone repo, Claude review theo đúng style team
- Tech lead gõ “review PR #142” → skill trigger, 0 dòng instruction prefix
Phương pháp 2: Plugin marketplace
Khi nào cần
Phương pháp 1 OK cho skill gắn với 1 repo. Nhưng nếu bạn có skill reusable qua nhiều project, nhiều team, nhiều tổ chức? Plugin là cách tiếp theo. Ví dụ skill phù hợp plugin:seo-blog-writer— áp dụng cho mọi project content marketingjest-test-generator— hữu ích cho bất kỳ JS project nàoowasp-security-audit— check chung cho web appconventional-commits— standard cross-industry
Plugin structure
Distribution
- Push plugin lên GitHub repo hoặc npm package
- Publish lên marketplace (khi Claude Code hỗ trợ)
- User install:
claude plugin install <plugin-name> - Skills trong plugin available ở tầng priority 4 (plugin — thấp nhất)
Skill Anthropic ship sẵn (ví dụ marketplace)
Tính đến thời điểm viết, Anthropic đã ship một số skill built-in như plugin demonstrate:skill-creator— wizard tạo skill mới (tự tạo skill!)canvas-design— design canvas layouttheme-factory— tạo color themeslack-gif-creator— generate GIF cho Slackpowerpoint-generator— tạo PowerPoint deck
Ưu điểm
- Cross-team, cross-org reuse
- Community contribute được (open source plugin)
- Phân phối rộng (hàng ngàn người dùng)
Nhược điểm
- Priority thấp nhất (tầng 4) → enterprise/personal/project đè được
- Quality phụ thuộc plugin author
- Phải tin plugin author (không execute code lạ từ plugin)
Security concern
Plugin có thể chứa script trongscripts/. Khi skill trigger, Claude có thể chạy script đó. Luôn audit plugin trước khi cài — xem SKILL.md và scripts của plugin, chắc chắn không có gì suspicious.
Phương pháp 3: Enterprise managed settings
Khi nào cần
Khi bạn muốn mandatory standards — không ai trong tổ chức được bypass:- Security audit phải chạy trên mọi code review
- Compliance check phải có cho healthcare/finance
- Code style phải nhất quán toàn công ty
Cấu trúc managed settings
Admin deploy filemanaged-settings.json ở location platform-specific. Trong đó khai báo skill location + policy:
skillDirectories— folder trên máy dev chứa enterprise skill (deploy qua MDM hoặc image)strictKnownMarketplaces— whitelist marketplace. Dev chỉ được cài plugin từ nguồn này
Case study: Ngân hàng với compliance requirements
Pain: Ngân hàng có 300 dev, yêu cầu mỗi PR review phải check:- Không log PII (personally identifiable information) ra console
- Không hard-code secret
- Audit log tất cả query access DB production
- Dev gõ “review this PR” → trigger skill
code-review - Enterprise version override nếu dev có personal
code-review - 3 check compliance luôn chạy, không miss
personal-code-review riêng cho style cá nhân. Enterprise code-review là mandatory, không bypass.”
Ưu điểm
- Priority cao nhất — không ai bypass được
- Centralized management — admin deploy 1 lần, toàn org có
- Security + compliance enforced automatically
Nhược điểm
- Cần admin access platform/deployment tool (MDM, corp laptop image)
- Setup phức tạp (MDM profile, managed settings JSON)
- Friction với dev cá nhân (họ mất customization rights cho cùng skill name)
Workaround cho dev: đặt tên khác
Dev không thích style enterprise? Tạo skill với tên khác, trigger cùng thứ:code-review hay my-code-review?” — dev chọn.
Skill với subagent — Gotcha quan trọng
Đây là phần hay bỏ qua nhưng critical nếu team bạn dùng subagent.Gotcha chính: Subagent KHÔNG inherit skill tự động
Tưởng tượng setup của bạn:frontend-reviewer → subagent tự có 2 skill trên.
Thực tế: Không. Otto:
“Subagents don’t automatically see your skills. When you delegate a task to a subagent, it starts with a fresh, clean context.”Subagent fresh context. Skill không auto available.
Thêm nữa: Built-in agent không access skill được
Có 2 loại subagent:- Built-in (Explorer, Plan, Verify) — không access skill được, ever
- Custom (bạn tạo) — access được skill, nhưng phải explicit list
Cách đúng: Khai báo skills field trong agent.md
skills: list skill name (không có path). Claude load các skill này khi subagent start.
Khi subagent load skill?
- Khi subagent start (không on-demand như main conversation)
- Tất cả skill trong
skills:load hết vào subagent context - Dữ liệu tổng của các skill ăn context của subagent
Pattern: Specialized subagent + shared skill
Otto pattern:“Your front-end developer subagent can use a component pattern skill. Your UI reviewer subagent can use a design system skill, but both can load and use the same accessibility standard skill.”
a11y-standard viết 1 lần, dùng 2 chỗ.
Pattern này phù hợp khi:
- Bạn muốn isolated task delegation với specific expertise
- Subagent khác nhau cần skill khác nhau (frontend vs backend)
- Enforce standards trong delegated work không dựa vào prompt
Workflow tạo subagent với skill
Cách 1: Dùng command /agents trong Claude Code
- Tên subagent
- Description
- Tools allowed
- Skills to load ← chọn từ danh sách skill đã có
.claude/agents/<name>.md với đúng frontmatter.
Cách 2: Tạo file manual
Đảm bảo skill exist trước
Trước khi thêm skill vào subagent, check skill thực sự tồn tại trong.claude/skills/ hoặc ~/.claude/skills/. Nếu không, subagent sẽ fail khi start.
So sánh 3 phương pháp share — Decision matrix
Checklist chọn phương pháp
| Use case | Phương pháp |
|---|---|
| Team 5-50 người cùng codebase | Git repo (priority 3) |
| Skill cross-repo, share với cộng đồng open source | Plugin (priority 4) |
| Security policy mandatory toàn công ty | Enterprise (priority 1) |
| Trial skill với 2-3 dev trước khi scale | Git repo branch riêng, merge sau |
| Skill phụ thuộc MCP server nội bộ | Git repo (kèm setup MCP trong README) |
Case studies theo role
Sales team sharing CRM prep skill
Setup:.claude/skills/prep-call/ trong repo sales-playbook-internal.
Skills content:
- Pull CRM account data (qua MCP
salesforce-mcp) - Pull email history (qua MCP
gmail-mcp) - Output: 1-page briefing với talking points
Marketing team sharing brand voice skill
Setup:.claude/skills/blog-post-writer/ trong repo content-marketing-hub.
Skills content:
references/brand-voice.md— trích từ brand book 40 trangreferences/seo-checklist.md— 27 điểmreferences/past-winners.md— 10 blog post top performanceSKILL.mdorchestrate workflow
Finance team — Enterprise compliance skill
Setup: Enterprise/opt/acme-finance/skills/sox-compliance-check/.
Skills content:
- Mandatory check cho SOX compliance mọi financial report
- Audit log mọi access vào financial data
- Escalation path nếu detect violation
Legal — Plugin cho OSS community
Setup:contract-review-open plugin publish lên npm.
Skills content:
- Review NDA, MSA, SOW theo templates public
- Red flag common patterns
- Không include proprietary data (open source)
Healthcare — Multi-tier setup
Setup:- Enterprise:
mandatory-phi-check(PHI = Protected Health Info) - Project:
clinical-research-workflow(trong repo study-specific) - Personal:
my-research-style(của mỗi researcher)
- User gõ “review this study data” → semantic match
phi-checkfirst (enterprise override) - Rồi Claude còn match
clinical-research-workflow(project) - Nếu personal
my-research-stylecùng tên → bị enterprise đè
Anti-patterns — Sai lầm khi share skill
❌ Push skill chứa secret vào repo
Sai lầm:SKILL.md: “run with DEPLOY_API_KEY env set.” Secret ở .env file trong .gitignore.
❌ Enterprise deploy skill không test cẩn thận
Sai lầm: Admin push enterprisecode-review ảnh hưởng 500 dev. Sau 1 ngày mới phát hiện skill có bug, break review của ai cũng.
Tại sao tệ: Enterprise priority cao nhất → không ai escape được bug.
Cách đúng:
- Trial ở team nhỏ (10-20 dev) trước
- Staging environment trước production deploy
- Rollback plan sẵn (version trước trong managed settings)
❌ Plugin chứa code malicious
Sai lầm: Install plugin lạ mà không audit. Plugin có scriptscripts/steal-credentials.sh.
Tại sao tệ: Khi skill trigger, Claude chạy script → credential leak.
Cách đúng:
- Admin whitelist marketplace qua
strictKnownMarketplaces - Audit plugin source code trước install
- Enterprise: block plugin install ngoài whitelist
❌ Skill trong repo nhưng không document
Sai lầm:.claude/skills/ có 15 skill, README.md repo không mention.
Tại sao tệ: New hire clone repo không biết skill nào có. Dùng một vài cái ngẫu nhiên, miss những cái hữu ích.
Cách đúng: README.md repo có section “Available Skills”:
❌ Subagent skill list không match thực tế
Sai lầm:.claude/agents/*.md sau mỗi skill change.
Áp dụng ngay
Bài tập 1: Share skill đầu tiên cho team (~15 phút)
Bước 1: Lấy 1 skill bạn đã làm ở Bài 15.2 hoặc 15.4, đang ở personal~/.claude/skills/.
Bước 2: Quyết định: skill này có phù hợp project này không? Nếu có, di chuyển sang project:
README.md của project với section skill list.
Bước 4: Commit:
Bài tập 2: Tạo subagent dùng skill (~10 phút)
Bước 1: Pick 2-3 skill bạn muốn combine. Bước 2: Trong Claude Code session, gõ/agents để wizard mở.
Bước 3: Điền:
- Name:
<role>-reviewer(ví dụfrontend-reviewer) - Description: role của subagent
- Skills: list 2-3 skill ở Bước 1
.claude/agents/<name>.md. Review frontmatter có skills: field chưa.
Bước 5: Test: trong Claude Code, delegate task cho subagent — kiểm tra có dùng skill không.
Tóm tắt bài học
🎯 3 phương pháp share: Git repo (team, simple), Plugin (cross-org, community), Enterprise managed (mandatory, toàn tổ chức). 🎯 Git repo là default choice..claude/skills/ commit vào Git, team pull về là có. 80% case đủ.
🎯 Enterprise override mọi thứ. Priority 1, không bypass. Chỉ dùng cho mandatory standards. Test cẩn thận trước khi deploy.
🎯 Subagent KHÔNG inherit skill tự động. Phải explicit list trong skills: field của .claude/agents/*.md. Built-in agent (Explorer, Plan, Verify) không access skill được.
🎯 Security when sharing: No secrets in Git. Whitelist plugin marketplace qua strictKnownMarketplaces. Audit plugin trước install.
Bài tiếp theo
Skill đã share. Team dùng. Nhưng chắc chắn sẽ có lúc: “skill không trigger!”, “Claude confused giữa 2 skill”, “plugin skill biến mất sau khi cài!” Bài cuối cùng 15.6 là debug playbook — 6 category sự cố phổ biến nhất và cách fix nhanh. ➡️ Bài tiếp theo: Bài 15.6: Khắc phục sự cố skillTài liệu tham khảo
- Anthropic Academy — “Sharing skills”
- Video — “Distributing skills”
- Claude Code —
/agentscommand docs - Enterprise managed settings — official Claude Code docs