← Back to Skills Marketplace
marszxf

Pet-Game workflow

by marszxf · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
39
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install pet-game-workflow
Description
规范 Pet-Game 小程序项目的文件修改前自动备份、元素快照管理及 Git 提交后的备份清理工作流程。
README (SKILL.md)

Pet-Game 工作流 Skill

本 Skill 定义了 Pet-Game 小程序项目的版本控制和工作流规范。 AI 助手在进行任何文件修改前必须遵守以下规则。


1. 版本控制系统概述

备份文件结构

pet-game/
├── .qtools/                      # 工具脚本
│   └── backup_wrapper.py        # 备份入口脚本
├── .backups/                     # 备份区
│   ├── baselines/               # 基准快照
│   ├── elements/              # 频繁元素快照
│   └── state.json             # 版本状态
└── skills/
    └── pet-game-workflow/     # 本 Skill
        └── SKILL.md          # 工作流规则

备份脚本使用方法

# 备份单个文件(修改前必须执行)
python .qtools\backup_wrapper.py backup \x3C相对路径> [元素名]

# 示例
python .qtools\backup_wrapper.py backup subpk-home/pages/home/home.wxml BGM开关

# Git commit 后清理备份
python .qtools\backup_wrapper.py clean

2. 强制备份规则(AI 必须遵守)

规则 1:修改前必须备份 ⚠️

  • 触发条件:任何文件修改(WXML/WXSS/JS/JSON/MD 等)
  • 动作:先执行 python .qtools\backup_wrapper.py backup \x3C相对路径> [元素名]
  • 违规后果:主人会生气 😡
  • 示例
    # 修改 home.wxml 前
    python .qtools\backup_wrapper.py backup subpk-home/pages/home/home.wxml BGM开关
    # 然后才能修改文件
    

规则 2:时间窗口

  • 规则:5 分钟内同文件只保留第一个备份
  • 实现backup_wrapper.py 自动检查 .backups\state.json 中的 lastBackupTime
  • AI 无需判断,脚本自动处理

规则 3:元素追踪

  • 规则:同一元素调整超过 3 次 → 自动建元素快照
  • 实现backup_wrapper.py 自动追踪元素调整次数(基于 [元素名] 参数)
  • AI 无需判断,脚本自动处理

规则 4:Git Commit 后清理

  • 触发条件:执行 git commit
  • 动作:执行 python .qtools\backup_wrapper.py clean
  • 示例
    git commit -m "fix: xxx"
    python .qtools\backup_wrapper.py clean
    

规则 5:禁止跳过备份

  • 禁止行为:跳过备份直接修改文件
  • AI 必须自觉遵守,不能等主人提醒
  • 违规后果:主人会生气 😡

3. AI 工作流程

标准流程

  1. 收到文件修改任务
  2. 立即执行备份python .qtools\backup_wrapper.py backup \x3C相对路径> [元素名]
  3. 等待备份成功(确认输出 "Backup saved" 或类似信息)
  4. 修改文件
  5. 如果修改 >3 次,备份脚本会自动建元素快照
  6. Git commit 后执行清理python .qtools\backup_wrapper.py clean

禁止行为 ❌

  • 跳过备份直接修改文件
  • 等主人提醒才备份
  • 忘记在 git commit 后执行清理
  • 同一元素调整超过 3 次但不建元素快照

4. 触发条件

本 Skill 在以下场景自动触发

  • 任何修改 pet-game/ 目录下的文件(WXML/WXSS/JS/JSON/MD 等)
  • 任何 Git commit 操作后
  • 任何元素位置调整、样式修改、功能变更

5. 相关文件

  • 备份脚本:.qtools/backup_wrapper.py
  • 备份区:.backups/
  • 元素快照:.backups/ELEMENT-SNAPSHOTS.md
  • 项目根目录:C:\Users\marsz\.qclaw\workspace\pet-game

6. 注意事项

  1. 每次修改前必须备份,这是最高优先级规则
  2. 备份脚本会自动处理时间窗口和元素追踪
  3. Git commit 后必须执行���理
  4. 如果不确定是否需要备份,默认执行备份
  5. 禁止跳过任何备份步骤

⚠️ 警告:不遵守本规则将导致主人不满。AI 必须自觉执行备份!

Usage Guidance
Review the local backup_core implementation before enabling this skill, make sure the wrapper is confined to the Pet-Game workspace, and confirm that .backups is excluded from sharing or version control.
Capability Assessment
Purpose & Capability
The stated purpose—backup before editing the Pet-Game project and cleanup after commit—is coherent, but the wrapper exposes file backup/list/restore/clean operations through an external SmartBackup module whose behavior is not included for review.
Instruction Scope
The skill mandates automatic backup before every file modification and cleanup after git commit. That matches the stated workflow, but users should know it can cause autonomous local command execution around edits.
Install Mechanism
There is no install spec or declared dependency, while the code imports backup_core from a hard-coded local path outside the supplied package.
Credentials
The code hard-codes a Windows user workspace path even though the metadata declares no OS restriction, so it may fail or target a fixed local directory rather than the current user's selected workspace.
Persistence & Privilege
The skill intentionally creates persistent .backups state and snapshots and later cleans them after commit. This is disclosed and purpose-aligned, but those backups may retain historical file contents.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install pet-game-workflow
  3. After installation, invoke the skill by name or use /pet-game-workflow
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of the Pet-Game 工作流 Skill with strict version control and workflow rules. - Requires a backup of any file before modification using the provided Python script. - Automates backup time windows and element adjustment tracking; same file is only backed up once every 5 minutes. - Enforces: after 3+ changes to an element, an automatic snapshot is created. - Mandates running the cleanup script after every git commit. - Highlights prohibited actions such as skipping backups or not following the process.
Metadata
Slug pet-game-workflow
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Pet-Game workflow?

规范 Pet-Game 小程序项目的文件修改前自动备份、元素快照管理及 Git 提交后的备份清理工作流程。 It is an AI Agent Skill for Claude Code / OpenClaw, with 39 downloads so far.

How do I install Pet-Game workflow?

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

Is Pet-Game workflow free?

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

Which platforms does Pet-Game workflow support?

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

Who created Pet-Game workflow?

It is built and maintained by marszxf (@marszxf); the current version is v1.0.0.

💬 Comments