/openmatrix:om:wikifrom openmatrix
Generates project wiki documentation by analyzing project structure via codegraph or fallback Bash/Read. Supports overview, tech stack, architecture, coding standards, business logic, data interfaces, sequence diagrams, and core modules in Chinese, English, or bilingual.
Ships in openmatrix. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
AI 应根据用户语义判断意图:
| 用户意图 | 应调用 |
|---|---|
| 实现代码任务 | /om:start 或 /om:feature |
| 设计方案 | /om:brainstorm |
| 状态检查 | /om:status |
| 调试问题 | /om:debug |
| 用户消息 | 判断 | 结果 |
|---|---|---|
| "生成项目文档" | 文档意图 | 触发 ✓ |
| "写个 wiki" | wiki 意图 | 触发 ✓ |
| "帮我理解项目架构" | 架构理解意图 | 触发 ✓ |
| "生成 API 文档" | 文档意图 | 触发 ✓ |
| "实现登录功能" | 代码任务 | /om:feature |
| "查看任务状态" | 状态检查 | /om:status |
相关技能: /om:research (领域调研) | /om:plan (方案生成)
Step 0: 检测前置条件(codegraph 可用性)
Step 1: 选择语言(中文/英文/双语)
Step 2: 扫描项目结构
Step 3: 选择模块
Step 4: 选择文档类型
Step 5: 分析模块内容
Step 6: 生成文档
Step 7: 写入文件
Step 8: 完成报告
铁律:无 codegraph 必须降级,不得跳过降级流程 铁律:大模块必须提示用户,不得一次性生成过多文档
根据项目结构自动生成高质量的项目文档,支持中英文双语,输出格式规范,包含概述、技术栈、架构设计、编码规范、业务逻辑、数据接口、时序图、核心模块等文档类型。检查 codegraph MCP 是否可用:
尝试调用 codegraph_status(通过 ToolSearch 加载后调用):
// 尝试加载 codegraph 工具
ToolSearch({ query: "select:codegraph_status", max_results: 1 })
如果工具加载成功,调用 codegraph_status 检查索引状态。
判断结果处理:
| 结果 | 处理 |
|---|---|
| codegraph 可用且索引新鲜 | 继续执行 Step 1,使用 codegraph 分析 |
| codegraph 可用但索引过期 | 提示用户可能需要重新索引,询问是否继续 |
| codegraph 不可用 | 提示降级模式,使用 Bash + Read 分析 |
codegraph 不可用时提示用户:
AskUserQuestion: header: "前置条件", multiSelect: false
question: 检测到项目未初始化 CodeGraph。建议运行 codegraph init -i 构建索引以获得更准确的分析结果。也可以继续使用降级模式(Bash + Read 分析)。
| label | description |
|---|---|
| 继续使用降级模式 | 使用 Bash + Read 分析(较慢,但可用) |
| 取消 | 稍后初始化 codegraph |
AskUserQuestion: header: "文档语言", multiSelect: false
question: 选择文档语言?
| label | description |
|---|---|
| 中文 | 生成中文文档 |
| 英文 | 生成英文文档 |
| 中英双语 | 同时生成中英文文档 |
记录用户选择:lang = "zh" | "en" | "both"
如果 codegraph 可用:
// 使用 codegraph_files 获取文件树
codegraph_files({ path: "." })
如果降级模式:
# 使用 Bash 获取目录结构
find . -maxdepth 3 -type d -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.openmatrix/*' 2>/dev/null | head -50
# 获取主要源文件
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.tsx" -o -name "*.jsx" -o -name "*.py" -o -name "*.go" -o -name "*.java" \) -not -path '*/node_modules/*' -not -path '*/dist/*' 2>/dev/null | head -100
分析并输出模块树:
根据扫描结果,识别主要模块(目录),输出模块树结构:
项目模块结构:
📦 openmatrix (根模块)
├── 📂 src/
│ ├── 📂 orchestrator/ # 核心编排逻辑
│ ├── 📂 agents/ # Agent 实现
│ ├── 📂 storage/ # 状态持久化
│ └── 📂 cli/ # CLI 命令
├── 📂 skills/ # Skills 定义
├── 📂 docs/ # 文档
└── 📂 tests/ # 测试
AskUserQuestion: header: "模块选择", multiSelect: true
question: 选择要生成文档的模块(可多选)
| label | description |
|---|---|
| 全部模块 | 生成所有模块的文档(推荐) |
| 仅根模块 | 只生成项目级文档 |
| src/orchestrator | 选择特定模块 |
| src/agents | 选择特定模块 |
| ... | ... |
如果用户选择"全部模块",确认模块数量:
如果检测到超过 10 个模块,提示:
AskUserQuestion: header: "模块数量", multiSelect: false
question: 检测到 {count} 个模块,生成全部文档可能耗时较长。建议选择核心模块。
| label | description |
|---|---|
| 继续生成全部 | 完整生成(耗时较长) |
| 仅核心模块 | 只生成主要模块的文档 |
AskUserQuestion: header: "文档类型", multiSelect: true
question: 选择要生成的文档类型(可多选)
| label | description |
|---|---|
| 概述 | 项目简介、核心功能、快速开始 |
| 技术栈 | 依赖、框架、工具链 |
| 架构设计 | 系统架构、模块关系、数据流 |
| 编码规范 | 代码风格、命名规范、最佳实践 |
| 业务逻辑 | 核心业务流程、规则、算法 |
| 数据接口 | API、数据模型、接口定义 |
| 时序图 | Mermaid 格式的流程时序图 |
| 核心模块 | 关键模块详解、接口说明 |
默认推荐: 全选(如果用户不确定)
记录用户选择:docTypes = ["overview", "tech_stack", "architecture", ...]
对每个选中的模块执行分析:
// 获取模块上下文
codegraph_context({ symbol: "模块路径", depth: 2 })
// 探索模块源代码
codegraph_explore({ symbols: ["相关符号列表"] })
# 查找模块下的关键文件
find {modulePath} -type f \( -name "*.ts" -o -name "*.js" \) | head -20
# 读取 package.json 获取依赖
cat package.json
# 读取 CLAUDE.md 获取项目规范
cat CLAUDE.md
# 搜索导入语句识别依赖
grep -r "import.*from" {modulePath} --include="*.ts" | head -50
分析内容:
对每个模块、每种文档类型生成内容:
# {模块名} - 概述
## 简介
[模块核心功能描述]
## 核心特性
- 特性 1
- 特性 2
## 快速开始
[使用示例]
## 目录结构
[模块目录树]
# {模块名} - 技术栈
## 核心框架
- TypeScript 5.x
- Node.js 18+
## 主要依赖
| 依赖 | 版本 | 用途 |
|------|------|------|
| vitest | ^1.6.0 | 测试框架 |
| ... | ... | ... |
## 开发工具
- npm / yarn
- ESLint
- Prettier
# {模块名} - 架构设计
## 系统架构
[架构图(Mermaid 格式)]
## 模块关系
| 模块 | 职责 | 依赖 |
|------|------|------|
| orchestrator | 任务编排 | storage, agents |
| ... | ... | ... |
## 数据流
[数据流图]
# {模块名} - 编码规范
## 代码风格
- TypeScript strict mode
- ES2022 目标
- ES Modules
## 命名规范
- 文件名:小写-连字符
- 类名:PascalCase
- 函数名:camelCase
- 常量:UPPER_SNAKE_CASE
## 最佳实践
- 先写测试再实现(TDD)
- 单一职责原则
- 依赖注入
# {模块名} - 业务逻辑
## 核心业务流程
### 任务执行流程
1. 用户提交任务
2. 系统解析任务描述
3. 调度器分配任务给 Agent
4. Agent 执行任务
5. 验证结果
6. 完成或重试
## 业务规则
- 规则 1:[描述]
- 规则 2:[描述]
## 边界情况
- 情况 1:[处理方式]
# {模块名} - 数据接口
## 核心数据模型
### Task
```typescript
interface Task {
id: string;
name: string;
status: 'pending' | 'in_progress' | 'completed' | 'failed';
// ...
}
创建新任务
请求体:
{
"name": "任务名称",
"description": "任务描述"
}
响应:
{
"id": "task-123",
"status": "pending"
}
### 6.7 时序图文档(时序图.md)
```markdown
# {模块名} - 时序图
## 任务执行时序
```mermaid
sequenceDiagram
participant User
participant CLI
participant Scheduler
participant Agent
User->>CLI: 提交任务
CLI->>Scheduler: 创建任务
Scheduler->>Agent: 分配任务
Agent->>Agent: 执行任务
Agent->>Scheduler: 返回结果
Scheduler->>CLI: 更新状态
CLI->>User: 展示结果
[其他时序图...]
### 6.8 核心模块文档(核心模块.md)
```markdown
# {模块名} - 核心模块
## Executor(执行器)
**职责:** 负责任务的执行和状态管理
**关键接口:**
```typescript
class Executor {
async execute(task: Task): Promise<Result>;
async verify(task: Task): Promise<boolean>;
}
依赖:
[模块详解...]
[模块详解...]
## Step 7: 写入文件
**创建目录结构:**
```bash
# 根据语言选择创建目录
mkdir -p docs/wiki/zh/{project}
mkdir -p docs/wiki/en/{project}
写入文档文件:
对每个模块、每种文档类型:
docs/wiki/{lang}/{module}/{docType}.md生成 _module.yaml:
每个模块目录下生成元数据文件:
schema_version: 1
module_path: "src/orchestrator"
title: Orchestrator 模块
scope:
- src/orchestrator/
source_files:
- src/orchestrator/executor.ts
- src/orchestrator/scheduler.ts
depends_on:
- storage
- agents
related_to: []
生成全局索引 _index.yaml:
schema_version: 1
generated_at: "2026-07-24T10:00:00Z"
language: zh
modules:
- path: ""
title: openmatrix
docs:
- 概述.md
- 技术栈.md
- 架构设计.md
- path: "src/orchestrator"
title: Orchestrator
docs:
- 核心模块.md
- 时序图.md
输出执行摘要:
✅ Wiki 文档生成完成!
📊 执行统计:
- 生成模块数:{moduleCount}
- 生成文档数:{docCount}
- 语言:{lang}
- 输出目录:docs/wiki/{lang}/
📝 生成的文档:
- docs/wiki/zh/openmatrix/概述.md
- docs/wiki/zh/openmatrix/技术栈.md
- docs/wiki/zh/openmatrix/架构设计.md
- docs/wiki/zh/openmatrix/编码规范.md
- docs/wiki/zh/openmatrix/业务逻辑.md
- docs/wiki/zh/openmatrix/数据接口.md
- docs/wiki/zh/openmatrix/时序图.md
- docs/wiki/zh/openmatrix/核心模块.md
💡 提示:
- 文档已生成,建议人工审核内容准确性
- 可根据实际情况补充细节
- 如需更新,重新运行 /om:wiki 即可
$ARGUMENTS
/om:wiki # 交互式生成项目文档
/om:wiki --lang=zh # 指定中文
/om:wiki --module=src/core # 指定模块
## codegraph 降级处理
| 错误场景 | 处理策略 |
|---|---|
| codegraph 不可用 | 降级使用 Bash + Read |
| 模块无源文件 | 生成简化版文档,跳过代码相关文档 |
| 生成文档为空 | 警告用户,继续生成其他文档 |
| 写入文件失败 | 重试一次,仍失败则跳过并记录 |
docs/wiki/zh/docs/wiki/en//om:wiki 覆盖What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (bigfish1913/openmatrix) — no native marketplace selected
npx claudepluginhub p/bigfish1913-openmatrixOther plugins' skills for the same job
20 skills in this plugin
/om:approveUse when handling pending approvals including plan review, merge confirmation, deploy approval, and blocked task decisions during OpenMatrix execution. Triggers on APPROVAL intent: user wants to review and approve pending items, handle merge conflicts, or confirm deploy. DO NOT trigger on: starting tasks, debugging, or status checks. Intent signals: user mentions 'approve', 'review plan', 'confirm merge', 'approve deploy', or refers to pending approval actions./om:autoUse when the user wants fully automated task execution with zero manual approvals. Triggers on AUTOMATION intent: user explicitly requests hands-free execution, wants to skip all confirmations, or needs batch processing without interruptions. Expects plan.md + tasks-input.json to already exist (generated by /om:plan). DO NOT trigger on: interactive requests, debugging, or status checks. Intent signals: user says 'fully auto', 'hands-free', 'no interruptions', 'skip approvals', or describes large batch operations./om:brainstorm