使用技能
技能是按需加载的知识文档,用来教会 Hermes 完成特定任务,从生成 ASCII 艺术到管理 GitHub PR 都可以覆盖。本指南聚焦日常使用技能时最常见的几种场景。
如需完整的技术参考,请参阅 技能系统。
查找技能
每个 Hermes 安装都自带一组内置技能。查看当前可用的技能:
# In any chat session:
/skills
# Or from the CLI:
hermes skills list
这会显示一个简洁的列表,包含技能名称和描述:
ascii-art Generate ASCII art using pyfiglet, cowsay, boxes...
arxiv Search and retrieve academic papers from arXiv...
github-pr-workflow Full PR lifecycle — create branches, commit...
plan Plan mode — inspect context, write a markdown...
excalidraw Create hand-drawn style diagrams using Excalidraw...
搜索技能
# Search by keyword
/skills search docker
/skills search music
技能中心(Skills Hub)
官方可选技能,也就是那些更重、更小众、默认不启用的技能,可通过“技能中心”获取:
# Browse official optional skills
/skills browse
# Search the hub
/skills search blockchain
使用技能
所有已安装的技能都会自动变成斜杠命令。你只需要直接输入技能名即可:
# Load a skill and give it a task
/ascii-art Make a banner that says "HELLO WORLD"
/plan Design a REST API for a todo app
/github-pr-workflow Create a PR for the auth refactor
# Just the skill name (no task) loads it and lets you describe what you need
/excalidraw
你也可以通过自然语言触发技能。只要明确要求 Hermes 使用某个技能,它就会通过 skill_view 工具按需加载该技能内容。
逐步披露(Progressive Disclosure)
技能采用高效的令牌加载机制。代理不会一次性加载全部内容:
skills_list()— 所有技能的简要列表(约 3k 个令牌)。在会话开始时加载。skill_view(name)— 单个技能的完整SKILL.md内容。仅当代理判断需要时才加载。skill_view(name, file_path)— 技能内的特定参考文件。仅在实际需要时才加载。
这意味着,只有真的用到某个技能时,才会额外消耗对应的令牌。
从中心安装技能
官方可选技能会随 Hermes 一起发布,但默认不会自动启用,需要手动安装:
# Install an official optional skill
hermes skills install official/research/arxiv
# Install from the hub in a chat session
/skills install official/creative/songwriting-and-ai-music
安装后的效果通常是:
- 将技能目录复制到
~/.hermes/skills/ - 它会出现在你的
skills_list输出中 - 可作为斜杠命令使用
已安装的技能将在新会话中生效。若希望在当前会话中立即生效,请使用 /reset 启动新会话,或添加 --now 立即清除提示缓存(下一回合会多消耗一些令牌)。
验证安装
# Check it's there
hermes skills list | grep arxiv
# Or in chat
/skills search arxiv
配置技能设置
有些技能会在 frontmatter 中声明所需配置项:
metadata:
hermes:
config:
- key: tenor.api_key
description: "Tenor API key for GIF search"
prompt: "Enter your Tenor API key"
url: "https://developers.google.com/tenor/guides/quickstart"
第一次加载这类技能时,Hermes 会提示你填写相关值。这些配置会被写入 config.yaml 的 skills.config.* 下。
可通过 CLI 管理技能配置:
# Interactive config for a specific skill
hermes skills config gif-search
# View all skill config
hermes config get skills.config
创建自己的技能
技能本质上就是带有 YAML frontmatter 的 Markdown 文件。写一个最小可用版本通常只需要几分钟。
1. 创建目录
mkdir -p ~/.hermes/skills/my-category/my-skill
2. 编写 SKILL.md
---
name: my-skill
description: Brief description of what this skill does
version: 1.0.0
metadata:
hermes:
tags: [my-tag, automation]
category: my-category
---
# My Skill
## When to Use
Use this skill when the user asks about [specific topic] or needs to [specific task].
## Procedure
1. First, check if [prerequisite] is available
2. Run `command --with-flags`
3. Parse the output and present results
## Pitfalls
- Common failure: [description]. Fix: [solution]
- Watch out for [edge case]
## Verification
Run `check-command` to confirm the result is correct.
3. 添加参考文件(可选)
技能也可以带上一些支持性文件,供代理按需加载:
my-skill/
├── SKILL.md # Main skill document
├── references/
│ ├── api-docs.md # API reference the agent can consult
│ └── examples.md # Example inputs/outputs
├── templates/
│ └── config.yaml # Template files the agent can use
└── scripts/
└── setup.sh # Scripts the agent can execute
在 SKILL.md 中引用这些文件:
For API details, load the reference: `skill_view("my-skill", "references/api-docs.md")`
4. 测试
启动新会话并尝试使用你的技能:
hermes chat -q "/my-skill help me with the thing"
技能不需要额外注册。只要把它放进 ~/.hermes/skills/ 目录,Hermes 就能发现它。
代理本身也可通过 skill_manage 创建和更新技能。在解决复杂问题后,Hermes 常常会提议将解决方案保存为技能以备下次使用。
平台级技能管理
控制哪些技能在哪些平台上可用:
hermes skills
这会打开一个交互式界面,让你按平台(CLI、Telegram、Discord 等)启用或禁用技能。当你希望某些技能只在特定场景下可用时,这会很有帮助,例如把开发类技能从 Telegram 上关掉。
技能 vs 记忆
两者都是跨会话持久化的,但用途不同:
| 技能 | 记忆 | |
|---|---|---|
| 内容 | 过程性知识——如何做事 | 事实性知识——事物是什么 |
| 加载时机 | 按需加载,仅在相关时 | 自动注入每个会话 |
| 大小 | 可以很大(数百行) | 应保持紧凑(仅关键事实) |
| 成本 | 未使用时不消耗令牌 | 每次会话都有少量固定开销 |
| 示例 | “如何部署到 Kubernetes” | “用户偏好深色模式,位于 PST 时区” |
| 创建者 | 你、代理,或从中心安装 | 代理根据对话内容生成 |
经验法则: 如果它更像参考文档里的流程,那通常是技能;如果它更像你想长期记住的一条事实,那通常是记忆。
使用建议
- 保持技能专注。 试图覆盖“整个 DevOps”的技能会过于冗长且模糊。而像“将 Python 应用部署到 Fly.io”这样的具体技能则足够明确,真正实用。
- 让代理帮你创建技能。 在完成复杂的多步骤任务后,Hermes 往往会提议把流程保存成技能。通常值得接受,因为这些技能会顺手把中途踩过的坑也一起记录下来。
- 使用分类组织。 将技能按子目录组织(
~/.hermes/skills/devops/、~/.hermes/skills/research/等)。这有助于保持列表清晰,并帮助代理更快找到相关技能。 - 及时更新过时的技能。 若使用某技能时遇到未涵盖的问题,请告诉 Hermes 更新该技能。未维护的技能最终会变成负担。
如需完整的技能参考——包括 frontmatter 字段、条件激活、外部目录等更多细节,请查阅 技能系统。