Code Context Slicing
trailofbits/skills
Picks a small, graph-based slice of source with Trailmark and hands a focused code task to a smaller or local model without exposing the whole repository.
Java/Maven single-module deep documentation generator. An agent skill from LeoYeAI/openclaw-master-skills.
$ npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install LeoYeAI/openclaw-master-skills module-analyzer-generate-doc --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/LeoYeAI/openclaw-master-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/module-analyzer-generate-doc .claude/skills/module-analyzer-generate-doc && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "module-analyzer-generate-doc" agent skill from https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-doc into .claude/skills/module-analyzer-generate-doc/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "module-analyzer-generate-doc", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-docType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install LeoYeAI/openclaw-master-skills module-analyzer-generate-doc --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LeoYeAI/openclaw-master-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/module-analyzer-generate-doc .agents/skills/module-analyzer-generate-doc && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "module-analyzer-generate-doc" agent skill from https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-doc into .agents/skills/module-analyzer-generate-doc/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "module-analyzer-generate-doc", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install LeoYeAI/openclaw-master-skills module-analyzer-generate-doc --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LeoYeAI/openclaw-master-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/module-analyzer-generate-doc .cursor/skills/module-analyzer-generate-doc && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "module-analyzer-generate-doc" agent skill from https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-doc into .cursor/skills/module-analyzer-generate-doc/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "module-analyzer-generate-doc", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/LeoYeAI/openclaw-master-skills.git --path skills/module-analyzer-generate-doc--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install LeoYeAI/openclaw-master-skills module-analyzer-generate-doc --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LeoYeAI/openclaw-master-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/module-analyzer-generate-doc .gemini/skills/module-analyzer-generate-doc && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "module-analyzer-generate-doc" agent skill from https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-doc into .gemini/skills/module-analyzer-generate-doc/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "module-analyzer-generate-doc", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install LeoYeAI/openclaw-master-skills module-analyzer-generate-docInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/LeoYeAI/openclaw-master-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/module-analyzer-generate-doc .github/skills/module-analyzer-generate-doc && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "module-analyzer-generate-doc" agent skill from https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-doc into .github/skills/module-analyzer-generate-doc/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "module-analyzer-generate-doc", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install LeoYeAI/openclaw-master-skills module-analyzer-generate-doc --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/LeoYeAI/openclaw-master-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/module-analyzer-generate-doc .opencode/skills/module-analyzer-generate-doc && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "module-analyzer-generate-doc" agent skill from https://github.com/LeoYeAI/openclaw-master-skills/tree/main/skills/module-analyzer-generate-doc into .opencode/skills/module-analyzer-generate-doc/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "module-analyzer-generate-doc", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
module-analyzer-generate-docJava/Maven single-module deep documentation generator. An agent skill from LeoYeAI/openclaw-master-skills.
Module Analyzer Generate Doc is an agent skill from LeoYeAI/openclaw-master-skills. Java/Maven single-module deep documentation generator. Generates L3(file-level) to L2(module-level) business logic docs for specified module. Supports multi-subagent parallel processing, context compression, checkpoint resume, and auto-retry.
Its SKILL.md is about 3.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files, including reference files (for example `CHANGELOG.md`, `README.md` and `VERIFICATION_REPORT.md`).
It sits in Agent Workflows, covering Technical documentation, LLM cost and token optimization and Subagents. It works with Java. The repository describes itself as: 🧠 Curated collection of 1209+ best OpenClaw skills — weekly updated by MyClaw.ai. The licence is MIT.
7 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit e5199b5. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown, powershell, json and yaml).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Module Analyzer Generate Doc loads about 3.4k tokens when it runs, and up to ~10k if it reads all its reference files. Until then it costs about 68 tokens; SKILL.md has 322 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from LeoYeAI/openclaw-master-skills at commit e5199b5, republished under its MIT licence (© LeoYeAI). 322 words, ~3,408 tokens.
.claude/skills/module-analyzer-generate-doc/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.专注于单个 Java/Maven 模块的深度业务逻辑分析 - 让 AI 全面理解模块的每个细节
单模块深度分析:
智能任务执行:
文档质量保证:
智能跳过机制:
当用户提到以下关键词时激活:
与 project-analyzer-generate-doc 的区别:
project-analyzer-generate-doc:全项目多模块扫描,生成 L3→L2→L1 三层文档module-analyzer-generate-doc:单模块深度扫描,生成 L3→L2 两层文档(更详细、更快速)# 1. 扫描模块目录结构
Get-ChildItem "<模块路径>" -Directory -Recurse | Where-Object { $_.Name -notmatch 'target|\.git|build' }
# 2. 统计 Java 文件
$javaFiles = Get-ChildItem "<模块路径>/src/main/java" -Include *.java -Recurse | Where-Object { $_.FullName -notmatch '\\test\\' }
# 3. 统计 XML 文件(MyBatis Mapper)
$xmlFiles = Get-ChildItem "<模块路径>/src/main/resources" -Include *.xml -Recurse | Where-Object { $_.Name -match 'mapper|Mapper' }
# 4. 检查已存在文档
$existingDocs = Get-ChildItem "<项目根目录>/.ai-doc/<模块名>" -Include *.md -Recurse 2>$null
# 5. 制定分片计划
# - <20 文件:单子代理
# - 20-50 文件:3-4 个子代理分片
# - >50 文件:5-6 个子代理分片,每片 10-16 个文件输出: 文件列表 + 分片计划 + 已存在文档检查
目的: 检查已存在的文档是否符合要求,按需迁移或更新
检查规则:
1. 文档路径是否符合 `.ai-doc/模块名/src/main/java/包路径/类名.java.md` 规则
2. 文档内容是否包含详细业务逻辑描述(非简单解释)
3. 文档是否包含代码片段(应全部为自然语言)
处理策略:
- 路径不符合 → 迁移到正确位置
- 内容过于简单 → 重新生成
- 内容符合要求 → 保留,不重复生成
- 源码已变更 → 更新文档目的: 识别不符合要求的文档,仅生成报告,不自动删除
# 1. 识别低质量文档(只有模板框架,无实际业务内容)
$lowQualityDocs = Get-ChildItem "<项目根目录>/.ai-doc/<模块名>" -Include *.md -Recurse | Where-Object {
$content = Get-Content $_.FullName -Raw
$lineCount = (Get-Content $_.FullName).Count
# 行数少于 20 行
$lineCount -lt 20 -or
# 只包含模板框架文字
$content -match 'Business component - participates in system business processing' -or
$content -match 'Executes business logic based on specific scenario' -or
$content -match 'Simple data object' -or
$content -match 'Interface definition - declares contract specification'
}
# 输出报告,供用户决定是否处理
foreach ($doc in $lowQualityDocs) {
Write-Host "低质量文档:$($doc.FullName)"
}
# 2. 识别空文件夹(供用户参考)
Get-ChildItem "<项目根目录>/.ai-doc/<模块名>" -Directory -Recurse | ForEach-Object {
if ((Get-ChildItem $_.FullName -Force).Count -eq 0) {
Write-Host "空目录:$($_.FullName)"
}
}⚠️ 重要安全约束:
# 询问用户确认
$confirm = Read-Host "是否删除 $($lowQualityDocs.Count) 个低质量文档?(y/n)"
if ($confirm -eq "y") {
# 移动到回收站而非直接删除(如果可能)
foreach ($doc in $lowQualityDocs) {
Write-Host "将移动到回收站:$($doc.FullName)"
}
}子代理分片策略:
| 文件总数 | 子代理数 | 每片文件数 | 超时时间 |
|---|---|---|---|
| <20 | 1 | 全部 | 300 秒 |
| 20-50 | 3-4 | 10-16 | 600 秒 |
| 50-80 | 5 | 12-18 | 900 秒 |
| >80 | 6-8 | 10-14 | 900 秒 |
子代理任务模板:
# 任务:为 <模块名> 模块生成 L3 文档(分片 X/Y)
## 项目路径
<绝对路径>
## 源码根目录
<模块路径>/src/main/java
## 输出目录
<项目根目录>/.ai-doc/<模块名>/
## 本分片文件列表
<文件列表,10-16 个>
## 核心要求
### 1. 文档内容要求
- **详细业务逻辑描述**:将代码逻辑转换为自然语言,非程序员也能理解
- **不包含代码片段**:MD 文件中不要出现任何原代码
- **方法级别分析**:每个有业务逻辑的方法都要描述其执行流程、业务语义
- **领域知识**:解释涉及的业务概念、领域术语
- **流程上下文**:方法间的调用关系、数据流转
- **设计意图**:为什么这样设计,解决什么问题
### 2. 文档路径规则(⚠️ 重要!)
- 源文件:`<模块路径>/src/main/java/包路径/类名.java`
- 文档:`<项目根目录>/.ai-doc/<模块名>/src/main/java/包路径/类名.java.md`
- **⚠️ 必须包含 `src/main/java/` 完整路径!**
- **❌ 错误示例**:`.ai-doc/app-api/com/infypower/...`(缺少 src/main/java)
- **✅ 正确示例**:`.ai-doc/app-api/src/main/java/com/infypower/...`
- 生成文档前必须检查路径是否正确,错误路径的文档会被视为无效
### 3. 跳过规则(⚠️ 严格执行!)
**必须跳过的文件类型**(满足任一条件即跳过):
| 类型 | 判断标准 | 示例 |
|------|----------|------|
| **DTO/VO/Param** | 类名以 DTO/VO/Param/BO 结尾,且行数<50,且不包含方法(除 getter/setter) | UserDTO.java, LoginVO.java |
| **枚举** | 包含 `enum` 关键字,且不包含复杂方法 | PaymentStatus.java |
| **常量类** | 类名包含 Constant,且只包含 `public static final` 字段 | AppApiConstant.java |
| **接口** | 包含 `public interface`,且无方法实现 | UserService.java |
| **MapStruct Converter** | 包含 `@Mapper` 注解,或接口名包含 Converter | UserConverter.java |
| **抽象基类** | 包含 `public abstract class`,且方法都是抽象的 | AbstractHandler.java |
| **测试类** | 类名包含 Test,或包含 `@Test` 注解 | UserServiceTest.java |
**代码特征检查**(满足任一条件即跳过):
**⚠️ 必须生成文档的情况**(满足任一条件):
- Controller 类(包含 API 接口)
- Service/ServiceImpl 类
- Helper/Util 类(包含业务方法)
- Consumer/Listener 类(消息处理)
- Job/Task 类(定时任务)
- Config 配置类(包含 Bean 定义)
- Interceptor/Filter/Aspect 类
- 任何包含实际业务逻辑的类
### 4. 文档质量自检(⚠️ 生成后必须检查!)
**生成每个文档后自检**,确保文档合格:
**✅ 合格文档检查清单**(必须全部满足):
- [ ] 文档行数 > 30 行
- [ ] 包含"触发条件"或类似描述(什么时候执行)
- [ ] 包含"输入数据"或"处理流程"描述(如何处理)
- [ ] 包含"业务规则"或"判断逻辑"描述(判断条件)
- [ ] 包含"输出结果"或"数据流转"描述(结果去向)
- [ ] 不包含原代码片段(`public class`, `if ()`, `return` 等关键字)
**❌ 低质量文档特征**(出现任一需重新生成,不建议使用):
- [ ] 文档行数 < 20 行
- [ ] 只包含模板框架("Business component", "Interface definition", "Simple data object")
- [ ] 只重复类名和包名,无实际业务解释
- [ ] 核心业务逻辑部分只有"Executes business logic based on specific scenario"
**自检示例**:
```markdown
# ❌ 低质量文档(需要重新生成)
## Business Responsibility
Business component - participates in system business processing
## Core Business Logic
Executes business logic based on specific scenario
# ✅ 合格文档(正确示例)
## 业务职责
AuthService 是认证服务核心类,处理用户账户的创建、更新、查询,
以及支付宝授权码验证和加密手机号解密。当用户通过小程序授权登录时,
该类负责从微信/支付宝获取用户信息,创建或更新本地用户账户...
## 核心业务逻辑
### 支付宝授权码验证
触发条件:用户在小程序点击授权登录,前端传入 auth_code
处理流程:
1. 调用支付宝 API 换取用户 open_id
2. 验证返回的 open_id 是否有效
3. 根据 open_id 查询本地用户...# {类名} - 业务逻辑详解
## 基本信息
- **文件路径**: {relativePath}
- **行数**: {lines}
- **文件类型**: {Config/Controller/Service/ServiceImpl/Interceptor/Handler/Util}
- **所属模块**: {moduleName}
## 业务职责
{用自然语言描述这个类的业务职责,200-300 字}
## 核心业务逻辑
### {方法/功能点 1}
{详细描述该功能的业务逻辑流程,包括:
- 触发条件
- 输入数据处理
- 业务规则判断
- 数据流转过程
- 输出结果
- 异常情况处理
}
### {方法/功能点 2}
{同上}
## 业务流程
{描述方法间的调用关系和业务流转过程}
## 数据交互
{描述与数据库、外部服务、Redis、MQ 等的交互}
## 依赖关系
{该类依赖的其他组件和服务}
## 设计意图
{解释为什么这样设计,解决了什么业务问题}{
"chunk": "X/Y",
"status": "completed|partial",
"processed": ["File1.java", ...],
"skipped": ["SimpleClass.java", ...],
"failed": [],
"summaries": [
{"file": "File1.java", "lines": 150, "type": "Controller", "summary": "一句话业务摘要"}
]
}
**上下文压缩策略**:
每处理 2-3 个文件后: 保留:
丢弃:
---
### Step 2: 生成 L2 模块级文档
**触发条件**: 所有 L3 文档生成完成
**核心策略**:
- spawn 一个子代理
- 读取该模块所有 L3 文档的摘要信息
- 汇总生成 module.md
- 包含模块架构、核心业务流程、依赖关系
**L2 文档模板**:
详见 [references/l2-module-template.md](references/l2-module-template.md)
**核心章节**:
```markdown
# {模块名} - 模块详解
## 模块职责
{200-300 字概述模块的业务定位和核心价值}
## 文件索引表
| 文件路径 | 职责简述 | 类型 | 行数 |
|----------|----------|------|------|
{列出所有已生成 L3 文档的文件}
## 核心业务流程
### 1. {核心流程 1}
{详细描述跨类的业务流程,如用户认证授权流程}
### 2. {核心流程 2}
{如数据权限隔离流程}
### 3. {核心流程 3}
{如系统管理功能流程}
## MyBatis 映射关系
{SQL 与 Java 方法的映射关系,核心表说明}
## 模块依赖
- **内部依赖**: 依赖的其他模块
- **外部服务**: Redis/MySQL/Apollo/RabbitMQ/XXL-Job 等
- **框架依赖**: Spring Boot/MyBatis-Plus/Spring Security 等
## 配置项汇总
{application 配置文件的主要设置,按功能分类}
## 技术栈
{使用的框架和技术组件清单}路径: <项目根目录>/.ai-doc/.generate-state.json
内容:
{
"version": "1.0.0",
"projectPath": "<项目根目录>",
"targetModule": "<模块名>",
"startTime": "2026-03-07T10:17:00+08:00",
"currentPhase": "L3",
"overallProgress": 76.5,
"phases": {
"L3": {
"status": "completed|in_progress|pending",
"totalFiles": 81,
"processedFiles": 62,
"skippedFiles": 19,
"failedFiles": 0,
"chunks": {
"total": 5,
"completed": 5,
"inProgress": 0,
"pending": 0,
"failed": 0
}
},
"L2": {
"status": "completed|in_progress|pending",
"totalModules": 1,
"completedModules": 0
}
},
"subagents": [
{
"label": "L3-chunk1",
"status": "completed|running|failed|timeout",
"files": 16,
"startTime": "...",
"endTime": "..."
}
],
"lastCheckpoint": "2026-03-07T10:40:00+08:00",
"canResume": true
}retry_policy:
max_retries: 3 # 最大重试次数
initial_delay: 30 # 初始延迟(秒)
backoff_multiplier: 2 # 延迟倍增因子
max_delay: 300 # 最大延迟(秒)
retryable_errors:
- "timeout"
- "context_overflow"
- "file_access_error"
- "subagent_crash"频率: 每 20 分钟或每完成一个分片
内容:
## 📊 文档生成进度报告
**模块**: admin-api
**开始时间**: 2026-03-07 10:17:00
**当前时间**: 2026-03-07 10:40:00
**已用时间**: 23 分钟
### 总体进度:76.5%
### 当前阶段:L3 文件级文档生成
| 分片 | 状态 | 已处理 | 已跳过 |
|------|------|--------|--------|
| chunk1 | ✅ | 16 | 0 |
| chunk2 | ✅ | 6 | 10 |
| chunk3 | ✅ | 16 | 0 |
| chunk4 | ✅ | 13 | 4 |
| chunk5 | ✅ | 11 | 7 |
### 统计
- 已处理文件:62
- 已跳过文件:19(纯定义类)
- 失败文件:0目的: 确保所有包含业务逻辑的源码都有文档可依
流程:
# 1. 扫描所有 Java 文件
$javaFiles = Get-ChildItem "<模块路径>/src/main/java" -Include *.java -Recurse
# 2. 扫描所有已生成文档
$docFiles = Get-ChildItem "<项目根目录>/.ai-doc/<模块名>" -Include *.md -Recurse
# 3. 对比找出缺失文档的文件
foreach ($java in $javaFiles) {
$relative = $java.FullName.Replace("<模块路径>/src/main/java/", "")
$expectedDoc = "<项目根目录>/.ai-doc/<模块名>/$relative.md"
if (!(Test-Path $expectedDoc)) {
# 检查是否应该跳过
$content = Get-Content $java.FullName -Raw
if (ShouldSkip $content) {
Write-Host "跳过 (简单类): $relative"
} else {
Write-Host "缺失文档: $relative"
$missing += $relative
}
}
}
# 4. 对缺失文档的文件 spawn 补充任务
if ($missing.Count -gt 0) {
Spawn subagent to process missing files
}问题:子代理处理大模块时超时
解决:
1. 检查已生成的文件
2. 将剩余文件拆分为更小的分片(每片 5-7 个文件)
3. 增加超时时间到 15 分钟
4. 重新 spawn 子代理,传递已完成进度问题:子代理上下文使用率超过 60%
解决:
1. 立即触发强制压缩
2. 如果仍超过 60%,停止当前子代理
3. 将剩余文件拆分为更小的分片
4. 为新分片 spawn 新的子代理
5. 增加压缩频率(每 1 个文件就压缩)问题:文件因权限限制无法读取
解决:
1. 记录无法访问的文件到日志
2. 请求用户确认文件访问权限
3. 在最终报告中标注无法访问的文件
4. ⚠️ 禁止尝试提权、bash 工具或其他替代读取方式
5. 如果重试 3 次仍失败,跳过该文件在 TOOLS.md 中添加:
### Module Analyzer - Java 单模块深度文档生成器
- 默认分片大小:10-16 文件/子代理
- 最大并行:5-6 子代理
- 上下文阈值:40% 预警,50% 强制压缩
- 压缩频率:每处理 2-3 个文件
- 简单文件阈值:50 行
- 超时时间:300-900 秒(根据分片大小)
- 重试策略:最多 3 次,指数退避
- 进度汇报:每 20 分钟
- 断点续传:自动保存状态
- 文件读取失败处理:记录并重试
- 二次扫描:自动查漏补充用户:分析 E:\projects\mgmt-api-cp 的 admin-api 模块,生成业务逻辑文档
AI: 收到!开始执行单模块深度分析流程:
Step 0: 扫描 admin-api 模块结构...
📊 发现 81 个 Java 文件,1 个 XML 文件
Step 0.5: 检查已存在文档...
✅ 发现 20 个已有文档,检查内容质量
Step 1: 生成 L3 文件级文档(5 个子代理并行)...
📊 进度:62/81 文件已处理
🔄 活跃子代理:5/5
⏱️ 预计剩余时间:15 分钟
Step 2: 生成 L2 模块级文档...
✅ admin-api.md 生成完成(26KB)
二次扫描:查漏补充...
✅ 所有业务类都有文档可依
✅ 完成!生成 62 个 L3 文档 + 1 个 L2 模块文档用户:ces-domain 模块有代码变更,更新文档
AI: 收到!执行增量更新流程:
1. 检测变更文件(git diff 或时间戳比较)
2. 检查已存在文档质量
3. 只更新变更文件的 L3 文档
4. 重新汇总生成 ces-domain.md (L2)
注意:保持文档路径与源码路径一致用户:继续之前的文档生成任务
AI: 检测到未完成的生成任务...
## 上次任务状态
- 模块:admin-api
- 中断时间:2026-03-07 10:30:00
- 完成进度:L3 阶段 76.5% (62/81 文件)
- 失败分片:1 个(已重试 2 次)
是否从断点继续?(y/n)
用户:y
AI: 恢复任务...
- 跳过已完成的 62 个文件
- 重新处理 1 个失败分片
- 继续生成剩余 19 个文件的 L3 文档| 模块规模 | L3 生成 | L2 生成 | 总计 |
|---|---|---|---|
| 20 文件 | ~5 分钟 | ~2 分钟 | ~7 分钟 |
| 50 文件 | ~12 分钟 | ~4 分钟 | ~16 分钟 |
| 80 文件 | ~20 分钟 | ~5 分钟 | ~25 分钟 |
| 150 文件 | ~40 分钟 | ~8 分钟 | ~48 分钟 |
| 阶段 | 每文件/模块 | 总计 (80 文件) |
|---|---|---|
| L3 生成 | 200k tokens/文件 | 16M tokens |
| L2 生成 | 350k tokens/模块 | 350k tokens |
| 版本 | 日期 | 变更 |
|---|---|---|
| 1.0.3 | 2026-03-10 | 安全修复 (最终):移除 python 代码块引用、移除"必须执行"强制指令、完整清理所有风险关键词 |
| 1.0.2 | 2026-03-10 | 安全修复 (完整):移除所有 bash/external tool 引用、移除 elevated 权限引用、明确要求用户确认删除/迁移操作 |
| 1.0.1 | 2026-03-10 | 安全修复:移除提权/bash 引用、明确要求用户确认删除操作 |
| 1.0.0 | 2026-03-07 | 初始版本,基于 admin-api 模块实战经验 |
© LeoYeAI, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 8 other files (references) in skills/module-analyzer-generate-doc of LeoYeAI/openclaw-master-skills.
Open the folder on GitHubat commit e5199b5
Module Analyzer Generate Doc next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Module Analyzer Generate Doc this skillLeoYeAI/openclaw-master-skills | 2.2k | — | ~3.4k | Automated safety check: Pass | MIT | |
| Code Context Slicingtrailofbits/skills | 7.4k | — | ~2.1k | Automated safety check: Pass | CC-BY-SA-4.0 | |
| Fable Foremanolsenbrands/fable-foreman | 142 | — | ~5.2k | Automated safety check: Pass | MIT | |
| Document Featureiopsystems/rezolus | 275 | — | ~2.2k | Automated safety check: Pass | Custom licence | |
| Token Doctortechwolf-ai/ai-first-toolkit | 132 | — | ~4.1k | Automated safety check: Pass | MIT | |
| Docs Syncncatbot/NcatBot | 115 | — | ~1.3k | Automated safety check: Pass | Custom licence |
trailofbits/skills
Picks a small, graph-based slice of source with Trailmark and hands a focused code task to a smaller or local model without exposing the whole repository.
olsenbrands/fable-foreman
Turns the lead model into a foreman that plans, routes and verifies while cheaper Claude, Codex or Grok workers do the typing, using a per-machine routing card.
iopsystems/rezolus
Write or update the CLI --help text and README section for a new or changed rezolus feature (a subcommand, flag, mode, or behavior change), then prove the help is usable by dispatching a fresh…
techwolf-ai/ai-first-toolkit
Personal diagnosis of where your Claude Code + Cowork spend goes.
ncatbot/NcatBot
整体/局部防腐检查:Docs 内部链接断裂、README 索引不同步、guide↔reference 内容不一致、examples 导入过时、Code↔Docs API 对齐。逐文件检查,最大化并发 subagent。Use when: docs 防腐、docs 链接、docs 断链、断链检查、docs 审计、docs audit、code docs 对齐、reference 过时、guide…
Wirasm/prp
Answers how-and-where questions about a codebase by running parallel explorer agents and writing a research document where every claim cites file and line.
LeoYeAI/openclaw-master-skills
Manages pipelines on a DevOps quality and efficiency platform through its OpenAPI: list workspaces and templates, create, update, run and cancel pipelines, and read run records.
LeoYeAI/openclaw-master-skills
Patches OpenClaw's Feishu extension so an edited document triggers an isolated agent session that reads the doc and replies inline, turning it into a live chat space.
LeoYeAI/openclaw-master-skills
Multi-context memory management system for OpenClaw agents with group-isolated storage, global shared memory, workspace organization, and group-specific skills isolation.
LeoYeAI/openclaw-master-skills
Runs a brand's AI-search visibility work end to end: diagnosing how AI platforms represent it, repositioning it, producing AI-optimized content and monitoring ongoing mentions.
LeoYeAI/openclaw-master-skills
Installs and authenticates the gws CLI, then automates Gmail, Drive, Sheets, Calendar, Docs, Chat and Tasks with ready-made recipes, persona bundles and security audits.
LeoYeAI/openclaw-master-skills
Runs four advisor roles, a fitness coach, nutritionist, data analyst and TCM practitioner, to build a health profile and track workouts, diet and wellness over time.
Works with
Java/Maven single-module deep documentation generator. An agent skill from LeoYeAI/openclaw-master-skills. Module Analyzer Generate Doc is an agent skill from LeoYeAI/openclaw-master-skills. Java/Maven single-module deep documentation generator.
Module Analyzer Generate Doc fits situations like: tasks that involve Technical documentation; tasks that involve LLM cost and token optimization; tasks that involve Subagents.
Run `npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a claude-code`. Or copy the skill folder (skills/module-analyzer-generate-doc in LeoYeAI/openclaw-master-skills) into .claude/skills/module-analyzer-generate-doc in your project. Claude Code loads it when a task matches its description.
Run `npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a codex`. Or copy the skill folder (skills/module-analyzer-generate-doc in LeoYeAI/openclaw-master-skills) into .agents/skills/module-analyzer-generate-doc in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add LeoYeAI/openclaw-master-skills --skill module-analyzer-generate-doc -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/module-analyzer-generate-doc, .gemini/skills/module-analyzer-generate-doc, .github/skills/module-analyzer-generate-doc and .opencode/skills/module-analyzer-generate-doc in your project.
SKILL.md names no scripts, command-line tools or credentials: Module Analyzer Generate Doc is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Module Analyzer Generate Doc is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.4k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.9k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Module Analyzer Generate Doc: Code Context Slicing (trailofbits/skills, 7.4k stars), Fable Foreman (olsenbrands/fable-foreman, 142 stars), Document Feature (iopsystems/rezolus, 275 stars) and Token Doctor (techwolf-ai/ai-first-toolkit, 132 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
LeoYeAI (a GitHub user) maintains it in LeoYeAI/openclaw-master-skills, which has 2,158 GitHub stars. The repository holds 1,215 skills in this directory. The repository was last updated on July 20, 2026.
Source: LeoYeAI/openclaw-master-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.