Files
16gagent/scripts/extract-skill.sh
T
2026-06-06 10:40:48 +08:00

65 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# extract-skill — 从已完成任务中提取可复用能力
# 用法:bash scripts/extract-skill.sh <skill-name> "<description>"
# 示例:bash scripts/extract-skill.sh springboot-api "SpringBoot 接口开发流程"
#
# 输出:tools/<skill-name>.md
set -euo pipefail
if [ $# -lt 2 ]; then
echo "用法: bash scripts/extract-skill.sh <skill-name> \"<description>\""
echo "示例: bash scripts/extract-skill.sh project-scan \"项目结构扫描流程\""
exit 1
fi
SKILL_NAME="$1"
SKILL_DESC="$2"
SKILL_FILE="tools/${SKILL_NAME}.md"
if [ -f "$SKILL_FILE" ]; then
echo "⚠️ Skill 已存在: $SKILL_FILE"
echo " 使用 extract-skill 更新已有 skillbash scripts/extract-skill.sh ${SKILL_NAME} \"$(cat "$SKILL_FILE" | head -1)\""
exit 1
fi
cat > "$SKILL_FILE" << EOF
# ${SKILL_NAME} — ${SKILL_DESC}
> 从 Hermes Agent 工作流理念提取
## 适用场景
描述什么情况下使用这个 skill。
## 输入
- 输入 1:描述
- 输入 2:描述
## 执行步骤
1. 第一步
2. 第二步
3. 第三步
## 常见风险
- 风险 1
- 风险 2
## 验证方式
如何确认任务完成且正确。
## 输出格式
描述 task 完成时的交付物格式。
EOF
echo "✅ Skill 已创建: tools/${SKILL_NAME}.md"
echo ""
echo "下一步:"
echo " 1. 编辑 $SKILL_FILE 填入具体内容"
echo " 2. 在 MEMORY.md 的记录"已固化的能力"中引用它"