Skip to main content

使用技能

技能是按需加载的知识文档,用于教会 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)

技能采用高效的令牌加载机制。代理不会一次性加载全部内容:

  1. skills_list() — 所有技能的简要列表(约 3k 个令牌)。在会话开始时加载。
  2. skill_view(name) — 单个技能的完整 SKILL.md 内容。仅当代理判断需要时才加载。
  3. 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

操作流程如下:

  1. 将技能目录复制到 ~/.hermes/skills/
  2. 它会出现在你的 skills_list 输出中
  3. 可作为斜杠命令使用
tip

已安装的技能将在新会话中生效。若希望在当前会话中立即生效,请使用 /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.yamlskills.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. 添加参考文件(可选)

技能可以包含支持性文件,由代理按需加载:

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/ 目录,即可立即生效。

info

代理本身也可通过 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 更新该技能。未维护的技能最终会变成负担。

如需完整的技能参考——包括 frontmatter 字段、条件激活、外部目录等更多细节,请查阅 技能系统