学术科研
外部调研多源研究流程:研究库文档/最佳实践/通用主题并产出带…
当需要研究外部库文档、最佳实践或通用主题,并输出带来源的总结、研究文档或实现交接时使用。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
外部调研多源研究流程:研究库文档/最佳实特定
解决思路
- 调用格式:`/research-external <focus> [options]`。
- 无参数或部分参数时用 AskUserQuestion 引导问题流:Phase 1 选择研究类型,选项包括 How to use a library/package、Best practices for a task、General topic research、Compare options/alternatives;分别映射为 library focus、best-practices focus、general focus、best-practices with comparison framing。
- Phase 2 询问具体主题,使用自由文本输入;好答案示例:How to use Prisma ORM with TypeScript、Best practices for error handling in Python、React vs Vue vs Svelte for dashboards。
- Phase 3 若为 library focus,询问 package registry:npm (JavaScript/TypeScript)、PyPI (Python)、crates.io (Rust)、Go modules;若尚未提供,再询问具体 library 名称。
- Phase 4 询问研究深度:Quick answer 映射为 --depth shallow;Thorough research 映射为 --depth thorough。
- Phase 5 询问输出:Summary in chat、Research document 映射为 --output doc、Handoff for implementation 映射为 --output handoff。
- 执行前输出摘要确认:Focus、Topic、Library、Depth、Output,并询问 Proceed? [Yes / Adjust settings]。
- Focus 模式:library 主工具 nia-docs,用于 API 文档、用法模式、代码示例;best-practices 主工具 perplexity-search,用于推荐方法、模式、比较;general 使用所有 MCP 工具做综合多源研究。
- 选项:--topic "string" 必填;--depth shallow|thorough 默认 shallow;--output handoff|doc 默认 doc;--library "name" 仅 library focus;--registry npm|py_pi|crates|go_modules 仅 library focus,默认 npm。
- Step 1 Parse Arguments:提取 FOCUS=$1、TOPIC="..."、DEPTH="shallow"、OUTPUT="doc"、LIBRARY="..."、REGISTRY="npm"。
- Focus library:用 nia-docs 做语义搜索,命令:`(cd $CLAUDE_OPC_DIR && uv run python -m runtime.harness scripts/mcp/nia_docs.py --package "$LIBRARY" --registry "$REGISTRY" --query "$TOPIC" --limit 10)`。
- Focus library 若 depth=thorough:额外用 nia-docs grep 特定模式,命令:`(cd $CLAUDE_OPC_DIR && uv run python -m runtime.harness scripts/mcp/nia_docs.py --package "$LIBRARY" --grep "$TOPIC")`;若已知官方文档 URL,用 firecrawl_scrape.py 抓取,命令:`(cd $CLAUDE_OPC_DIR && uv run python -m runtime.harness scripts/mcp/firecrawl_scrape.py --url "https://docs.example.com/api/$TOPIC" --format markdown)`。
- Focus best-practices:用 perplexity-search 做 AI 综合研究(sonar-pro),命令:`(cd $CLAUDE_OPC_DIR && uv run python scripts/mcp/perplexity_search.py --research "$TOPIC best practices 2024 2025")`。
- Focus best-practices 若比较替代方案,命令:`(cd $CLAUDE_OPC_DIR && uv run python scripts/mcp/perplexity_search.py --reason "$TOPIC vs alternatives - which to choose?")`。
- Focus best-practices 若 depth=thorough:用 --reason 分析复杂决策:`--reason "$TOPIC tradeoffs and considerations 2025"`;用 --deep 做深度综合研究:`--deep "$TOPIC comprehensive guide 2025"`;用 --search 查最新进展:`--search "$TOPIC latest developments" --recency month --max-results 5`。
- Focus general:使用所有可用 MCP 工具。Step 2a 用 nia-docs 搜库文档:`(cd $CLAUDE_OPC_DIR && uv run python -m runtime.harness scripts/mcp/nia_docs.py --search "$TOPIC")`;Step 2b 用 perplexity 做 web 研究:`(cd $CLAUDE_OPC_DIR && uv run python scripts/mcp/perplexity_search.py --research "$TOPIC")`;Step 2c 用 firecrawl 抓取 perplexity 结果中的相关文档页:`(cd $CLAUDE_OPC_DIR && uv run python -m runtime.harness scripts/mcp/firecrawl_scrape.py --url "$FOUND_DOC_URL" --format markdown)`。
- Focus general 若 depth=thorough:对三个工具用扩展查询全部运行;交叉引用各来源发现;跟随初始结果中的链接获取更深上下文。
- Step 3 Synthesize Findings:合并所有来源,整理 Key Concepts(核心概念与术语)、Code Examples(文档中的可运行示例)、Best Practices(推荐方法)、Pitfalls(常见错误)、Alternatives(考虑过的其他选项)、Sources(所有引用的 URL)。
- Step 4 输出 doc(默认):写入 `thoughts/shared/research/YYYY-MM-DD-{topic-slug}.md`;frontmatter 包含 date、type: external-research、topic、focus、sources: [nia, perplexity, firecrawl]、status: complete;正文包含 Summary、Key Findings(Library Documentation、Best Practices (2024-2025)、Code Examples)、Recommendations、Pitfalls to Avoid、Alternatives Considered 表格、Sources。
- Step 4 输出 handoff:写入 `thoughts/shared/handoffs/{session}/research-{topic-slug}.yaml`;frontmatter 包含 type: research-handoff、ts、topic、focus、status: complete;内容包含 goal、sources_used、findings(key_concepts、code_examples、best_practices、pitfalls)、recommendations、sources、for_plan_agent(给出推荐做法、关键库、需避免的 pitfall)。
- Step 5 Return Summary:返回 Research Complete,包含 Topic、Focus、Output 路径、Key findings 3 条、Sources 数量;若为 handoff 输出,提示 Ready for plan-agent to continue。
- 错误处理:MCP 工具失败(API key 缺失、限流等)时,在输出中记录 tool_status(如 nia: success、perplexity: failed (rate limited)、firecrawl: skipped);继续使用其他来源,部分结果仍有价值;按情况设置 status 为 complete(全部成功)、partial(部分失败但有用)、failed(无有用结果);在 findings 中记录 Gaps。
- 与其他技能集成:--output handoff 后可用 plan-agent 创建实现计划;找到代码示例后可用 implement_task 直接实现;架构决策用 create_plan 详细规划;库比较呈现给用户做决策。
- 注意事项:不用于代码库探索,应使用 research-codebase 或 scout;始终引用来源,包含所有发现的 URL;聚焦 2024-2025 当前最佳实践;优雅降级,部分结果优于无结果。
- 示例:library shallow:`/research-external library --topic "dependency injection" --library fastapi --registry py_pi`;best-practices thorough:`/research-external best-practices --topic "error handling in Python async" --depth thorough`;general handoff:`/research-external general --topic "OAuth2 PKCE flow implementation" --depth thorough --output handoff`;quick library lookup:`/research-external library --topic "useEffect cleanup" --library react`。
- 当前年份为 2025;研究最佳实践时以 2024-2025 为参考时间范围。
适用边界 · 注意事项
- 不用于代码库探索;代码库内查找应使用 research-codebase 或 scout。
- 缺少 NIA_API_KEY、PERPLEXITY_API_KEY、FIRECRAWL_API_KEY 或对应 MCP 服务时,无法完整运行该外部研究流程。
- 仅需本地代码理解或快速答案时,不值得启动多源外部研究。