上一篇我们深入探讨了 Hermes Agent 的工具集体系,掌握了 30+ 工具的启用管理和依赖检查。工具是 Agent 的"手脚",让它能够执行具体操作。但如果你想让 Agent 具备**专业领域能力**——比如"精通 React 性能优化"、"熟悉 Kubernetes 部署"、"擅长数据库调优"——那就需要更高层次的抽象:**Skills(技能)**。

Skills 技能系统 —— 安装搜索管理 Skills、Hub 技能、本地技能与平台启用

简介

上一篇我们深入探讨了 Hermes Agent 的工具集体系,掌握了 30+ 工具的启用管理和依赖检查。工具是 Agent 的"手脚",让它能够执行具体操作。但如果你想让 Agent 具备专业领域能力——比如"精通 React 性能优化"、"熟悉 Kubernetes 部署"、"擅长数据库调优"——那就需要更高层次的抽象:Skills(技能)

Skill = 工具 + 知识 + 流程 + 最佳实践的封装。

如果说工具是 Agent 的"手脚",那么技能就是 Agent 的"专业能力"。一个安装了 React 开发技能的 Agent,不仅能读写文件和执行命令,还知道 React 项目的目录结构、常见的性能陷阱、最佳实践模式,以及如何一步步完成一个复杂的组件重构。

本文将带你全面掌握 Hermes Agent 的 Skills 技能系统:

  • Skills Hub:官方和社区技能市场,一键安装
  • 本地技能:创建和管理自定义技能
  • 技能管理:安装、更新、卸载、搜索
  • 平台启用:按项目、按用户、按场景启用技能
  • 技能组合:多个技能协同工作
  • 技能开发:从零开始编写一个技能

技能系统的核心价值:让 Agent 从"通用助手"进化为"领域专家"。

目录

Skills 系统架构

什么是 Skill?

Skill 是 Hermes Agent 中最高级别的能力单元。一个 Skill 包含:

text
Skill 组成结构:
├── 📖 知识库 (Knowledge Base)
│   ├── 领域文档和最佳实践
│   ├── 常见模式与反模式
│   └── 示例代码和模板
│
├── 🔧 工具链 (Toolchain)
│   ├── 需要的工具列表
│   ├── 工具的参数预设
│   └── 工具的执行顺序
│
├── 📋 工作流 (Workflow)
│   ├── 任务分解策略
│   ├── 步骤间的依赖关系
│   └── 错误处理和回退
│
└── ⚙️ 配置 (Configuration)
    ├── 环境变量
    ├── 项目类型检测
    └── 与其他技能的兼容性

Skill vs Tool 对比

维度 Tool(工具) Skill(技能)
抽象级别 低层操作 高层能力
粒度 单一动作 完整流程
知识 领域知识
组合 被 Skill 调用 组合多个 Tool
示例 patch - 编辑文件 react-performance - React 性能优化
独立性 独立执行 依赖工具链
可移植性 内置/外部程序 纯配置 + 知识

系统架构概览

text
┌──────────────────────────────────────────────────────────────┐
│                     Hermes Agent Skills 架构                   │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌─────────────┐                                             │
│  │ Skills Hub  │ ←── 云端技能市场                            │
│  │ (远程源)     │     • 官方技能                              │
│  │             │     • 社区贡献                              │
│  └──────┬──────┘     • 企业私有技能                          │
│         │ 下载                                               │
│         ▼                                                    │
│  ┌──────────────────────────────────────────────────────┐   │
│  │              本地技能存储 (~/.hermes/skills/)         │   │
│  │                                                      │   │
│  │  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐   │   │
│  │  │ react-  │ │ k8s-    │ │ db-     │ │ custom- │   │   │
│  │  │ perf    │ │ deploy  │ │ tuning  │ │ skill   │   │   │
│  │  └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘   │   │
│  │       │           │           │           │         │   │
│  └───────┼───────────┼───────────┼───────────┼─────────┘   │
│          │           │           │           │             │
│          ▼           ▼           ▼           ▼             │
│  ┌──────────────────────────────────────────────────┐     │
│  │              技能运行时 (Skill Runtime)            │     │
│  │  • 技能加载与初始化                                │     │
│  │  • 知识注入到系统提示词                            │     │
│  │  • 工具链编排                                      │     │
│  │  • 工作流执行                                      │     │
│  └──────────────────────┬───────────────────────────┘     │
│                         │                                  │
│                         ▼                                  │
│              ┌─────────────────────┐                       │
│              │  Agent 核心引擎      │                       │
│              │  (LLM + 工具执行)    │                       │
│              └─────────────────────┘                       │
│                                                              │
└──────────────────────────────────────────────────────────────┘

Skills Hub:技能市场

Skills Hub 是 Hermes Agent 的官方技能市场,你可以在这里浏览、搜索和安装各种技能。

浏览技能市场

bash
# 浏览 Skills Hub 所有可用技能
hermes skills browse

# 输出:
# ═══════════════════════════════════════════════════
#  Hermes Agent Skills Hub
# ═══════════════════════════════════════════════════
#  总技能数:    156
#  官方技能:    42
#  社区技能:    114
# ═══════════════════════════════════════════════════
#
#  热门技能:
#  ┌────────────────────────┬────────┬──────────┬────────┐
#  │ 技能名                  │ 作者   │ 下载量   │ 评分   │
#  ├────────────────────────┼────────┼──────────┼────────┤
#  │ react-performance      │ 官方   │ 12.5K   │ ⭐4.9  │
#  │ typescript-best        │ 官方   │ 10.2K   │ ⭐4.8  │
#  │ kubernetes-deploy      │ 官方   │ 8.7K    │ ⭐4.7  │
#  │ python-async           │ 官方   │ 7.3K    │ ⭐4.8  │
#  │ docker-optimization    │ @dev   │ 6.1K    │ ⭐4.6  │
#  │ database-tuning        │ 官方   │ 5.8K    │ ⭐4.7  │
#  │ microservice-patterns  │ @arch  │ 4.2K    │ ⭐4.5  │
#  │ ci-cd-pipeline         │ @ops   │ 3.9K    │ ⭐4.6  │
#  └────────────────────────┴────────┴──────────┴────────┘
#
#  使用 'hermes skills search <关键词>' 搜索技能
#  使用 'hermes skills info <技能名>' 查看技能详情

按类别浏览

bash
# 按类别浏览
hermes skills browse --category frontend

# 输出:
# 前端开发技能 (18):
# ┌────────────────────────┬──────────┬────────┬────────┐
# │ 技能名                  │ 版本     │ 大小   │ 描述   │
# ├────────────────────────┼──────────┼────────┼────────┤
# │ react-performance      │ v2.1.0   │ 45KB   │ React  │
# │ vue-best-practices     │ v1.8.0   │ 38KB   │ Vue 3  │
# │ nextjs-patterns        │ v1.5.0   │ 52KB   │ Next.js│
# │ tailwind-workflow      │ v1.3.0   │ 28KB   │ Tailwind│
# │ accessibility-audit    │ v1.2.0   │ 35KB   │ A11y   │
# └────────────────────────┴──────────┴────────┴────────┘

hermes skills browse --category devops
# DevOps 技能 (24)

hermes skills browse --category database
# 数据库技能 (12)

技能详情

bash
# 查看技能详情
hermes skills info react-performance

# 输出:
# ═══════════════════════════════════════════════════
#  技能详情: react-performance
# ═══════════════════════════════════════════════════
#  名称:        react-performance
#  版本:        v2.1.0
#  作者:        Hermes Team (官方)
#  许可:        MIT
#  大小:        45KB
#  下载量:      12,543
#  评分:        ⭐4.9/5.0 (328 评价)
#  最后更新:    2025-05-15
#
#  描述:
#  React 应用性能优化技能。包含 React 18+ 的性能最佳实践、
#  常见性能问题诊断流程、以及自动优化建议。
#
#  包含内容:
#  ├── 📖 知识库
#  │   ├── React 渲染原理与性能模型
#  │   ├── 12 个常见性能陷阱及解决方案
#  │   ├── 虚拟列表、懒加载、代码分割模式
#  │   └── React DevTools Profiler 使用指南
#  │
#  ├── 🔧 工具链
#  │   ├── read_file, patch (代码分析修改)
#  │   ├── terminal (运行性能测试)
#  │   └── code_search (查找性能问题模式)
#  │
#  └── 📋 工作流
#      ├── 性能审计 → 问题定位 → 修复建议 → 验证
#      └── 自动检测: useMemo/React.memo 滥用
#
#  适用项目:
#  ├── React 18+ 项目
#  ├── Next.js 应用
#  └── 任何使用 React 渲染库的项目
#
#  依赖:
#  ├── Node.js >= 18
#  └── react (peer dependency)
#
#  安装: hermes skills install react-performance
#  更新: hermes skills update react-performance
#  卸载: hermes skills uninstall react-performance

搜索与发现技能

关键词搜索

bash
# 按关键词搜索
hermes skills search react

# 输出:
# 搜索结果: "react" (找到 23 个技能)
# ┌────────────────────────────┬──────────┬──────┬────────┐
# │ 技能名                      │ 匹配度   │ 评分 │ 描述   │
# ├────────────────────────────┼──────────┼──────┼────────┤
# │ react-performance          │ 100%    │ 4.9  │ React  │
# │ react-testing              │ 95%     │ 4.7  │ React  │
# │ react-native-mobile        │ 90%     │ 4.5  │ RN 开  │
# │ react-state-management     │ 88%     │ 4.8  │ 状态管 │
# │ react-router-patterns      │ 85%     │ 4.6  │ 路由模 │
# │ react-typescript           │ 82%     │ 4.7  │ TS + R │
# │ react-native-performance   │ 80%     │ 4.4  │ RN 性  │
# │ react-19-migration         │ 78%     │ 4.3  │ 迁移指 │
# └────────────────────────────┴──────────┴──────┴────────┘

# 按描述搜索
hermes skills search "performance optimization"

# 按标签搜索
hermes skills search --tag performance
hermes skills search --tag security
hermes skills search --tag testing

高级搜索

bash
# 组合搜索
hermes skills search react --tag performance --min-rating 4.5

# 按作者搜索
hermes skills search --author hermes-team

# 按更新时间排序
hermes skills search react --sort updated

# 按下载量排序
hermes skills search react --sort downloads

安装与管理技能

安装技能

bash
# 安装单个技能
hermes skills install react-performance

# 输出:
# ═══════════════════════════════════════════════════
#  正在安装 react-performance v2.1.0...
# ═══════════════════════════════════════════════════
#
#  [1/4] 下载技能包...
#  ✓ 下载完成 (45KB)
#
#  [2/4] 验证签名...
#  ✓ 签名验证通过 (Hermes Team)
#
#  [3/4] 安装到本地...
#  ✓ 知识库: 12 个文档已加载
#  ✓ 工具链: 5 个工具已注册
#  ✓ 工作流: 2 个流程已配置
#
#  [4/4] 检查依赖...
#  ✓ Node.js >= 18 已满足 (v20.11.0)
#
#  ✅ react-performance v2.1.0 安装完成!
#    位置: ~/.hermes/skills/react-performance/
#    状态: 已启用

批量安装

bash
# 一次安装多个技能
hermes skills install react-performance typescript-best docker-optimization

# 从文件批量安装
hermes skills install --from-file skills-list.txt

# skills-list.txt 内容:
# react-performance
# typescript-best
# kubernetes-deploy
# database-tuning

# 安装某个类别的所有技能
hermes skills install --category frontend

更新技能

bash
# 检查可更新的技能
hermes skills updates

# 输出:
# 可更新的技能 (3):
# ┌────────────────────────┬──────────┬──────────┬────────┐
# │ 技能名                  │ 当前版本 │ 最新版本 │ 状态   │
# ├────────────────────────┼──────────┼──────────┼────────┤
# │ react-performance      │ v2.0.0   │ v2.1.0   │ 可更新 │
# │ typescript-best        │ v1.9.0   │ v1.10.0  │ 可更新 │
# │ docker-optimization    │ v1.2.0   │ v1.3.0   │ 可更新 │
# └────────────────────────┴──────────┴──────────┴────────┘

# 更新单个技能
hermes skills update react-performance

# 更新所有技能
hermes skills update --all

卸载技能

bash
# 卸载单个技能
hermes skills uninstall react-performance

# 卸载并清理数据
hermes skills uninstall react-performance --purge

# 卸载某个类别的所有技能
hermes skills uninstall --category frontend

查看已安装技能

bash
# 列出所有已安装的技能
hermes skills list

# 输出:
# ═══════════════════════════════════════════════════
#  已安装技能 (8)
# ═══════════════════════════════════════════════════
#
#  ┌──────┬────────────────────────┬──────────┬──────────┐
#  │ 状态 │ 技能名                  │ 版本     │ 来源     │
#  ├──────┼────────────────────────┼──────────┼──────────┤
#  │ ✅   │ react-performance      │ v2.1.0   │ Hub      │
#  │ ✅   │ typescript-best        │ v1.10.0  │ Hub      │
#  │ ✅   │ kubernetes-deploy      │ v1.4.0   │ Hub      │
#  │ ✅   │ database-tuning        │ v1.3.0   │ Hub      │
#  │ ✅   │ my-project-rules       │ v1.0.0   │ 本地     │
#  │ ✅   │ team-conventions       │ v1.0.0   │ 本地     │
#  │ ⏸️   │ docker-optimization    │ v1.3.0   │ Hub      │
#  │ ⏸️   │ ci-cd-pipeline         │ v1.1.0   │ Hub      │
#  └──────┴────────────────────────┴──────────┴──────────┘
#
#  ✅ = 已启用  ⏸️ = 已安装但未启用  ❌ = 加载失败

本地技能:创建自定义技能

除了从 Hub 安装,你还可以创建自己的本地技能。这对于团队规范、项目特定流程非常有用。

技能目录结构

bash
# 创建新技能
hermes skills create my-project-rules

# 生成以下目录结构:
# ~/.hermes/skills/my-project-rules/
# ├── skill.yaml          # 技能元数据和配置
# ├── knowledge/           # 知识库
# │   ├── overview.md      # 概述
# │   ├── patterns/        # 模式文档
# │   │   ├── component.md
# │   │   └── hooks.md
# │   └── anti-patterns/   # 反模式文档
# │       └── common-mistakes.md
# ├── workflows/           # 工作流定义
# │   ├── code-review.yaml
# │   └── refactoring.yaml
# └── assets/              # 附加资源
#     └── templates/
#         └── component-template.tsx

skill.yaml 配置

yaml
# skill.yaml - 技能配置文件
name: my-project-rules
version: 1.0.0
description: "项目特定的编码规范和最佳实践"
author: "Your Team"
license: "MIT"

# 知识库注入配置
knowledge:
  inject_mode: system_prompt  # system_prompt | context | both
  files:
    - knowledge/overview.md
    - knowledge/patterns/*.md
    - knowledge/anti-patterns/*.md

# 工具链配置
tools:
  required:
    - read_file
    - write_file
    - patch
    - code_search
    - terminal
  optional:
    - lint_check
    - test_run

# 工作流
workflows:
  code-review:
    description: "代码审查流程"
    steps:
      - name: check_formatting
        tool: terminal
        args:
          command: "npx prettier --check ."
      - name: run_linter
        tool: terminal
        args:
          command: "npx eslint ."
      - name: run_tests
        tool: test_run
        args:
          test_command: "npm test -- --coverage"
      - name: check_patterns
        tool: code_search
        args:
          pattern: "any|as any"
          description: "检查是否使用了 any 类型"

  refactoring:
    description: "组件重构流程"
    steps:
      - name: analyze_component
        tool: read_file
      - name: identify_issues
        knowledge: knowledge/patterns/anti-patterns.md
      - name: apply_fixes
        tool: patch

# 项目类型检测
detection:
  file_patterns:
    - "package.json"
    - "tsconfig.json"
  env_check:
    - "REACT_APP_*"
  dependencies:
    - "react"
    - "typescript"

# 与其他技能的兼容性
compatibility:
  conflicts: []
  requires:
    - "typescript-best"
  optional:
    - "react-performance"

知识库文档示例

markdown
<!-- knowledge/overview.md -->
# 项目编码规范

## 组件命名

- 使用 PascalCase:`UserProfile.tsx`
- 容器组件加后缀:`UserProfileContainer.tsx`
- Hook 以 `use` 开头:`useUserProfile.ts`

## 文件组织

src/ ├── components/ # 通用组件 ├── features/ # 功能模块 │ └── user/ │ ├── components/ │ ├── hooks/ │ ├── services/ │ └── types.ts ├── hooks/ # 全局 Hook ├── services/ # API 服务 ├── types/ # 全局类型 └── utils/ # 工具函数

text

## 状态管理规则

1. 组件内部状态:`useState` / `useReducer`
2. 跨组件共享:Zustand
3. 服务端状态:React Query
4. 禁止使用 Redux(新项目)

技能配置与平台启用

项目级技能启用

技能可以在不同层级启用:全局、项目级、临时。

bash
# 项目级启用(在项目目录中执行)
cd /opt/data/my-react-project
hermes skills enable react-performance --scope project

# 这会创建 .hermes/skills.yaml 在项目根目录
yaml
# .hermes/skills.yaml - 项目级技能配置
skills:
  # 启用的技能
  enabled:
    - react-performance
    - typescript-best
    - my-project-rules  # 本地技能

  # 禁用的技能(即使全局已安装)
  disabled:
    - kubernetes-deploy  # 前端项目不需要

  # 技能参数覆盖
  overrides:
    react-performance:
      strict_mode: true
      auto_fix: false
    typescript-best:
      strict_null_checks: true
      no_implicit_any: true

用户级技能配置

yaml
# ~/.hermes/config.yaml - 用户全局配置
skills:
  # 全局启用的技能
  global_enabled:
    - typescript-best
    - database-tuning

  # 自动检测并启用的技能
  auto_detect: true
  auto_detect_rules:
    - if: "has_file('package.json') && has_dep('react')"
      then: enable("react-performance")
    - if: "has_file('go.mod')"
      then: enable("go-best-practices")
    - if: "has_file('Cargo.toml')"
      then: enable("rust-patterns")
    - if: "has_file('pyproject.toml')"
      then: enable("python-async")

  # 自动安装的推荐技能
  recommend_auto_install:
    - typescript-best
    - git-workflow

临时启用/禁用

bash
# 临时启用某个技能(仅当前会话)
hermes --skill react-performance

# 临时禁用某个技能
hermes --disable-skill kubernetes-deploy

# 启动时加载特定技能组合
hermes --skills "react-performance,typescript-best,my-project-rules"

平台级启用

在企业环境中,管理员可以通过平台配置统一管理技能:

yaml
# 企业平台配置 (platform-config.yaml)
skills:
  # 强制所有用户启用的技能
  mandatory:
    - security-audit
    - code-quality-standards
    - company-conventions

  # 推荐但可选的技能
  recommended:
    - react-performance
    - typescript-best
    - testing-best-practices

  # 禁止使用的技能
  blocked:
    - experimental-skill-v2

  # 私有技能源
  private_registry:
    url: "https://skills.internal.company.com"
    auth: "bearer $COMPANY_SKILLS_TOKEN"

技能组合与协同

多个技能可以协同工作,形成更强大的能力链。

技能依赖链

text
当安装 "full-stack-web" 技能组合时:

full-stack-web (元技能)
├── requires: typescript-best
├── requires: react-performance
├── requires: api-design
├── requires: database-tuning
└── provides: 完整的 Web 开发工作流

安装 full-stack-web 时自动安装并配置所有依赖技能。
bash
# 安装技能组合
hermes skills bundle install full-stack-web

# 查看技能组合
hermes skills bundles

# 输出:
# 可用技能组合 (6):
# ┌────────────────────────┬──────────┬──────────┬──────────┐
# │ 组合名                  │ 包含技能 │ 总大小 │ 描述     │
# ├────────────────────────┼──────────┼──────────┼──────────┤
# │ full-stack-web         │ 8 个     │ 280KB  │ 全栈开发 │
# │ mobile-development     │ 5 个     │ 195KB  │ 移动开发 │
# │ data-engineering       │ 6 个     │ 240KB  │ 数据工程 │
# │ devops-essentials      │ 7 个     │ 310KB  │ DevOps   │
# │ ai-ml-workflow         │ 4 个     │ 165KB  │ AI/ML    │
# │ security-hardening     │ 5 个     │ 220KB  │ 安全加固 │
# └────────────────────────┴──────────┴──────────┴──────────┘

技能冲突检测

bash
# 安装时自动检测冲突
hermes skills install new-skill

# 输出:
# ⚠️ 检测到潜在冲突:
#
# new-skill 与 react-performance 都注册了代码审查工作流。
#
# 选项:
# [1] 禁用 react-performance 的代码审查工作流(推荐)
# [2] 禁用 new-skill 的代码审查工作流
# [3] 同时启用,由 Agent 智能选择
# [4] 取消安装
#
# 请选择 (1-4):

技能优先级

yaml
# 技能优先级配置
skills:
  priority:
    # 高优先级技能的规则优先应用
    high:
      - security-audit        # 安全规则优先
      - company-conventions   # 公司规范优先

    # 中等优先级
    medium:
      - react-performance
      - typescript-best

    # 低优先级(仅在其他技能未覆盖时生效)
    low:
      - general-coding-tips

技能开发实战

从零创建一个技能

让我们创建一个 api-rest-best-practices 技能。

第一步:初始化技能

bash
hermes skills create api-rest-best-practices

第二步:编写 skill.yaml

yaml
name: api-rest-best-practices
version: 1.0.0
description: "RESTful API 设计与开发最佳实践"
author: "Your Name"
license: "MIT"
tags:
  - api
  - rest
  - backend
  - design

knowledge:
  inject_mode: system_prompt
  files:
    - knowledge/*.md

tools:
  required:
    - read_file
    - write_file
    - patch
    - terminal
  optional:
    - http_request
    - api_test

workflows:
  api-review:
    description: "API 设计审查"
    trigger: "review_api"
    steps:
      - check_naming_conventions
      - check_http_methods
      - check_status_codes
      - check_pagination
      - check_error_handling
      - check_versioning

detection:
  file_patterns:
    - "routes/*.ts"
    - "controllers/*.ts"
    - "api/**/*.py"

第三步:编写知识库

markdown
<!-- knowledge/naming.md -->
# REST API 命名规范

## URL 设计原则

### 使用名词而非动词
✅ GET /users          # 获取用户列表
✅ POST /users         # 创建用户
✅ GET /users/{id}     # 获取单个用户
❌ GET /getUsers       # 错误:使用动词
❌ POST /createUser    # 错误:使用动词

### 使用复数名词
✅ /users
✅ /products
✅ /orders
❌ /user
❌ /product
❌ /order

### 嵌套资源
✅ /users/{id}/orders          # 用户的订单
✅ /users/{id}/orders/{orderId} # 特定订单
❌ /orders?userId={id}         # 避免用查询参数表示关系

### 过滤、排序、分页
GET /users?role=admin&status=active     # 过滤
GET /users?sort=-createdAt&limit=20     # 排序 + 分页
GET /users?page=2&per_page=50           # 页码分页
markdown
<!-- knowledge/status-codes.md -->
# HTTP 状态码使用规范

## 成功响应
- 200 OK - 请求成功
- 201 Created - 资源创建成功(POST 后返回)
- 204 No Content - 成功但无返回内容(DELETE 后返回)

## 客户端错误
- 400 Bad Request - 请求格式错误
- 401 Unauthorized - 未认证
- 403 Forbidden - 无权限
- 404 Not Found - 资源不存在
- 409 Conflict - 资源冲突(如重复创建)
- 422 Unprocessable Entity - 参数验证失败

## 服务端错误
- 500 Internal Server Error - 服务器内部错误
- 503 Service Unavailable - 服务不可用

## 错误响应格式
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "邮箱格式无效",
    "details": [
      {
        "field": "email",
        "message": "必须是有效的邮箱地址"
      }
    ]
  }
}

第四步:测试技能

bash
# 在本地测试技能
hermes skills test api-rest-best-practices

# 输出:
# ═══════════════════════════════════════════════════
#  技能测试: api-rest-best-practices
# ═══════════════════════════════════════════════════
#
#  [1/5] 加载配置...     ✅
#  [2/5] 验证知识库...   ✅ (3 个文档, 2.1KB)
#  [3/5] 检查工具链...   ✅ (4 required + 1 optional)
#  [4/5] 验证工作流...   ✅ (1 个工作流, 6 个步骤)
#  [5/5] 运行集成测试... ✅
#
#  ✅ 所有测试通过!
#    技能可以安全发布。

发布到 Skills Hub

bash
# 发布到社区
hermes skills publish api-rest-best-practices

# 发布到私有源
hermes skills publish api-rest-best-practices --registry https://skills.internal.company.com

# 更新已发布的技能
hermes skills publish api-rest-best-practices --version 1.1.0

最佳实践

1. 技能分层策略

text
全局层 (用户级):
├── typescript-best      # 通用 TS 规范
├── git-workflow         # Git 工作流
└── security-basics      # 基础安全

项目层 (项目级):
├── react-performance    # React 性能
├── my-project-rules     # 项目特定规则
└── api-design           # API 设计

任务层 (临时):
└── migration-helper     # 迁移辅助(临时启用)

2. 定期审计技能

bash
# 检查未使用的技能
hermes skills audit

# 输出:
# 技能审计报告:
# ├── ✅ react-performance     - 最近使用: 2 小时前
# ├── ✅ typescript-best       - 最近使用: 1 天前
# ├── ⚠️ kubernetes-deploy     - 最近使用: 30 天前 (考虑禁用)
# ├── ⚠️ docker-optimization   - 最近使用: 45 天前 (考虑禁用)
# └── ❌ ci-cd-pipeline        - 最近使用: 90+ 天前 (建议卸载)

3. 技能版本锁定

yaml
# .hermes/skills.yaml
skills:
  enabled:
    - react-performance@2.1.0  # 锁定版本
    - typescript-best          # 跟随最新
    - my-project-rules@^1.0.0  # 语义化版本

4. 技能备份与同步

bash
# 导出已安装技能列表
hermes skills export > skills-backup.yaml

# 从备份恢复
hermes skills import skills-backup.yaml

# 在另一台机器同步
scp skills-backup.yaml other-machine:~
ssh other-machine "hermes skills import skills-backup.yaml"

总结

本文全面介绍了 Hermes Agent 的 Skills 技能系统:

  1. Skills Hub 技能市场:156+ 官方和社区技能,浏览、搜索、评分、一键安装
  2. 搜索与发现:关键词/标签/作者搜索,多维度排序和过滤
  3. 安装与管理:install/update/uninstall,批量操作,版本管理
  4. 本地技能创建:完整的目录结构,skill.yaml 配置,知识库注入,工作流定义
  5. 多层级启用:全局级、项目级、临时级,灵活的启用策略
  6. 平台级管控:企业强制技能、推荐技能、私有注册源
  7. 技能组合:元技能封装依赖链,冲突检测,优先级管理
  8. 技能开发:从创建到测试到发布的完整流程

核心原则:

  • 技能是 Agent 的"专业能力":工具提供操作能力,技能提供领域知识
  • 按需启用,层级管理:全局 → 项目 → 任务,逐层精细控制
  • 知识注入是关键:好的技能 = 高质量的知识库 + 合理的工作流
  • 版本锁定保稳定:生产环境锁定技能版本,防止意外更新
  • 企业级管控:强制规范、推荐实践、私有技能源

📌 下篇预告

TUI 交互模式 —— 沉浸式 AI 编程体验:终端界面操作、多窗口协作、快捷键大全、自定义主题。当配置好 Provider、工具集和技能后,如何在终端中高效使用 Hermes Agent?下一篇将带你深入 TUI 交互模式的全部功能,从基础操作到高级技巧,让你成为终端编程的效率达人。