skills/deep-research/SKILL.md
深度调研的多Agent编排工作流:把一个调研目标拆成可并行子目标,用 Claude Code 非交互模式(`claude -p`)运行子进程;联网与采集优先使用已安装的 skills,其次使用 MCP 工具;用脚本聚合子结果并分章精修,最终交付"成品报告文件路径 + 关键结论/建议摘要"。用于:系统性网页/资料调研、竞品/行业分析、批量链接/数据集分片检索、长文写作与证据整合,或用户提及"深度调研/Deep Research/Wide Research/多 Agent 并行调研/多进程调研"等场景。
npx skillsauth add feiskyer/claude-code-settings deep-researchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
把"深度调研"当作一个可复用、可并行的生产流程来执行:主控负责澄清目标、拆解子目标、调度子进程、聚合与精修;子进程负责采集/抽取/局部分析并输出结构化 Markdown 素材;最终交付物必须是独立成品文件而不是聊天贴文。
关键约束(必须遵守)
--allowedTools 控制可用工具;仅在必要时启用网络等权限。firecrawl,其次 exa;确实无法满足时再考虑 WebFetch/WebSearch。claude -p 子进程;<3 个子目标时可由主进程直接执行,但仍需记录完整目录结构和原始数据。claude -p 子进程,并为其分配合适权限(通过 --allowedTools 参数)。.research/<name>/aggregated_raw.md),在成品中仅吸收关键洞察/证据。根据子目标数量选择执行路径:
| 规模 | 子目标数 | 执行方式 | 目录要求 |
|------|----------|----------|----------|
| 微型 | 1-2 | 主进程直接执行 | 仍需 raw/、logs/、final_report.md |
| 小型 | 3-5 | 启动子进程,串行或少量并行 | 完整目录结构 |
| 中型 | 6-15 | 并行子进程(默认 8 并发) | 完整目录结构 + 调度脚本 |
| 大型 | >15 | GNU Parallel + 分批调度 | 完整目录结构 + 多阶段调度 |
注意:即使是微型任务,也必须:
raw/ 目录logs/dispatcher.log预执行规划与摸底(必做;主控亲自完成)
firecrawl,其次 exa;若都不可用,记录原因并选择替代方案(必要时再降级到 WebFetch/WebSearch)。初始化与总体规划
name(建议:<YYYYMMDD>-<短题>-<随机后缀>,全小写、短横线分隔、无空格)。.research/<name>/,并把所有产物都保存到该目录下(子目录如 prompts/、logs/、child_outputs/、raw/、cache/、tmp/)。子目标识别
生成调度脚本
.research/<name>/run_children.sh),要求:
claude -p 调用,推荐要点:
claude -p "prompt" --allowedTools "Read,Write,Edit,Bash,WebFetch,WebSearch,mcp__firecrawl__*"(以 claude --help 为准)。firecrawl,其次 exa;确实没办法才用 WebFetch/WebSearch;不使用 plan 工具与"人工交互等待"。.research/<name>/child_outputs/<id>.md)。timeout 600 claude -p "$(cat "$prompt_file")" \
--allowedTools "Read,Write,Edit,Bash,Glob,Grep,WebFetch,WebSearch,mcp__firecrawl__firecrawl_scrape,mcp__firecrawl__firecrawl_search" \
--output-format json \
> "$output_file" 2>&1
--allowedTools 中追加对应工具名。timeout 300),较大任务可放宽到最多 15 分钟(timeout 900),通过外部 timeout 命令兜底。首次命中 5 分钟超时时,结合任务实际判断是否拆分/改参数再重试;15 分钟仍未完成则视为 prompt 或流程需要排查。xargs/GNU Parallel,但必须先用小规模验证参数展开。默认并行 8 个,可按硬件或配额调整。stdbuf -oL -eL claude -p … 2>&1 | tee .research/<name>/logs/<id>.log 等方式保证实时刷新,便于 tail -f 观察进度。设计子进程 Prompt
firecrawl → exa)→ WebFetch/WebSearch。printf/逐行写入注入变量,避免 Bash 3.2 在多字节字符场景下 cat <<EOF 截断变量的已知问题。.research/<name>/child_prompt_template.md)以便审计与复用。cat .research/<name>/prompts/<id>.md),确认变量替换正确、指令完整后再派发任务。并行执行与监控
tail -f .research/<name>/logs/<id>.log 追踪实时输出。程序化聚合(生成基础稿)
.research/<name>/aggregate.py)读取 .research/<name>/child_outputs/ 下所有 Markdown,按预设顺序聚合为初版主文档(例如 .research/<name>/final_report.md)。解读聚合结果并设计结构
.research/<name>/final_report.md 与关键子输出。.research/<name>/polish_outline.md),明确目标受众、章节顺序与每章核心论点。分章精修与出稿
.research/<name>/polished_report.md),按大纲逐章撰写;每写完一章立刻自查事实、引用与语言要求,必要时回溯子稿核实。落地交付
.research/<name>/);通过提供文件路径与必要摘要向用户回报,禁止在聊天中贴出完整成稿。.research/<name>/,避免覆盖旧文件。.research/<name>/raw/ 等缓存目录,后续处理优先读取本地缓存以减少重复请求。.research/<name>/tmp/、.research/<name>/raw/、.research/<name>/cache/ 等子目录,必要时在流程结束后按需清理。firecrawl,其次 exa;缺少 MCP 时再退回 WebFetch/WebSearch。# 基本非交互调用
claude -p "Your prompt here"
# 指定允许的工具(无需人工确认)
claude -p "Your prompt" --allowedTools "Read,Write,Edit,Bash"
# JSON 格式输出(便于脚本解析)
claude -p "Your prompt" --output-format json
# 流式 JSON 输出
claude -p "Your prompt" --output-format stream-json
# 继续上一次对话
claude -p "Follow up question" --continue
# 继续指定会话
claude -p "Follow up" --resume <session_id>
#!/bin/bash
# 子进程调度示例
prompt_file="$1"
output_file="$2"
log_file="$3"
# 读取 prompt 并执行
timeout 600 claude -p "$(cat "$prompt_file")" \
--allowedTools "Read,Write,Edit,Bash,Glob,Grep,WebFetch,WebSearch,mcp__firecrawl__firecrawl_scrape,mcp__firecrawl__firecrawl_search,mcp__firecrawl__firecrawl_map" \
--output-format json \
2>&1 | tee "$log_file" > "$output_file"
exit_code=${PIPESTATUS[0]}
echo "Exit code: $exit_code" >> "$log_file"
#!/bin/bash
# 并行执行多个子任务
max_parallel=8
research_dir=".research/$name"
# 使用 GNU Parallel(推荐)
cat "$research_dir/tasks.txt" | parallel -j $max_parallel \
"timeout 600 claude -p \"\$(cat $research_dir/prompts/{}.md)\" \
--allowedTools 'Read,Write,Edit,Bash,WebFetch,WebSearch' \
--output-format json > $research_dir/child_outputs/{}.json 2>&1"
# 或使用后台任务
for task_id in $(cat "$research_dir/task_ids.txt"); do
(
timeout 600 claude -p "$(cat "$research_dir/prompts/$task_id.md")" \
--allowedTools "Read,Write,Edit,Bash,WebFetch,WebSearch" \
--output-format json \
> "$research_dir/child_outputs/$task_id.json" 2>&1
) &
# 控制并行数量
while [ $(jobs -r | wc -l) -ge $max_parallel ]; do
sleep 1
done
done
wait # 等待所有后台任务完成
realpath/test -d 等确认关键路径(如 venv、资源目录)存在;必要时用 dirname "$0" 推导仓库根路径并通过参数传入,避免硬编码。.research/<name>/dispatcher.log;子任务单独写 .research/<name>/logs/<id>.log,失败时直接 tail 对应日志定位 MCP/调用细节。failed_ids 列表并在收尾阶段统一提示后续建议。.research/<name>/child_outputs/<id>.md 是否已合法存在;存在则跳过,减少配额消耗与重复访问。[来源](https://example.com)),避免把链接集中到段尾,便于即时查证。先思考再动手:追求有深度、有独立思考、超出预期的洞见(但不要在回答里提到"惊喜");揣摩用户为什么会问这个问题、背后的假设是什么、有没有更本质的问法;同时明确你的答案应满足的成功标准,再围绕标准组织内容。
保持协作:你的目标不是机械执行指令、也不是在信息不足时强行给出确定答案;而是与用户共同推进,逐步逼近更好的问题与更可靠的结论。
写作风格要求:
执行本技能时,在每一步输出清晰的决策与进度日志。
在提交最终报告前,必须核对以下清单:
.research/<name>/ 目录已创建logs/dispatcher.log 包含完整执行记录(非事后补写)raw/ 目录包含原始搜索/抓取结果prompts/、child_outputs/ 目录存在且有内容claude -p 子进程如有以下情况,应在报告中明确说明:
development
Generate or edit images using OpenAI GPT Image API (gpt-image-2, gpt-image-1, etc). Triggers: "gpt image", "openai image", "generate image with openai", "draw image", "create image", "image generation", "AI drawing", "图片生成", "AI绘图", "生成图片", "画图". Use this skill whenever the user wants to generate or edit images and mentions OpenAI, GPT, or when OPENAI_API_KEY is available.
development
Create, refine, and benchmark agent skills. Use when building a new skill, updating an existing one, running evals, checking trigger quality, or improving a skill description.
development
Generate or edit images using Google Gemini API via nanobanana. Triggers: "nanobanana", "generate image", "create image", "edit image", "AI drawing", "图片生成", "AI绘图", "图片编辑", "生成图片".
development
Execute long-running, multi-session tasks autonomously using Claude Code headless mode or in-session hook-based loops. Supports structured task decomposition (for complex projects) and lightweight Ralph-style iteration (for TDD, bug fixing, refactoring). Use this skill whenever the user says "autonomous", "long-running task", "multi-session", "run this in the background", "keep working on this", "batch process", "iterate until done", "ralph loop", or wants any task that requires sustained, unattended execution.