← Back to Skills Marketplace
yofoan

auto-workflow

by yofoan · GitHub ↗ · v2.0.0 · MIT-0
cross-platform ⚠ suspicious
116
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install ai-workflow
Description
自动化工作流引擎 - 将重复性任务自动化。 支持:文件处理、数据转换、定时任务、API 调用、多步骤工作流。 触发词:"自动化"、"工作流"、"批量处理"、"定时任务"、"workflow"、"automate"。 自动执行:预设工作流或自定义流程。
README (SKILL.md)

Auto Workflow - 自动化工作流引擎

将重复性工作自动化,让你专注于更有价值的事情。

支持的工作流类型

类型 功能 示例
文件处理 批量重命名、格式转换、压缩解压 批量转换图片格式
数据处理 CSV/JSON/XML 转换、数据清洗 导出 Excel 为 JSON
定时任务 定时执行、周期任务 每日自动备份
API 调用 HTTP 请求、数据同步 自动获取天气并通知
多步骤 组合多个操作 下载→处理→上传

使用方法

基础用法

# 运行预设工作流
auto-workflow run preset_name

# 运行自定义工作流
auto-workflow run custom_workflow.json

# 创建工作流
auto-workflow create workflow_name

预设工作流

1. 文件批量重命名

# 批量重命名文件(添加前缀/后缀、替换字符)
auto-workflow run rename --dir ./photos --pattern "IMG_{date}_{num}"

2. 图片批量转换

# 批量转换图片格式
auto-workflow run convert-images --dir ./images --from png --to jpg --quality 85

3. 数据格式转换

# CSV 转 JSON
auto-workflow run convert-data --input data.csv --output data.json

# JSON 转 Excel
auto-workflow run json-to-excel --input data.json --output data.xlsx

4. 自动备份

# 每日自动备份指定目录
auto-workflow run backup --source ~/documents --dest ~/backups --schedule "0 2 * * *"

5. API 数据获取

# 定时获取天气并保存
auto-workflow run fetch-weather --city beijing --output weather.json --schedule "0 8 * * *"

工作流定义示例

简单工作流

{
  "name": "图片处理工作流",
  "description": "下载图片→压缩→添加水印→上传",
  "steps": [
    {
      "name": "下载图片",
      "action": "http.get",
      "params": {
        "url": "https://example.com/image.png",
        "save": "/tmp/image.png"
      }
    },
    {
      "name": "压缩图片",
      "action": "image.compress",
      "params": {
        "input": "/tmp/image.png",
        "output": "/tmp/image_compressed.jpg",
        "quality": 80
      }
    },
    {
      "name": "添加水印",
      "action": "image.watermark",
      "params": {
        "input": "/tmp/image_compressed.jpg",
        "output": "/tmp/image_watermarked.jpg",
        "text": "© MyBrand"
      }
    },
    {
      "name": "上传到 CDN",
      "action": "upload.cdn",
      "params": {
        "file": "/tmp/image_watermarked.jpg",
        "path": "/images/"
      }
    }
  ]
}

定时工作流

{
  "name": "每日数据备份",
  "description": "每天凌晨 2 点自动备份重要文件",
  "schedule": "0 2 * * *",
  "steps": [
    {
      "name": "压缩文档目录",
      "action": "archive.create",
      "params": {
        "source": "~/documents",
        "output": "~/backups/documents_{date}.tar.gz"
      }
    },
    {
      "name": "上传到云存储",
      "action": "upload.cos",
      "params": {
        "file": "~/backups/documents_{date}.tar.gz",
        "bucket": "my-backups"
      }
    },
    {
      "name": "清理旧备份",
      "action": "cleanup.old",
      "params": {
        "dir": "~/backups",
        "pattern": "*.tar.gz",
        "keep_days": 30
      }
    }
  ]
}

脚本示例

workflow-engine.py - 工作流引擎

#!/usr/bin/env python3
"""
简易工作流引擎
支持:文件操作、HTTP 请求、数据转换、定时任务
"""

import json
import os
import sys
import shutil
import subprocess
import urllib.request
from datetime import datetime
from pathlib import Path

class WorkflowEngine:
    def __init__(self):
        self.context = {}
    
    def execute_step(self, step):
        """执行单个工作流步骤"""
        action = step.get('action', '')
        params = step.get('params', {})
        
        print(f"  执行:{step.get('name', action)}")
        
        # 文件操作
        if action == 'file.copy':
            return self.file_copy(params)
        elif action == 'file.move':
            return self.file_move(params)
        elif action == 'file.delete':
            return self.file_delete(params)
        elif action == 'archive.create':
            return self.archive_create(params)
        
        # HTTP 请求
        elif action == 'http.get':
            return self.http_get(params)
        elif action == 'http.post':
            return self.http_post(params)
        
        # 数据处理
        elif action == 'data.convert':
            return self.data_convert(params)
        
        # 其他
        elif action == 'shell.exec':
            return self.shell_exec(params)
        else:
            print(f"    ⚠️  未知动作:{action}")
            return None
    
    def file_copy(self, params):
        """复制文件"""
        src = self.expand_vars(params.get('source'))
        dst = self.expand_vars(params.get('dest'))
        shutil.copy2(src, dst)
        print(f"    ✅ {src} → {dst}")
        return {'success': True, 'dest': dst}
    
    def file_move(self, params):
        """移动文件"""
        src = self.expand_vars(params.get('source'))
        dst = self.expand_vars(params.get('dest'))
        shutil.move(src, dst)
        print(f"    ✅ {src} → {dst}")
        return {'success': True, 'dest': dst}
    
    def file_delete(self, params):
        """删除文件"""
        path = self.expand_vars(params.get('path'))
        if os.path.isfile(path):
            os.remove(path)
            print(f"    ✅ 删除:{path}")
        elif os.path.isdir(path):
            shutil.rmtree(path)
            print(f"    ✅ 删除目录:{path}")
        return {'success': True}
    
    def archive_create(self, params):
        """创建压缩包"""
        source = self.expand_vars(params.get('source'))
        output = self.expand_vars(params.get('output'))
        
        # 确保输出目录存在
        os.makedirs(os.path.dirname(output), exist_ok=True)
        
        # 创建 tar.gz
        shutil.make_archive(output.replace('.tar.gz', ''), 'gztar', source)
        print(f"    ✅ 创建压缩包:{output}")
        return {'success': True, 'output': output}
    
    def http_get(self, params):
        """HTTP GET 请求"""
        url = params.get('url')
        save = params.get('save')
        
        print(f"    🌐 GET {url}")
        
        try:
            with urllib.request.urlopen(url, timeout=30) as response:
                data = response.read()
                
                if save:
                    save_path = self.expand_vars(save)
                    with open(save_path, 'wb') as f:
                        f.write(data)
                    print(f"    ✅ 保存到:{save_path}")
                    return {'success': True, 'file': save_path}
                else:
                    return {'success': True, 'data': data.decode()}
        except Exception as e:
            print(f"    ❌ 请求失败:{e}")
            return {'success': False, 'error': str(e)}
    
    def http_post(self, params):
        """HTTP POST 请求"""
        url = params.get('url')
        data = params.get('data', {})
        headers = params.get('headers', {})
        
        print(f"    🌐 POST {url}")
        
        try:
            req = urllib.request.Request(
                url,
                data=json.dumps(data).encode(),
                headers={'Content-Type': 'application/json', **headers}
            )
            with urllib.request.urlopen(req, timeout=30) as response:
                return {'success': True, 'data': response.read().decode()}
        except Exception as e:
            print(f"    ❌ 请求失败:{e}")
            return {'success': False, 'error': str(e)}
    
    def data_convert(self, params):
        """数据格式转换"""
        input_file = self.expand_vars(params.get('input'))
        output_file = self.expand_vars(params.get('output'))
        
        print(f"    🔄 转换:{input_file} → {output_file}")
        
        # 简单实现:JSON ↔ CSV
        if input_file.endswith('.json') and output_file.endswith('.csv'):
            self.json_to_csv(input_file, output_file)
        elif input_file.endswith('.csv') and output_file.endswith('.json'):
            self.csv_to_json(input_file, output_file)
        else:
            print(f"    ⚠️  不支持的转换")
            return {'success': False}
        
        return {'success': True, 'output': output_file}
    
    def json_to_csv(self, input_file, output_file):
        """JSON 转 CSV"""
        import csv
        with open(input_file) as f:
            data = json.load(f)
        
        if not data:
            return
        
        with open(output_file, 'w', newline='') as f:
            writer = csv.DictWriter(f, fieldnames=data[0].keys())
            writer.writeheader()
            writer.writerows(data)
        
        print(f"    ✅ 转换完成")
    
    def csv_to_json(self, input_file, output_file):
        """CSV 转 JSON"""
        import csv
        with open(input_file, newline='') as f:
            reader = csv.DictReader(f)
            data = list(reader)
        
        with open(output_file, 'w') as f:
            json.dump(data, f, indent=2)
        
        print(f"    ✅ 转换完成")
    
    def shell_exec(self, params):
        """执行 Shell 命令"""
        cmd = self.expand_vars(params.get('command'))
        print(f"    💻 执行:{cmd}")
        
        try:
            result = subprocess.run(
                cmd, shell=True, capture_output=True, text=True, timeout=60
            )
            print(f"    ✅ 完成")
            return {
                'success': True,
                'stdout': result.stdout,
                'stderr': result.stderr,
                'returncode': result.returncode
            }
        except Exception as e:
            print(f"    ❌ 执行失败:{e}")
            return {'success': False, 'error': str(e)}
    
    def expand_vars(self, text):
        """展开变量"""
        if not text:
            return text
        
        # 替换日期变量
        now = datetime.now()
        text = text.replace('{date}', now.strftime('%Y%m%d'))
        text = text.replace('{datetime}', now.strftime('%Y%m%d_%H%M%S'))
        text = text.replace('{year}', now.strftime('%Y'))
        text = text.replace('{month}', now.strftime('%m'))
        text = text.replace('{day}', now.strftime('%d'))
        
        # 替换环境变量
        for key, value in os.environ.items():
            text = text.replace(f'{{{key}}}', value)
        
        # 替换上下文变量
        for key, value in self.context.items():
            text = text.replace(f'{{{key}}}', str(value))
        
        return text
    
    def run_workflow(self, workflow_def):
        """运行工作流"""
        print(f"\
🚀 开始执行工作流:{workflow_def.get('name', 'Unnamed')}")
        print(f"📝 描述:{workflow_def.get('description', 'No description')}")
        print("=" * 60)
        
        steps = workflow_def.get('steps', [])
        results = []
        
        for i, step in enumerate(steps, 1):
            print(f"\
步骤 {i}/{len(steps)}:")
            result = self.execute_step(step)
            results.append(result)
            
            # 如果步骤失败且是关键的,停止执行
            if result and not result.get('success', True):
                if step.get('critical', True):
                    print(f"\
❌ 关键步骤失败,停止执行")
                    break
            
            # 将结果存入上下文
            if result:
                for key, value in result.items():
                    self.context[f'step_{i}_{key}'] = value
        
        print("\
" + "=" * 60)
        print("✅ 工作流执行完成")
        print(f"📊 执行了 {len(results)}/{len(steps)} 个步骤")
        
        return results

def load_workflow(path):
    """加载工作流定义"""
    with open(path) as f:
        return json.load(f)

def main():
    if len(sys.argv) \x3C 3:
        print("用法:python3 workflow-engine.py \x3Ccommand> \x3Cworkflow_file>")
        print("\
命令:")
        print("  run     - 运行工作流")
        print("  create  - 创建工作流模板")
        print("\
示例:")
        print("  python3 workflow-engine.py run backup.json")
        print("  python3 workflow-engine.py create my_workflow")
        sys.exit(1)
    
    command = sys.argv[1]
    arg = sys.argv[2]
    
    engine = WorkflowEngine()
    
    if command == 'run':
        if not os.path.exists(arg):
            print(f"❌ 文件不存在:{arg}")
            sys.exit(1)
        
        workflow = load_workflow(arg)
        engine.run_workflow(workflow)
    
    elif command == 'create':
        template = {
            "name": arg,
            "description": "工作流描述",
            "steps": [
                {
                    "name": "第一步",
                    "action": "file.copy",
                    "params": {
                        "source": "/path/to/source",
                        "dest": "/path/to/dest"
                    }
                }
            ]
        }
        
        output_file = f"{arg}.json"
        with open(output_file, 'w') as f:
            json.dump(template, f, indent=2)
        
        print(f"✅ 工作流模板已创建:{output_file}")
        print("编辑此文件定义你的工作流,然后用 'run' 命令执行")

if __name__ == '__main__':
    main()

变现模式

免费层

  • 基础文件操作
  • 每日 10 次执行
  • 预设工作流

付费层(¥79/月)

  • 所有操作类型
  • 无限次执行
  • 自定义工作流
  • 定时任务

企业层(¥599/月)

  • 团队协作
  • API 访问
  • 私有化部署
  • 专属支持

下一步

  1. 完成脚本开发
  2. 添加更多预设工作流
  3. 开发 Web UI
  4. 发布到 ClawHub

📜 License

Copyright © 2026 anyafu. All rights reserved.

Licensed under the MIT License.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

商业使用

  • ✅ 允许个人和商业使用
  • ✅ 允许修改和分发
  • ✅ 允许私有化部署
  • ⚠️ 如需闭源商业授权,请联系作者 anyafu
Usage Guidance
This package appears to be a real workflow engine, but there are several red flags to consider before installing or running it: - Review the included Python script carefully (scripts/workflow-engine.py). It supports shell.exec and unrestricted file operations; do not run workflows you don't fully trust. - The docs reference uploading to cloud/CDN and scheduled automatic runs, but no credentials or installer are declared. Ask the author how to provide credentials safely (use env vars, not hard-coded secrets) and how scheduling is implemented (background service, cron integration, or manual invocation). - Because the engine can execute shell commands and delete/move files, run it in a low-privilege, isolated environment (container or dedicated VM) during evaluation. - If you plan to use cloud upload steps, require the skill to explicitly declare which environment variables/keys it needs and prefer scoped, minimal-permission credentials. - If you need this in production, request an install script or packaging that creates the CLI and a secure mechanism for background scheduling, and ask for provenance (source repo/homepage) — the skill metadata lacks a homepage and origin. If you want, I can: (a) highlight the parts of the script that implement shell execution and network/upload behavior, (b) suggest a minimal safe workflow policy, or (c) propose an environment variable list the skill should require for cloud uploads.
Capability Assessment
Purpose & Capability
The name/description match the included workflow engine code (file ops, HTTP, archiving, scheduling/cron-style examples). However the docs/examples mention cloud uploads (upload.cos/upload.cdn) and automatic scheduled execution while the package declares no credentials, no cloud integrations, and no install/service to run scheduled jobs — suggesting incomplete or inconsistent capability claims.
Instruction Scope
SKILL.md and examples instruct running arbitrary workflows that include shell.exec, file.delete, download, and archive operations on arbitrary paths. The runtime instructions do not constrain these actions or declare the need for credentials for cloud uploads. The engine exposes shell.exec (likely runs arbitrary shell commands) and unrestricted file operations — expected for a workflow engine but high-risk if workflows are untrusted or run with elevated privileges.
Install Mechanism
There is no install spec (instruction-only), which reduces installer risk, but a Python script (scripts/workflow-engine.py) is included without an install/binary wrapper. SKILL.md refers to a CLI 'auto-workflow' command but the package provides no installer to create that command — a small coherence gap (manual setup required). No external downloads were used.
Credentials
The skill declares no required environment variables or credentials, yet documentation and examples reference uploading to cloud/CDN buckets. Those actions normally require credentials (API keys, cloud access). The absence of declared env vars or guidance on supplying credentials is a mismatch and could lead users to embed secrets directly in workflows or run incomplete features.
Persistence & Privilege
always:false (no forced presence) which is appropriate. The skill can be invoked autonomously (platform default), which combined with its ability to run shell commands and modify arbitrary files increases blast radius — but autonomous invocation alone is not sufficient to mark it malicious.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ai-workflow
  3. After installation, invoke the skill by name or use /ai-workflow
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v2.0.0
auto-workflow 1.0.0 - Major skill overhaul: now features a full automation workflow engine, sample definitions, and script support. - Added examples/backup-workflow.json and scripts/workflow-engine.py as new template/example and engine script. - Removed legacy skill.json file. - SKILL.md now details supported workflow types, preset command usage, advanced workflow definition, and Python engine usage. - Enhanced documentation with real-world examples covering file, data, scheduling, and API automation.
Metadata
Slug ai-workflow
Version 2.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is auto-workflow?

自动化工作流引擎 - 将重复性任务自动化。 支持:文件处理、数据转换、定时任务、API 调用、多步骤工作流。 触发词:"自动化"、"工作流"、"批量处理"、"定时任务"、"workflow"、"automate"。 自动执行:预设工作流或自定义流程。 It is an AI Agent Skill for Claude Code / OpenClaw, with 116 downloads so far.

How do I install auto-workflow?

Run "/install ai-workflow" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is auto-workflow free?

Yes, auto-workflow is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does auto-workflow support?

auto-workflow is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created auto-workflow?

It is built and maintained by yofoan (@yofoan); the current version is v2.0.0.

💬 Comments