跳到主要内容

使用技能

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

官方可选技能(默认未启用、较重或较小众的技能)可以通过 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 工具加载该技能。

渐进式加载

技能采用一种节省 token 的加载方式,agent 不会一开始就把所有技能内容都读进来:

  1. skills_list() — 所有技能的紧凑列表(约 3k tokens),会在会话开始时加载。
  2. skill_view(name) — 某个技能的完整 SKILL.md 内容。只有当 agent 判断自己需要这个技能时才会加载。
  3. skill_view(name, file_path) — 技能中的某个特定参考文件,仅在需要时加载。

这意味着技能在真正被使用之前不会消耗 token。


从 Hub 安装

官方可选技能会随 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. 它会变成一个可用的斜杠命令
提示

新安装的技能会在新会话中生效。如果你想让它在当前会话中立即可用,可以用 /reset 重新开始,或者加上 --now 立即让提示缓存失效(下一轮会多花一些 token)。

验证安装

# Check it's there
hermes skills list | grep arxiv

# Or in chat
/skills search arxiv

插件提供的技能

插件可以使用带命名空间的名字(plugin:skill)打包自己的技能。这样可以避免和内置技能重名。

# Load a plugin skill by its qualified name
skill_view("superpowers:writing-plans")

# Built-in skill with the same base name is unaffected
skill_view("writing-plans")

插件技能不会出现在系统提示里,也不会显示在 skills_list 中。它们是显式按需加载的;只有当你知道某个插件提供了某个技能时,才去主动加载。加载后,agent 会看到一个提示横幅,列出同一插件下的同级技能。

关于如何在你自己的插件中随附技能,请参阅 Build a Hermes Plugin -> Bundle skills


配置技能设置

有些技能会在 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. 添加参考文件(可选)

技能可以附带一些支持文件,供 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 中排除。


技能与记忆

两者都能跨会话持久存在,但用途不同:

SkillsMemory
What程序性知识,教你“怎么做”事实性知识,记录“是什么”
When按需加载,只有相关时才进入上下文每个会话都会自动注入
Size可以较大(数百行)应当尽量精简(只保留关键事实)
Cost加载前不花 tokentoken 成本小但持续存在
Examples“如何部署到 Kubernetes”“用户偏好深色模式,住在 PST 时区”
Who creates你、agent,或从 Hub 安装agent 基于对话自动整理

经验法则: 如果一段内容更像参考文档,那它更适合做技能;如果更像写在便利贴上的提醒,那它更适合做记忆。


小贴士

让技能保持聚焦。 一个试图覆盖“所有 DevOps”的技能通常会太长、太泛。一个专注于“把 Python 应用部署到 Fly.io”的技能,则足够具体,也更有实际价值。

让 agent 帮你创建技能。 完成复杂的多步骤任务后,Hermes 常常会提出把这套方法保存成技能。建议直接接受,这些由 agent 编写的技能,通常会把中途踩过的坑和真实工作流一起保存下来。

使用分类目录。 把技能按子目录组织起来,例如 ~/.hermes/skills/devops/~/.hermes/skills/research/ 等。这样技能列表更易管理,agent 也更容易找到相关技能。

技能过时了就及时更新。 如果你在使用某个技能时发现它没覆盖现实中的问题,就让 Hermes 根据新经验更新它。失维护的技能最终会成为负担。


完整的技能参考,包括 frontmatter 字段、条件激活、外部目录等内容,请参阅 技能系统