From omni-reverse
Orchestrates reverse-engineering of project functions: identifies entry points, scenarios, and generates function documentation with caching and batch processing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/omni-reverse:reverse-functionsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
- **职责**:基于项目入口与场景信息,完成:
references/stages/01-project-entry-identification.mdreferences/stages/02-scenario-identification.mdreferences/stages/03-function-partitioning.mdreferences/stages/04-function-detail-extraction-and-document-generation.mdreferences/token-management.mdscripts/python/generate_entry_batches.pyscripts/python/generate_function_batches.pyscripts/python/generate_function_doc_batches.pyreverse --target functions ... 或 --target all 触发--path / --files 等参数确定扫描范围{REPO_ROOT}/.cache/reverse/functions/
project-entries.jsonscenarios.jsonfunction-list.json、function-tree.json.cache-status.json{REPO_ROOT}/omni-doc/specs/functions/
FUNC-XXX-功能名称.md本 Skill 对应原
reverse-functions的“快捷命令 + 详细步骤”,现在以 Skill 形式承载该编排逻辑。
本 Skill 阶段文档中引用了以下路径变量,执行阶段命令前须先解析:
${CLAUDE_PLUGIN_ROOT}:omni-reverse 插件安装根(运行期注入;指向本 skill 内专属脚本,如 ${CLAUDE_PLUGIN_ROOT}/skills/reverse-<X>/scripts/)。${DSDD}:共享插件 omni-dsdd 安装根(含共享 scripts/ 与 omni-infra/)。首次使用前必须解析:
DSDD="$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-dsdd-root.sh")" || { echo "缺少 omni-dsdd,中止"; exit 1; }
解析器优先用 ${CLAUDE_PLUGIN_ROOT}/../omni-dsdd,回退到脚本相对位置推算;失败则提示需与 omni-reverse 同 marketplace 安装 omni-dsdd。{REPO_ROOT} / ${CLAUDE_WORKING_DIR}:被反构的代码工程根(运行期产物,与插件位置无关)。${CLAUDE_SKILL_DIR}:本 skill 自身目录(指向本 skill 内 references/scripts/ 等自包含资源)。说明:
${DSDD}不是运行期自动注入的变量,必须经resolve-dsdd-root.sh取值后方可使用。
reverse 命令的关系reverse 负责:
--target 固定为 functions(或在 all 流水线中进入功能阶段);--interactive / --non-interactive / --yes);本 Skill 按以下阶段执行,阶段详细说明见本目录下 references/stages/:
.cache-status.json,confirmed==true 时跳过该阶段{REPO_ROOT}/.cache/reverse/functions/.cache-status.jsonproject_entry_identification、scenario_identification、function_partitioning、function_document_generation 四个段落confirmed == true 且对应输出存在,可在后续执行中跳过该阶段。project-entries.json(支持批次与索引)--interactive 模式下可让用户确认入口识别结果。scenarios.json(支持批次与索引)function-list.json(批次+索引)function-tree.json--interactive 模式下展示功能划分结果并等待确认。{REPO_ROOT}/omni-doc/specs/functions/FUNC-XXX-功能名称.mdfunction-list.json 为输入,分批处理功能;.omni-infra/metamodel/5.function-template.md 的结构和字段生成文档(frontmatter、章节、PlantUML 部分等必须保持一致);--interactive:在每个阶段结束后暂停,使用中文询问用户是否继续;--non-interactive / --yes:强制全自动。{REPO_ROOT}/.cache/reverse/functions/.cache-status.jsonreverse 为功能反构创建主任务与 4 个阶段 todo;{REPO_ROOT}/.cache/reverse/functions/.cache-status.json,记录各阶段 confirmed 状态{stage}/batch-details-{N}.json 和 {stage}-batch-status.json{stage}-index.json,避免生成过大的合并文件| 传递方向 | 传递方式 | 传递内容 |
|---|---|---|
| 阶段1 → 阶段2 | entry-index.json | 入口点批次索引和统计 |
| 阶段2 → 阶段3 | scenario-index.json | 场景批次索引和统计 |
| 阶段3 → 阶段4 | function-index.json + function-tree.json | 功能清单索引和功能树结构 |
本 Skill 编排 4 个阶段,各阶段通过 Agent 工具调用子 Agent 执行并发分析。
子 Agent 命名空间:子 Agent 使用归属插件的命名空间前缀,由 Agent 工具的 subagent_type 参数指定——本插件(omni-reverse)本地提供的 agent 用 omni-reverse: 前缀,omni-dsdd 共享的 agent 用 omni-dsdd: 前缀。
| 阶段 | 子 Agent | 职责 | 并发策略 |
|---|---|---|---|
| 阶段1 | omni-dsdd:entry-identifier | 识别项目入口点 | 每轮最多2个 |
| 阶段2 | omni-reverse:scenario-recognizer | 识别业务场景 | 每轮最多2个 |
| 阶段3 | omni-dsdd:function-partitioner | 划分功能构建功能树 | 每轮最多2个 |
| 阶段4 | omni-dsdd:function-detail-writer | 生成功能详细文档 | 每轮最多2个 |
并发控制:采用分轮执行策略,每轮启动不超过2个子 Agent,避免上下文超限。每轮完成后执行 /compact 压缩上下文。
参数传递:通过 {REPO_ROOT}/.cache/reverse/functions/{stage}/batch-details-{N}.json 文件传递批次信息。
返回值处理:子 Agent 将结果写入对应批次文件,主 Agent 收集后更新索引文件。
合并检查:每轮处理完成后,主 Agent 必须验证:
本 Skill 的详细规范位于本目录下 references/:
执行本 Skill 时,AI Agent 应读取上述文档并严格按照其中描述的步骤和数据结构进行操作。
执行功能反构,自动识别入口点、场景、功能并生成文档:
reverse --target functions --path ./src
在每个阶段完成后暂停确认:
reverse --target functions --interactive --path ./src
从断点恢复,跳过已确认的阶段:
reverse --target functions --path ./src
# 阶段1已确认(confirmed=true),自动跳过
| 场景 | 正确输出 | 禁止输出 |
|---|---|---|
| 无入口点 | "未找到任何入口点,请检查扫描路径" | 基于猜测列出虚假入口 |
| 阶段产出缺失 | 报错并退出当前阶段 | 跳过或自行生成 |
npx claudepluginhub zte-aicloud/co-omnispec --plugin omni-reverse自动编排8个阶段(逻辑架构、接口、功能、实体、场景、需求、外部接口、规则)生成完整代码库逆向工程文档,适用于代码分析、知识提取、架构文档生成和存量代码逆向。
Generate PRD and Design Docs from existing codebase through discovery, generation, verification, and review workflow
Reverse-engineers existing codebases to produce PRDs and Design Docs through a structured discovery, generation, verification, and review workflow.