Preamble (run first)
# 检查是否有需求调研报告
if [ ! -f "docs/01-需求调研/需求调研报告.md" ]; then
echo "⚠️ 未找到需求调研报告"
echo ""
echo "建议先执行 /pm-demand 完成需求调研"
fi
Write-time boundaries
When only discussing, do not write files; startup checks do not create directories. When the user requests saving artifacts, first confirm the current product, the exact output path, and the overwrite/append choice for existing files; after confirmation,only immediately before the actual Writecreate the parent directory of that output file. For full installation, see skills/_shared/artifact-policy.md, and installing this skill alone also follows this paragraph.
Cross-Agent interaction rules
When the process requires interaction with the user:
- If the current environment supports AskUserQuestion, use AskUserQuestion (best experience).
- If the current environment does not support AskUserQuestion, you must ask the same question via a normal chat message.
- Ask only one question at a time.
- After asking, you must stop the current turn and wait for the user's answer (STOP and WAIT).
- Do not generate documents or write to docs before the user answers.
- Existing docs files cannot replace the user's answer in this turn.
Execution flow
Step 1: Read prerequisite data (main agent)
If there is a requirements research report:
Use the Read tool to read docs/01-需求调研/需求调研报告.md
Extract:
- Product name
- Industry track
- Target users
- Core pain points
If there is no requirements research report:
Enter quick mode and use AskUserQuestion to collect basic information.
Step 2: Determine search directions (main agent - user interaction)
Use AskUserQuestion to ask:
🎯 Which aspects should I focus on analyzing?
A) Market size and growth trends B) Competitor analysis C) User needs and behavior D) Industry policies and risks E) All analyses (recommended but time-consuming)
After the user selects, record it in the variable MARKET_FOCUS
Step 3: Dispatch subagents to conduct market research (core optimization)
Optimization notes:
- The main agent is only responsible for dispatching tasks and receiving results
- Subagents perform all search and analysis work
- Search details do not occupy the main agent's context
3.1 Build the search task list
Based on the user's selection, build the task list:
If "market size" is selected:
[
{
"task_id": "market_size",
"keywords": ["{行业赛道} 市场规模 2025", "{行业赛道} 增长趋势"],
"domains": ["iresearch.cn", "analysys.cn", "iimedia.cn"]
}
]
If "competitor analysis" is selected:
[
{
"task_id": "competitor_analysis",
"keywords": ["{行业赛道} 竞品分析", "{行业赛道} 主要玩家"],
"domains": ["36kr.com", "huxiu.com", "qimai.cn"]
}
]
If "all" is selected:
[
{
"task_id": "market_size",
"keywords": ["{行业赛道} 市场规模"],
"domains": ["iresearch.cn", "analysys.cn"]
},
{
"task_id": "competitor_analysis",
"keywords": ["{行业赛道} 竞品"],
"domains": ["36kr.com", "huxiu.com"]
},
{
"task_id": "user_behavior",
"keywords": ["{目标用户} 消费行为"],
"domains": ["questmobile.com.cn"]
}
]
3.2 Use the Agent tool to dispatch subagents
Single task:
Use the Agent tool:
Tool: Agent
Parameters:
subagent_type: "general-purpose"
description: "市场调研-{task_id}"
prompt: |
你是一个市场调研专家。请执行以下任务:
**任务 ID**: {task_id}
**产品名称**: {产品名称}
**行业赛道**: {行业赛道}
**搜索关键词**: {keywords}
**目标数据源**: {domains}
**要求**:
1. 搜索工具优先级:首选 AnySearch(Bash 调用 `anysearch_cli.py(先定位:检查 ~/.claude/skills/anysearch/scripts/ ~/.opencode/skills/anysearch/scripts/ ~/.openclaw/skills/anysearch/scripts/ ~/.cursor/skills/anysearch/scripts/ ~/.anysearch/scripts/ 或 which anysearch_cli.py,找到后 python3 <路径>)`search "查询词" --max_results 5 --domain finance --sub_domain finance.cn_stock),失败降级到 Exa MCP(mcp__exa__web_search_exa),最后才用 WebSearch。使用 WebSearch 时标注「⚠️ 降级模式」
2. 搜索每个关键词
3. 优先搜索目标数据源
4. 提取关键数据(市场规模、增长率、主要玩家等)
5. 返回结构化的 JSON 结果
**输出格式**:
```json
{
"task_id": "{task_id}",
"findings": [
{
"title": "数据标题",
"source": "数据来源",
"value": "数据值",
"date": "数据日期"
}
],
"summary": "关键发现总结"
}
```
Multiple tasks (parallel optimization):
Dispatch multiple subagents simultaneously:
# 并行派发 3 个 subagent
Agent 1: 市场规模调研
Agent 2: 竞品分析
Agent 3: 用户行为分析
The main agent waits for all subagents to complete, then collects the results.
Step 4: Integrate results and generate the report (main agent)
The main agent receives the return results from all subagents:
- Read the JSON data returned by the subagents
- Integrate all findings
- Generate a structured market research report
Use the Write tool to generate the report:
# 市场调研报告
## 一、市场规模与增长趋势
(从 subagent 结果中提取)
## 二、竞品分析
(从 subagent 结果中提取)
## 三、用户需求与行为
(从 subagent 结果中提取)
## 四、关键发现与建议
(主 agent 综合分析)
---
**生成时间**: {时间}
**调研范围**: {MARKET_FOCUS}
Step 5: Recommend next steps (main agent)
✅ Market research report has been generated:
docs/01-需求调研/市场调研报告.mdRecommended to execute:
- /pm-priority - Prioritize based on market research
- /pm-position - Determine product positioning based on competitive analysis
- /pm-mvp - Plan the MVP solution
Comparison: Before vs After Optimization
Before Optimization (pm-market v1)
主 agent 执行流程:
1. 询问用户(10 tokens)
2. 执行搜索1(500 tokens 结果)
3. 执行搜索2(500 tokens 结果)
4. 执行搜索3(500 tokens 结果)
5. 整理结果(200 tokens)
6. 生成报告(100 tokens)
总计:1810 tokens
耗时:串行执行,约 3-5 分钟
After Optimization (pm-market-v2)
主 agent 执行流程:
1. 询问用户(10 tokens)
2. 派发 subagent(20 tokens)
└─ Subagent 执行搜索(不占用主 agent 上下文)
3. 接收结果(100 tokens 结构化数据)
4. 整合报告(100 tokens)
总计:230 tokens
耗时:并行执行,约 1-2 分钟
效率提升:87% token 节省,2.5x 速度提升
Key Optimization Points
1. Context Savings
- ✅ Search results do not occupy the main agent's context
- ✅ The main agent only processes structured results
- ✅ Token usage reduced by 70-90%
2. Execution Efficiency
- ✅ Multiple search tasks execute in parallel
- ✅ Total time reduced by 50-70%
- ✅ Significantly improved user experience
3. Maintainability
- ✅ The main agent's logic is clear and focused on decision-making
- ✅ Subagents have a single responsibility and are easy to test
- ✅ Clearer code structure
Notes
When to Use a Subagent
✅ Suitable:
- Web search (results consume a large number of tokens)
- Document generation (can be parallelized)
- Data analysis (compute-intensive)
- Competitive analysis (multiple searches)
❌ Not Suitable:
- User interaction (AskUserQuestion)
- Simple decisions (if-else judgment)
- Quick tasks (< 10 seconds)
Exception Handling
If the subagent fails to execute:
- The main agent detects the error
- Provide a fallback (manual input or simplified search)
- Log the error information for the user to troubleshoot
Version Notes
v2.0.0 - Subagent architecture refactor
- Added Agent tool support
- Parallelized search tasks
- Optimized the main agent's context
- Efficiency improved by 2.5x
v1.0.0 - Initial version
- Basic market research functionality
Output Quality Comparison
✅ Good Example:
- 有数据引用:「根据 Q4 数据,留存率从 35% 降至 28%」
- 有验证来源:「数据来源:Google Analytics, 2025-12-01」
- 有明确建议:「建议将新手引导步骤从 5 步减少至 3 步」
❌ Bad Example:
- 模糊结论:「数据表明留存率有所下降」
- 无来源:「根据经验,这个功能很重要」
- 没有行动建议:「留存是个问题」
Common Misconceptions / Red Flags — STOP
Stop immediately and backtrack if any of the following occur:
| Misconception | Correct Approach |
|---|---|
| Drawing conclusions using "should", "probably", "seems" | Must be based on actual data and verification |
| Claiming completion without running checks | Verify first, then state |
| Skipping key steps due to time pressure | No exceptions; the tighter the time, the stricter you must be |
| The thought "this time it should be fine" | Re-verify every time |
Output Quality Check / Verification Checklist
- Prerequisite dependencies are satisfied (input documents/data have been collected)
- All core steps have been executed
- The output document has been generated to the
docs/directory - Every judgment is supported by data/evidence
- 2-3 follow-up skills have been recommended
⚠️ If any item fails → complete it before marking as done.