使用技能
技能是按需加载的知识文档,用于指导 Hermes 完成特定任务——从生成 ASCII 艺术到管理 GitHub Pull Request。本指南将带你了解日常如何使用技能。
如需完整的技术参考,请参阅 技能系统。
查找技能
每个 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 前文的 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/ 目录,即可立即生效。
代理也可以使用 skill_manage 自行创建和更新技能。在解决复杂问题后,Hermes 通常会提议将该方法保存为技能以备下次使用。
按平台管理技能
控制哪些技能在哪些平台上可用:
hermes skills
这将打开一个交互式 TUI 界面,可按平台(CLI、Telegram、Discord 等)启用或禁用技能。当你希望某些技能仅在特定上下文中可用时非常有用——例如,将开发类技能从 Telegram 中移除。
技能 vs 记忆
两者都可在会话间持久化,但用途不同:
| 技能 | 记忆 | |
|---|---|---|
| 内容 | 过程性知识——如何做事 | 事实性知识——事物是什么 |
| 加载时机 | 按需加载,仅在相关时 | 自动注入每个会话 |
| 大小 | 可以很大(数百行) | 应该紧凑(仅关键事实) |
| 成本 | 未加载时不消耗令牌 | 每次会话都有少量但持续的令牌消耗 |
| 示例 | “如何部署到 Kubernetes” | “用户偏好深色模式,位于 PST 时区” |
| 创建者 | 你、代理或从中心安装 | 代理根据对话内容生成 |
经验法则:如果你会把它放在参考文档中,那就是技能;如果你会把它写在便利贴上,那就是记忆。
使用建议
保持技能专注。一个试图涵盖“全部 DevOps”的技能会过于冗长且模糊。而一个专注于“将 Python 应用部署到 Fly.io”的技能则足够具体,真正有用。
让代理创建技能。在完成复杂多步骤任务后,Hermes 通常会提议将该流程保存为技能。请接受——这些由代理生成的技能会完整记录整个工作流,包括途中发现的陷阱。
使用分类。将技能组织到子目录中(如 ~/.hermes/skills/devops/、~/.hermes/skills/research/ 等)。这有助于保持列表清晰,并帮助代理更快找到相关技能。
在技能过时后及时更新。 如果你使用某个技能时遇到该技能未涵盖的问题,请告知 Hermes 用你学到的新知识更新该技能。未得到维护的技能会变成负担。
有关完整的技能参考信息——包括前言字段、条件激活、外部目录等——请参阅 技能系统。