微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🔄

对话历史一键变技能,自动发布

Skill From Memory · v0.1.1
developer-tools 安全 A 级 作者 zfanmy 公开目录收录
下载 2.9k 安装 2 收藏 6.1k 浏览 97
原始页面

简介

将历史对话与记忆文件自动提取、封装为可复用OpenClaw技能,支持一键发布至GitHub与ClawHub的技能工厂工具

原始描述

Convert memory, conversation history, or completed tasks into publishable OpenClaw skills. Use when (1) A task or workflow should be reusable, (2) Extracting...

中文使用说明 来自收录源

核心用法

skill-from-memory 是一套自动化工作流工具,核心功能是将用户的对话历史、记忆文件或已完成任务转化为标准化的 OpenClaw Skill。其工作流程分为四步:

  1. Extract(提取):解析 JSONL 格式的对话记录或 Markdown 记忆文件,识别可复用的工作流模式、输入输出定义、脚本代码和关键决策点
  2. Design(设计):根据提取内容决定 Skill 结构,划分 scripts/(可执行脚本)、references/(参考文档)、assets/(模板文件)三类资源
  3. Create(创建):自动生成符合规范的 SKILL.md 文件及配套脚本,包含完整的前置元数据、使用说明和示例
  4. Publish(发布):通过 CLI 命令一键推送至 GitHub 仓库,并注册到 ClawHub 技能市场

快速入门示例

# 从最近对话提取并创建 Skill
./scripts/extract-from-history.sh ~/.openclaw/sessions/latest.jsonl ./my-skill

# 一键提取、创建并发布
./scripts/create-and-publish.sh \
  --source ~/.openclaw/sessions/latest.jsonl \
  --skill-name "auto-backup" \
  --github-repo "user/my-skills" \
  --clawhub-slug "auto-backup"

显著优点

  • 零配置开箱即用:纯 Bash 脚本实现,零第三方依赖,仅需系统标准工具(jq 可选)
  • 智能模式识别:内置正则匹配和启发式分析,自动识别"帮我写一个脚本"、"设置定时任务"等可复用场景
  • 标准化输出:严格遵循 OpenClaw Skill 规范,生成的前置元数据、目录结构、文档格式均可直接提交至 ClawHub
  • 版本化管理:内置语义化版本支持(SemVer),自动生成版本标签和变更记录
  • 安全沙箱设计:所有文件操作限定在用户指定目录,无外部网络请求,无敏感信息收集

潜在缺点与局限性

  • Bash 环境依赖:仅支持类 Unix 系统(Linux/macOS),Windows 用户需借助 WSL 或 Git Bash
  • T3 来源可信度:由个人开发者维护,虽经安全扫描认证,但仍建议生产环境使用前人工审查
  • JSONL 格式要求:对话历史必须为 OpenClaw 标准的 JSONL 格式,非结构化文本需预处理
  • 模式识别有限:复杂多步骤工作流的自动拆分准确率依赖启发规则,极端场景需手动调整
  • 无图形界面:纯命令行交互,对非技术用户存在学习曲线

适合人群

  • OpenClaw 重度用户:频繁创建自定义自动化工作流,希望沉淀个人知识库
  • DevOps/运维工程师:需要将一次性脚本转化为团队可复用的标准化工具
  • 开源贡献者:计划向 ClawHub 贡献技能,需要快速生成符合规范的 Skill 包
  • 技术文档工程师:希望将解决方案文档化并发布为可执行技能

常规风险

  • 输入路径风险:脚本依赖用户提供的文件路径,若路径指向系统敏感目录可能意外覆盖文件(建议始终使用独立输出目录)
  • GitHub 凭据配置:自动发布功能需预配置 SSH 密钥和 Git 全局设置,配置不当可能导致推送失败
  • ClawHub 命名冲突:若 --clawhub-slug 与现有技能重名,发布将失败,需提前查询可用 slug
  • jq 降级兼容性:可选依赖 jq 缺失时,JSON 解析将回退至 grep/awk 方案,复杂嵌套结构提取准确率可能下降

安全认证亮点

根据 CLS-Certify v2.1.0 完整扫描报告,该 Skill 获得 A 级评分(85分):

  • 静态代码分析 90 分:无危险函数、无命令注入、无敏感信息泄露
  • 动态行为分析 85 分:运行行为与声明完全一致,无异常系统调用
  • 依赖审计 100 分:零第三方依赖,纯 Bash 实现
  • 网络流量分析 90 分:纯本地文件操作,零外部网络请求
  • 隐私合规 80 分:符合 GDPR 数据最小化原则,不收集敏感数据

技能正文


name: skill-from-memory description: Convert memory, conversation history, or completed tasks into publishable OpenClaw skills. Use when (1) A task or workflow should be reusable, (2) Extracting lessons from memory to create tools, (3) Packaging solved problems as skills for future use, (4) Publishing skills to GitHub and ClawHub registry.

Skill from Memory

Transform your work into reusable skills. Extract workflows, solutions, and patterns from conversation history or memory files, package them as skills, and publish to GitHub and ClawHub.

Overview

This skill automates the complete workflow:

  1. Extract - Parse conversation history or memory for reusable patterns
  2. Design - Structure as a proper skill with SKILL.md and resources
  3. Create - Generate skill files and scripts
  4. Publish - Push to GitHub and publish to ClawHub

Quick Start

Create Skill from Recent Conversation

# Analyze last conversation and create skill draft
./scripts/extract-from-history.sh /path/to/session.jsonl ./my-new-skill

# Or specify a time range
./scripts/extract-from-history.sh /path/to/session.jsonl ./my-new-skill --since "2026-02-03" --pattern "backup"

Create Skill from Memory File

# Extract from memory markdown
./scripts/extract-from-memory.sh /path/to/memory/2026-02-04.md ./my-new-skill

Full Auto-Create and Publish

# One command: extract, create, and publish
./scripts/create-and-publish.sh \
  --source /path/to/session.jsonl \
  --skill-name "my-automation" \
  --github-repo "user/my-skills" \
  --clawhub-slug "my-automation"

Workflow Steps

Step 1: Extract Requirements

Identify from conversation/memory:

  • Task Pattern: What workflow was solved?
  • Inputs/Outputs: What goes in, what comes out?
  • Scripts/Tools: What code was written?
  • Key Decisions: What choices were made?

Step 2: Design Skill Structure

Decide resource types:

  • scripts/ - For reusable code
  • references/ - For documentation
  • assets/ - For templates/files

Step 3: Create Skill Files

Generate:

  • SKILL.md with frontmatter and instructions
  • Scripts in scripts/
  • Any reference files

Step 4: Publish

Push to GitHub and publish to ClawHub:

./scripts/publish.sh ./my-skill \
  --github "user/repo" \
  --clawhub-slug "my-skill" \
  --version "1.0.0"

Scripts Reference

extract-from-history.sh

Parse conversation JSONL for skill content.

./scripts/extract-from-history.sh <session.jsonl> <output-dir> [options]

Options:
  --since DATE     Only extract from DATE onwards
  --pattern REGEX  Filter messages matching pattern
  --tools-only     Only extract tool usage patterns

extract-from-memory.sh

Parse memory markdown files.

./scripts/extract-from-memory.sh <memory.md> <output-dir>

create-skill.sh

Generate skill structure from extracted content.

./scripts/create-skill.sh <extracted-content-dir> <skill-name>

Options:
  --description "..."  Skill description
  --type workflow    Skill type (workflow|tool|reference)

publish.sh

Complete publish workflow.

./scripts/publish.sh <skill-path> [options]

Options:
  --github REPO      GitHub repo (owner/repo)
  --clawhub-slug     ClawHub slug
  --version VER      Version tag
  --skip-github      Skip GitHub push
  --skip-clawhub     Skip ClawHub publish

Example: Converting a Task to Skill

Original Task (from conversation)

User: "帮我设置每天自动备份OpenClaw配置" → Agent creates backup scripts + cron setup

Skill Creation Process

  1. Extract:

    ./scripts/extract-from-history.sh \
      ~/.openclaw/agents/main/sessions/latest.jsonl \
      ./extracted-backup
    
  2. Design:

    • Type: Workflow skill
    • Scripts: backup.sh, setup-cron.sh, cleanup.sh
    • No assets needed
  3. Create:

    ./scripts/create-skill.sh ./extracted-backup cron-backup \
      --description "Automated backup scheduling with cron" \
      --type workflow
    
  4. Publish:

    ./scripts/publish.sh ./cron-backup \
      --github "zfanmy/openclaw-skills" \
      --clawhub-slug "cron-backup" \
      --version "1.0.0"
    

Best Practices

What Makes a Good Skill

✅ Do:

  • Single, well-defined purpose
  • Reusable across contexts
  • Includes working scripts
  • Clear usage examples
  • Progressive disclosure design

❌ Don't:

  • Too broad or vague
  • Hardcoded personal paths
  • Missing error handling
  • Undocumented assumptions

Extracting from Memory

Look for these patterns:

  • "帮我写一个脚本..."
  • "设置定时任务..."
  • "以后每次都要..."
  • "这个流程可以复用..."

GitHub Integration

Required setup:

# Configure git
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

# Setup SSH key for GitHub
ssh-keygen -t ed25519 -C "your@email.com"
# Add ~/.ssh/id_ed25519.pub to GitHub Settings → SSH Keys

# Login to ClawHub
clawhub login

Versioning

Follow semantic versioning:

  • 1.0.0 - Initial release
  • 1.0.1 - Bug fix
  • 1.1.0 - New feature
  • 2.0.0 - Breaking change

Troubleshooting

Extraction finds nothing

  • Check session file path
  • Verify date range with --since
  • Try broader pattern matching

GitHub push fails

  • Verify SSH key is added to GitHub
  • Check repo exists and you have access
  • Ensure git config user.name/email set

ClawHub publish fails

  • Run clawhub login first
  • Check skill validation passes
  • Verify slug is unique

Skill doesn't work when used

  • Test scripts manually first
  • Check for hardcoded paths
  • Verify all dependencies listed
  • Run with --examples flag when creating

Related Skills

  • skill-creator - Low-level skill creation utilities
  • cron-backup - Example output skill (backup automation)
  • clawhub - ClawHub CLI operations

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

其他来源收录

同一技能在不同目录的原始页面:

标签

skill-developmentautomationknowledge-managementcli-toolsgit-integrationclawhubworkflow-extractionmemory-managementpublishing-tools

同类 Skill