xiantong 文档

技能

扩展 xiantong 的能力

技能可以扩展 xiantong 的能力。创建一个包含说明的 SKILL.md 文件后,xiantong 就会把它加入自己的工具箱——在相关场景下自动使用,或当你直接通过 @mention 提及时调用。技能遵循 Agent Skills 开放标准,因此与 Claude Code 以及其他支持该规范的工具兼容。

创建技能#

直接让 xiantong 创建即可。 描述你想要的技能,Agent 就会帮你创建:

Create a skill called "commit" that generates conventional commit messages

xiantong 知道技能文件应放在哪里,也知道如何编写。这就是 agent-native 的方式——与其手动创建文件,不如让 Agent 替你完成。

技能结构#

技能是在工作区中的一个文件夹,里面包含一个 SKILL.md 文件:

~/.xiantong/workspaces/{id}/skills/{slug}/
├── SKILL.md # 必需:YAML frontmatter + 指令
└── icon.png # 自动生成:从 URL 缓存的图标(如果已指定)

SKILL.md 格式#

---
name: Commit
description: Create well-formatted git commit messages
icon: 🔧
globs:
- "**/.git/**"
alwaysAllow:
- Bash(git status)
- Bash(git diff)
requiredSources:
- github
---

When creating commits:
- Use conventional commit format (feat:, fix:, docs:, etc.)
- Keep subject line under 72 characters
- Explain why, not what

frontmatter 会告诉 xiantong 何时使用该技能。正文则包含 Agent 在调用该技能时要遵循的说明。

Frontmatter 字段#

字段必需说明
name技能的显示名称
description在技能列表中显示的简短描述
icon表情符号(例如 🔧)或 URL。不支持相对路径。
globs自动触发此技能的文件模式(例如 "**/*.test.ts"
alwaysAllow技能激活时自动允许的工具(例如 "Bash(npm test)"
requiredSources调用技能时自动启用的来源 slug(例如 "linear"

当技能声明了 requiredSources 时,这些来源会在技能被调用时自动为当前会话启用——这样 Agent 从第一轮开始就可以访问这些工具。来源必须已在工作区中配置并完成认证;未认证的来源会被跳过并在运行时处理。

有关完整的 SKILL.md schema,包括 allowed-toolscontextagent 等高级字段,请参阅 Claude Code skills documentation

使用技能#

在消息中用 @ 提及技能:

@commit
@review the authentication changes
@deploy to staging

技能位置#

位置路径优先级
工作区~/.xiantong/workspaces/{id}/skills/{slug}/第一优先(覆盖内置技能)
内置随 xiantong 一起打包回退

如果你创建了与内置技能同名 slug 的工作区技能,它会以你的自定义行为覆盖内置技能。