返回播客Claude
Claude Code skills
分享技能
Speaker 1: Skills become more valuable when shared.
skill 在分享中变得更有价值。
A PR review skill that only you use is helpful.
只有你一个人使用的 PR review skill 是有帮助的。
The same skill shared across your team standardizes code review and provides a consistent experience amongst your organization which is much better.
同样的 skill 在团队中分享,可以规范代码审查,为整个组织提供一致的体验,这要好得多。
Here are ways you can share your skills.
下面是分享 skill 的几种方式。
Speaker 1: Now the simplest sharing method is committing skills to your repository.
最简单的分享方式是将 skill 提交到你的代码仓库。
Place them in dot-claud-slash-skills.
把它们放在 .claude/skills 目录下。
Anyone who clones the repository gets these skills automatically.
任何克隆该仓库的人都会自动获得这些 skill。
No extra installation, it's just what you're doing already.
无需额外安装,这就是你已经在做的事情。
When you push updates, everyone gets them on their next pull.
当你推送更新时,所有人在下次拉取时就能获得。
This works well for team coding standards, project-specific workflows, or skills that reference your codebase structure.
这非常适合团队编码规范、项目专属工作流,或引用你代码库结构的 skill。
Speaker 1: Another way you can distribute your skills is through plugins.
另一种分发 skill 的方式是通过插件。
Think of plugins as ways to extend Claude Code with custom functionality, but designed to be shared across teams and projects.
可以把插件理解为扩展 Claude Code 自定义功能的途径,专为跨团队和跨项目分享而设计。
In your plugin project, create a directory called skills.
在你的插件项目中,创建一个名为 skills 的目录。
This will then follow a similar file structure to the dot-claud directory in our project with the name of the skill with a skill-dot-MD file.
其文件结构与项目中的 .claude 目录类似,包含以 skill 名称命名的 skill.md 文件。
And after you distribute your plugin to a marketplace, other users can download it into Claude Code for themselves to use.
将插件发布到插件市场后,其他用户可以自行下载到 Claude Code 中使用。
This is best if your skills have functionality that isn't too project-specific and can be used by community members.
如果你的 skill 功能不过于项目特定,可以被社区成员使用,这种方式最合适。
Speaker 1: Administrators can deploy skills organization-wide through managed settings.
管理员可以通过托管设置在整个组织范围内部署 skill。
Enterprise skills take highest priority.
企业级 skill 具有最高优先级。
Like we discussed before, they override personal project and plugin skills with the same name.
如我们之前讨论的,它们会覆盖同名的个人、项目和插件 skill。
This is for mandatory standards, security requirements, compliance workflows, or coding practices that must be consistent across the organization.
适用于必须在整个组织中保持一致的强制性标准、安全要求、合规工作流或编码规范。
Keyword, must.
关键词:必须。
Speaker 1: Here's some that surprises people: sub-agents don't automatically see your skills.
有一点让很多人感到意外:子代理不会自动看到你的 skill。
Yeah.
嗯。
When you delegate a task to a sub-agent, it starts with a fresh clean context.
当你将任务委托给子代理时,它会以全新的空白上下文启动。
Built-in agents like the explorer, planner, and verify can't access skills at all.
像 explorer、planner、verify 这些内置代理根本无法使用任何 skill。
Only custom sub-agents you define can use them, and only when you explicitly list them.
只有你自定义的子代理才能使用它们,而且只有在你明确列出时才行。
To create a custom sub-agent with skills, add an agent-dot-MD file in dot-claud-slash-agents.
要创建带有 skill 的自定义子代理,在 .claude/agents 中添加一个 agent.md 文件。
The skills field lists which skills to load.
skills 字段列出要加载哪些 skill。
These skills are loaded when the sub-agent starts, not on demand like in the main conversation.
这些 skill 在子代理启动时加载,而不是像主对话中那样按需加载。
So, take that into consideration.
所以,请将这一点考虑在内。
First ensure the skills exist.
首先确认 skill 存在。
Okay, it exists.
好,它存在了。
Then create the sub-agent using the Claude Code sub-agent creator.
然后使用 Claude Code 子代理创建器创建子代理。
If you have a sub-agent that you want to add these skills to already, just go to the existing agent-dot-MD file.
如果你已有一个子代理想要添加这些 skill,直接进入现有的 agent.md 文件即可。
Then after that, create the skills field and add your skills.
之后,创建 skills 字段并添加你的 skill。
When you delegate to the sub-agent, it has both skills loaded and applies them to every single review.
当你委托给子代理时,它已加载两个 skill,并将它们应用于每一次审查。
Now this pattern works really well when you want isolated task delegation with specific expertise.
当你想要带有特定专业能力的隔离任务委托时,这种模式非常有效。
Different sub-agents need different skills: front-end reviewer versus back-end reviewer.
不同的子代理需要不同的 skill:前端审查员对比后端审查员。
You want to enforce standards and delegate work without relying on prompts.
你希望在不依赖提示词的情况下强制执行标准并委托工作。
Only list skills that are always relevant to the sub-agent's purpose.
只列出对子代理目的始终相关的 skill。
Speaker 1: Share skills through project directories for team access, plugins for cross-repository distribution, or enterprise deployment for organization-wide standards.
通过项目目录分享 skill 以供团队访问,通过插件进行跨仓库分发,或通过企业部署实现组织范围内的标准化。
Sub-agents don't inherit skills automatically, so list them explicitly in the sub-agent skills field.
子代理不会自动继承 skill,因此要在子代理的 skills 字段中明确列出。
Built-in agents can't access skills, only custom sub-agents can in your dot-claud-slash-agents.
内置代理无法访问 skill,只有 .claude/agents 中的自定义子代理才能访问。
Skills load when the sub-agent starts, so only list skills that are always relevant to its purpose.
skill 在子代理启动时加载,因此只列出对其目的始终相关的 skill。