使用技能
技能是按需加载的知识文档,教 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
技能中心
官方可选技能(较重或小众的技能,默认不激活)可通过中心获取:
# 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 工具加载。
渐进式加载
技能使用令牌高效的加载模式。Agent 不会一次加载所有内容:
skills_list()— 所有技能的紧凑列表(约 3k 令牌)。在会话开始时加载。skill_view(name)— 一个技能的完整 SKILL.md 内容。当 Agent 决定需要该技能时加载。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
~/.hermes/skills/my-category/my-skill/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. 添加参考文件(可选)
技能可以包含 Agent 按需加载的支持文件:
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/ 中就生效了。
提示
Agent 也可以使用 skill_manage 自行创建和更新技能。在解决复杂问题后,Hermes 可能会主动提供将方法保存为技能以备下次使用。
按平台管理技能
控制哪些技能在哪些平台上可用:
hermes skills
这会打开一个交互式 TUI,你可以在其中按平台(CLI、Telegram、Discord 等)启用或禁用技能。当你希望某些技能仅在特定上下文中可用时很有用——例如,将开发技能从 Telegram 中移除。
技能与记忆的对比
两者都跨会话持久化,但用途不同:
| 技能 | 记忆 | |
|---|---|---|
| 内容 | 程序性知识——如何做事 | 事实性知识——事物是什么 |
| 加载时机 | 按需加载,仅在相关时 | 自动注入每个会话 |
| 大小 | 可以很大(数百行) | 应该紧凑(仅关键事实) |
| 成本 | 加载前零令牌消耗 | 小但持续的令牌成本 |
| 示例 | "如何部署到 Kubernetes" | "用户偏好深色模式,住在 PST 时区" |
| 创建者 | 你、Agent 或从中心安装 | Agent,基于对话内容 |
经验法则: 如果你会把它放在参考文档中,那就是技能。如果你会把它写在便利贴上,那就是记忆。
技巧
保持技能聚焦。 一个试图覆盖"所有 DevOps"的技能会太长且太模糊。一个覆盖"将 Python 应用部署到 Fly.io"的技能足够具体,才能真正有用。
让 Agent 创建技能。 在完成复杂的多步骤任务后,Hermes 经常会主动提供将方法保存为技能。接受吧——这些由 Agent 编写的技能捕捉了确切的工作流程,包括过程中发现的陷阱。
使用分类。 将技能组织到子目录中(~/.hermes/skills/devops/、~/.hermes/skills/research/ 等)。这使列表易于管理,并帮助 Agent 更快找到相关技能。
在技能过时时更新。 如果你使用一个技能时遇到了它未涵盖的问题,告诉 Hermes 用你学到的东西更新技能。不被维护的技能会变成负担。
完整的技能参考——包括 frontmatter 字段、条件激活、外部目录等——请参阅技能系统。