Rust Rebuilder
name: rust-rebuilder
by dandandujie · published 2026-03-22
$ claw add gh:dandandujie/dandandujie-rust-rebuilder---
name: rust-rebuilder
description: Plan and execute incremental project rewrites to Rust with architecture mapping, parity verification, idiomatic Rust guidance, dependency preflight checks, and GitHub upstream synchronization. Use when users ask to port or rewrite existing systems into Rust, need latest Rust feature checks, want migration pitfall prevention, or need continuous sync with source repository commits and pull requests.
---
# Rust Rebuilder
Overview
使用“分阶段、可验证、可回滚”的方式重写项目到 Rust。优先确保行为等价和可观测性,再做性能与架构优化。
Dependency Preflight (Mandatory)
每次执行前先运行:
python3 scripts/check_dependencies.py自动检测以下依赖是否可用:
若任一缺失,必须输出安装引导并暂停当前重写任务。安装引导顺序:
1. 优先使用 `$skill-installer` 安装缺失 skill。
2. 若无可用安装器,则给出手动安装地址:
- grok-search skill: `https://github.com/Frankieli123/grok-skill`
- grok-search MCP: `https://github.com/GuDaStudio/GrokSearch`
- github-helper: 当前用户 GitHub 仓库中的 `github-helper` skill 仓库
3. 明确标记“依赖未满足,重写任务暂停”。
Workflow
1. 定义范围:确认系统边界、关键路径、性能目标、上线约束。
2. 建立映射:将源项目的模块/接口/数据模型映射到 Rust crate 与模块结构。
3. 制定切片:按垂直功能切分迁移批次,每批必须可编译、可测试、可回归。
4. 执行重写:先保行为一致,再替换为更地道的 Rust 设计;若是后端代码,强制套用 `references/rust-backend-guidelines.md`。
5. 校验对齐:运行编译、测试、基准、回归对比,阻断行为漂移。
6. 跟踪上游:若源项目在 GitHub,持续同步 upstream 变更并更新重写 backlog。
Backend Rust Guardrails
当目标是后端 Rust 代码(例如 API、作业系统、数据库访问、异步任务)时,必须先读取 `references/rust-backend-guidelines.md`,并在输出中显式说明以下检查点:
Mandatory Output Contract
在每次执行中输出以下内容,避免“只给代码不讲迁移依据”:
Implementation Rules
Rust Feature and Idiom Strategy
执行时先读取 `references/rust-language-update-playbook.md`,并遵循:
Pitfall Prevention
执行时读取 `references/rewrite-pitfalls-and-antipatterns.md`,至少检查:
GitHub Upstream Synchronization
若源项目来自 GitHub,执行时读取 `references/github-upstream-sync.md` 并优先:
1. 用 `github-helper` skill 管理本地克隆与仓库知识快照。
2. 用 `scripts/upstream_sync_report.py` 生成 upstream 差异报告。
3. 将新增 commits/PR 分类映射为 Rust 重写 backlog(行为修复、接口变更、性能变更)。
Skill Collaboration
Resource Map
Quick Start Prompt Pattern
使用以下模板触发技能:
`使用 $rust-rebuilder,把 <源项目/模块> 分三批重写到 Rust;每批给出等价验证方案、风险点和与 upstream 同步策略。`
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...