From a34ef20fd45a8ea3d688e4e7b20c5a5352ec4233 Mon Sep 17 00:00:00 2001 From: jilinchen Date: Tue, 30 Dec 2025 11:48:10 +0800 Subject: [PATCH] feat: add /research/report command for markdown generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New report command to generate markdown from JSON results - Generates Python script for conversion - Creates report with TOC and anchor links - Skips uncertain fields and uncertain array - Update deep.md with prompt template format 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- README.md | 9 +++++++++ skills/research/deep/SKILL.md | 26 ++++++++++++++++++-------- skills/research/report/SKILL.md | 31 +++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 skills/research/report/SKILL.md diff --git a/README.md b/README.md index f5e49a0..2cfb52a 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ A structured research workflow skill for Claude Code, supporting two-phase resea | `/research/add-items` | Add more items to existing outline | | `/research/add-fields` | Add more fields to existing outline | | `/research/deep` | Deep research each item with parallel agents | +| `/research/report` | Generate markdown report from JSON results | ## Installation @@ -87,6 +88,14 @@ basic_info: ### Research Result (JSON) Each item outputs a structured JSON file with all defined fields. +### Phase 3: Generate Report +``` +/research/report +``` +- Generates Python script to convert JSON to markdown +- Creates report with table of contents and anchor links +- Skips uncertain fields automatically + ## References - RhinoInsight: Improving Deep Research through Control Mechanisms for Model Behavior and Context diff --git a/skills/research/deep/SKILL.md b/skills/research/deep/SKILL.md index 5639c9a..a5fa8f4 100644 --- a/skills/research/deep/SKILL.md +++ b/skills/research/deep/SKILL.md @@ -18,14 +18,25 @@ allowed-tools: Bash, Read, Write, Glob, WebSearch, Task - 跳过已完成的items ### Step 3: 分批执行 -- 按batch_size分批(默认5个agent并行) +- 按batch_size分批(完成一批需要得到用户同意才可进行下一批) - 每个agent负责items_per_agent个项目 -- 启动web-search-agent(后台并行,禁用task output) -- **硬约束**:仅传入item相关信息和输出路径 -- **硬约束**:agent必须自行读取 `{topic}/fields.yaml` 获取字段定义 -- **硬约束**:禁止在prompt中直接嵌入字段定义 -- **硬约束**:不确定的字段值标注[不确定],并在JSON末尾uncertain数组中列出该字段名(即对应字段的实际位置需要说明一次和uncertain字段位置再总结一次) -- 输出结构化JSON到output_dir +- 启动web-search-agent(后台并行,禁用task output),使用以下prompt模板: + +``` +## 任务 +调研 {item_related_info},输出结构化JSON到 {output_path} + +## 字段定义 +读取 {topic}/fields.yaml 获取所有字段定义 + +## 输出要求 +1. 按fields.yaml定义的字段输出JSON +2. 不确定的字段值标注[不确定] +3. JSON末尾添加uncertain数组,列出所有不确定的字段名 + +## 输出路径 +{output_dir}/{item_name}.json +``` ### Step 4: 等待与监控 - 等待当前批次完成 @@ -39,7 +50,6 @@ allowed-tools: Bash, Read, Write, Glob, WebSearch, Task - 输出目录 ## Agent配置 -- 每批并行: 5个agent(可在outline中配置) - 后台执行: 是 - Task Output: 禁用(agent完成时有明确输出文件) - 断点续传: 是 diff --git a/skills/research/report/SKILL.md b/skills/research/report/SKILL.md new file mode 100644 index 0000000..0afb7ad --- /dev/null +++ b/skills/research/report/SKILL.md @@ -0,0 +1,31 @@ +--- +description: 将deep调研结果汇总为markdown报告,覆盖所有字段,跳过不确定值。 +allowed-tools: Read, Write, Glob, Bash +--- + +# Research Report - 汇总报告 + +## 触发方式 +`/research-report` + +## 执行流程 + +### Step 1: 定位结果目录 +在当前工作目录查找 `*/outline.yaml`,读取topic和output_dir配置。 + +### Step 2: 生成Python转换脚本 +在 `{topic}/` 目录下生成 `generate_report.py`,脚本要求: +- 读取output_dir下所有JSON +- 读取fields.yaml获取字段结构 +- 覆盖每个JSON的所有字段值 +- 跳过值包含[不确定]的字段 +- 跳过uncertain字段 +- 生成markdown报告格式:目录(带锚点跳转)+ 详细内容(按字段分类) +- 保存到 `{topic}/report.md` + +### Step 3: 执行脚本 +运行 `python {topic}/generate_report.py` + +## 输出 +- `{topic}/generate_report.py` - 转换脚本 +- `{topic}/report.md` - 汇总报告