with one click
test-module
测试模块 - 演示 gtoolkits 注册机制的示例模块,展示参数解析、配置加载、函数注册的标准用法。使用当学习如何开发新模块时。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
测试模块 - 演示 gtoolkits 注册机制的示例模块,展示参数解析、配置加载、函数注册的标准用法。使用当学习如何开发新模块时。
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
模块创建工具 - 自动生成新的 gtoolkits 模块模板(main.py、配置文件、启动脚本、SKILL.md)。使用当需要快速创建新模块/技能包时。
GTool Registry 模块化功能调用系统。使用 gtools 命令调用已注册的工具模块,支持语义匹配、配置管理和管道执行。触发场景:用户需要调用 gtools 工具模块、管理模块(创建/删除/更新)、执行批量任务管道、或查询模块信息。
OpenClaw 记忆备份与恢复 - 备份/恢复/管理 OpenClaw 代理的核心记忆文件(MEMORY.md、每日笔记、身份配置)。使用当需要迁移数据、备份记忆或跨设备同步时。
图片查看与标记工具 - 支持浏览文件夹中的图片、键盘导航、标记/取消标记图片并保存路径。使用当需要快速筛选和标注图像数据时。
模块删除工具 - 安全移除 gtoolkits 模块和配置文件,支持列出可删除模块、强制删除、确认保护。使用当需要清理不需要的模块时。
模块配置更新工具 - 自动解析模块的 parse_args 函数并生成/更新配置文件,支持智能合并、SKILL.md 模板创建。使用当模块参数变更或需要生成配置时。
| name | test_module |
| description | 测试模块 - 演示 gtoolkits 注册机制的示例模块,展示参数解析、配置加载、函数注册的标准用法。使用当学习如何开发新模块时。 |
| homepage | |
| metadata | {"openclaw":{"emoji":"🧪","requires":{"bins":["python3"]}}} |
✅ 使用场景:
@FUNCTION.regist、@ARGS.regist)❌ 不使用场景:
time.sleep 演示延迟)@FUNCTION.regist(module_name="test_module") - 注册主函数@ARGS.regist(module_name="test_module") - 注册参数解析器argparse 定义参数| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
--config-file / -c | string | 否 | 配置文件路径(默认:default.json) |
--output-dir / -o | string | 否 | 输出目录(默认:/tmp/gtools_output) |
--verbose / -v | bool | 否 | 启用详细输出模式 |
--dry-run | bool | 否 | 试运行模式,不执行实际操作 |
--items | list | 否 | 要处理的项目列表 |
# 使用默认配置运行
gtools test_module
# 指定配置文件
gtools test_module -c custom.json
# 指定输出目录并启用详细模式
gtools test_module -o /tmp/output -v
# 处理特定项目
gtools test_module --items item1 item2 item3
# 试运行模式(不执行实际操作)
gtools test_module --dry-run
$ gtools test_module -v --items test1 test2
==================================================
测试模块执行中...
配置文件路径:default.json
输出目录:/tmp/gtools_output
详细模式:True
处理项目:test1, test2
✅ 执行实际操作
正在处理...
✨ 测试模块执行完成!
==================================================
{
"_positional_args": {
"command": "run"
},
"config_file": "default.json",
"output_dir": "/tmp/test_output",
"verbose": true,
"dry_run": false,
"items": ["item1", "item2"]
}
"""
模块名称:功能描述
用法:gtools module_name [参数]
"""
import argparse
from gtools.registry import ARGS, FUNCTION
@FUNCTION.regist(module_name="module_name")
def main(args: argparse.Namespace):
"""主函数:处理模块逻辑"""
# 实现你的功能
pass
@ARGS.regist(module_name="module_name")
def parse_args():
"""参数解析函数"""
parser = argparse.ArgumentParser(description="功能描述")
parser.add_argument("--param", "-p", type=str, help="参数说明")
return parser
main 函数和 parse_args 函数@FUNCTION.regist(module_name=xxx) 中的名称一致parse_args() 必须返回 argparse.ArgumentParser 对象functions/test_module/main.pyconfigs/test_module/default.json