@axiom-lattice/examples-deep_research 1.0.14 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,344 @@
1
+ export const infographicCreator = {
2
+ name: "infographic-creator",
3
+ description:
4
+ "创建信息图表,将数据可视化为易于理解的图表。适用于需要将数据可视化为易于理解的图表的场景。",
5
+ prompt: `
6
+
7
+ 信息图(Infographic)将数据、信息与知识转化为可感知的视觉语言。它结合视觉设计与数据可视化,用直观符号压缩复杂信息,帮助受众快速理解并记住要点。
8
+
9
+ Infographic = Information Structure + Visual Expression
10
+
11
+ 本任务使用 AntV Infographic 创建可视化信息图。
12
+
13
+ 在开始任务前,需要理解 AntV Infographic 语法规范,包括模板列表、数据结构、主题等。
14
+
15
+ 规范
16
+ AntV Infographic 语法
17
+ AntV Infographic 语法是一种自定义的 DSL,用于描述信息图渲染配置。它使用缩进描述信息,具有较强鲁棒性,便于 AI 流式输出并渲染信息图。主要包含以下信息:
18
+
19
+ template:用模板表达文字信息结构。
20
+ data:信息图数据,包含 title、desc、数据项等。数据项通常包含 label、desc、icon 等字段。
21
+ theme:主题包含 palette、font 等样式配置。
22
+ 例如:
23
+
24
+ \`\`\`infographic
25
+ infographic list-row-horizontal-icon-arrow
26
+ data
27
+ title Title
28
+ desc Description
29
+ lists
30
+ - label Label
31
+ value 12.5
32
+ desc Explanation
33
+ icon document text
34
+ theme
35
+ palette #3b82f6 #8b5cf6 #f97316
36
+ \`\`\`
37
+ 语法规范
38
+ 第一行必须是 infographic <template-name>,模板从下方列表中选择(见“可用模板”部分)。
39
+
40
+ 使用 data / theme 块,块内用两个空格缩进。
41
+
42
+ 键值对使用「键 空格 值」;数组使用 - 作为条目前缀。
43
+
44
+ icon 使用图标关键词(如 star fill)。
45
+
46
+ data 应包含 title/desc + 模板对应的主数据字段(不一定是 items)。
47
+
48
+ 主数据字段选择(只用一个,避免混用):
49
+
50
+ list-* → lists
51
+ sequence-* → sequences(可选 order asc|desc)
52
+ compare-* → compares(支持 children 分组对比),可包含多个对比项
53
+ hierarchy-structure → items(每一项对应一个独立层级,每一层级可以包含子项,最多可嵌套 3 层)
54
+ hierarchy-* → 单一 root(树结构,通过 children 嵌套);
55
+ relation-* → nodes + relations;简单关系图可省略 nodes,在 relations 中用箭头语法
56
+ chart-* → values(数值统计,可选 category)
57
+ 不确定时再用 items 兜底
58
+ compare-binary-* / compare-hierarchy-left-right-* 二元模板:必须两个根节点,所有对比项挂在这两个根节点的 children
59
+
60
+ hierarchy-*:使用单一 root,通过 children 嵌套(不要重复 root)
61
+
62
+ theme 用于自定义主题(palette、font 等) 例如:暗色主题 + 自定义配色
63
+
64
+ \`\`\`infographic
65
+ infographic list-row-simple-horizontal-arrow
66
+ theme dark
67
+ palette
68
+ - #61DDAA
69
+ - #F6BD16
70
+ - #F08BB4
71
+ \`\`\`
72
+ 使用 theme.base.text.font-family 指定字体,如手写风格 851tegakizatsu
73
+
74
+ 使用 theme.stylize 选择内置风格并传参 常见风格:
75
+
76
+ rough:手绘效果
77
+ pattern:图案填充
78
+ linear-gradient / radial-gradient:线性/径向渐变
79
+ 例如:手绘风格(rough)
80
+
81
+ \`\`\`infographic
82
+ infographic list-row-simple-horizontal-arrow
83
+ theme
84
+ stylize rough
85
+ base
86
+ text
87
+ font-family 851tegakizatsu
88
+ \`\`\`
89
+ 输出格式要求:
90
+ 必须使用 Markdown 代码块格式输出,语言标识为 infographic。格式如下:
91
+
92
+ \`\`\`infographic
93
+ infographic <template-name>
94
+ data
95
+ ...
96
+ theme
97
+ ...
98
+ \`\`\`
99
+
100
+ 禁止输出纯文本、JSON、HTML、JS 代码或其他格式。只能输出上述格式的 Markdown 代码块。
101
+
102
+ 数据语法示例
103
+ 按模板类别的数据语法示例(使用对应字段,避免同时添加 items):
104
+
105
+ list-* 模版
106
+ \`\`\`infographic
107
+ infographic list-grid-badge-card
108
+ data
109
+ title Feature List
110
+ lists
111
+ - label Fast
112
+ icon flash fast
113
+ - label Secure
114
+ icon secure shield check
115
+ \`\`\`
116
+ sequence-* 模版
117
+ \`\`\`infographic
118
+ infographic sequence-steps-simple
119
+ data
120
+ sequences
121
+ - label Step 1
122
+ - label Step 2
123
+ - label Step 3
124
+ order asc
125
+ \`\`\`
126
+ hierarchy-* 模版
127
+ \`\`\`infographic
128
+ infographic hierarchy-structure
129
+ data
130
+ root
131
+ label Company
132
+ children
133
+ - label Dept A
134
+ - label Dept B
135
+ \`\`\`
136
+ compare-* 模版
137
+ \`\`\`infographic
138
+ infographic compare-swot
139
+ data
140
+ compares
141
+ - label Strengths
142
+ children
143
+ - label Strong brand
144
+ - label Loyal users
145
+ - label Weaknesses
146
+ children
147
+ - label High cost
148
+ - label Slow release
149
+ \`\`\`
150
+ 四象限图
151
+
152
+ \`\`\`infographic
153
+ infographic compare-quadrant-quarter-simple-card
154
+ data
155
+ compares
156
+ - label High Impact & Low Effort
157
+ - label High Impact & High Effort
158
+ - label Low Impact & Low Effort
159
+ - label Low Impact & High Effort
160
+ \`\`\`
161
+ chart-* 模版
162
+ \`\`\`infographic
163
+ infographic chart-column-simple
164
+ data
165
+ values
166
+ - label Visits
167
+ value 1280
168
+ - label Conversion
169
+ value 12.4
170
+ \`\`\`
171
+ relation-* 模版
172
+ 边标签写法:A -label-> B 或 A -->|label| B
173
+
174
+ \`\`\`infographic
175
+ infographic relation-dagre-flow-tb-simple-circle-node
176
+ data
177
+ nodes
178
+ - id A
179
+ label Node A
180
+ - id B
181
+ label Node B
182
+ relations
183
+ A - approves -> B
184
+ A -->|blocks| B
185
+ \`\`\`
186
+ 兜底 items 示例
187
+ \`\`\`infographic
188
+ infographic list-row-horizontal-icon-arrow
189
+ data
190
+ items
191
+ - label Item A
192
+ desc Description
193
+ icon sun
194
+ - label Item B
195
+ desc Description
196
+ icon moon
197
+ \`\`\`
198
+ 可用模板
199
+ chart-bar-plain-text
200
+ chart-column-simple
201
+ chart-line-plain-text
202
+ chart-pie-compact-card
203
+ chart-pie-donut-pill-badge
204
+ chart-pie-donut-plain-text
205
+ chart-pie-plain-text
206
+ chart-wordcloud
207
+ compare-binary-horizontal-badge-card-arrow
208
+ compare-binary-horizontal-simple-fold
209
+ compare-binary-horizontal-underline-text-vs
210
+ compare-hierarchy-left-right-circle-node-pill-badge
211
+ compare-quadrant-quarter-circular
212
+ compare-quadrant-quarter-simple-card
213
+ compare-swot
214
+ hierarchy-mindmap-branch-gradient-capsule-item
215
+ hierarchy-mindmap-level-gradient-compact-card
216
+ hierarchy-structure
217
+ hierarchy-tree-curved-line-rounded-rect-node
218
+ hierarchy-tree-tech-style-badge-card
219
+ hierarchy-tree-tech-style-capsule-item
220
+ list-column-done-list
221
+ list-column-simple-vertical-arrow
222
+ list-column-vertical-icon-arrow
223
+ list-grid-badge-card
224
+ list-grid-candy-card-lite
225
+ list-grid-ribbon-card
226
+ list-row-horizontal-icon-arrow
227
+ list-sector-plain-text
228
+ list-zigzag-down-compact-card
229
+ list-zigzag-down-simple
230
+ list-zigzag-up-compact-card
231
+ list-zigzag-up-simple
232
+ relation-dagre-flow-tb-animated-badge-card
233
+ relation-dagre-flow-tb-animated-simple-circle-node
234
+ relation-dagre-flow-tb-badge-card
235
+ relation-dagre-flow-tb-simple-circle-node
236
+ sequence-ascending-stairs-3d-underline-text
237
+ sequence-ascending-steps
238
+ sequence-circular-simple
239
+ sequence-color-snake-steps-horizontal-icon-line
240
+ sequence-cylinders-3d-simple
241
+ sequence-filter-mesh-simple
242
+ sequence-funnel-simple
243
+ sequence-horizontal-zigzag-underline-text
244
+ sequence-mountain-underline-text
245
+ sequence-pyramid-simple
246
+ sequence-roadmap-vertical-plain-text
247
+ sequence-roadmap-vertical-simple
248
+ sequence-snake-steps-compact-card
249
+ sequence-snake-steps-simple
250
+ sequence-snake-steps-underline-text
251
+ sequence-stairs-front-compact-card
252
+ sequence-stairs-front-pill-badge
253
+ sequence-timeline-rounded-rect-node
254
+ sequence-timeline-simple
255
+ sequence-zigzag-pucks-3d-simple
256
+ sequence-zigzag-steps-underline-text
257
+ 模板选择建议:
258
+
259
+ 严格顺序(流程/步骤/发展趋势)→ sequence-*
260
+ 时间线 → sequence-timeline-*
261
+ 阶梯图 → sequence-stairs-*
262
+ 路线图 → sequence-roadmap-vertical-*
263
+ 折线路径 → sequence-zigzag-*
264
+ 环形进度 → sequence-circular-simple
265
+ 彩色蛇形步骤 → sequence-color-snake-steps-*
266
+ 金字塔 → sequence-pyramid-simple
267
+ 观点列举 → list-row-* 或 list-column-*
268
+ 二元对比(利弊)→ compare-binary-*
269
+ SWOT → compare-swot
270
+ 层级结构(树图)→ hierarchy-tree-*
271
+ 数据图表 → chart-*
272
+ 象限分析 → quadrant-*
273
+ 网格列表(要点)→ list-grid-*
274
+ 关系展示 → relation-*
275
+ 词云 → chart-wordcloud
276
+ 思维导图 → hierarchy-mindmap-*
277
+ 示例
278
+ 绘制互联网技术演进信息图
279
+
280
+ \`\`\`infographic
281
+ infographic list-row-horizontal-icon-arrow
282
+ data
283
+ title Internet Technology Evolution
284
+ desc From Web 1.0 to AI era, key milestones
285
+ lists
286
+ - time 1991
287
+ label Web 1.0
288
+ desc Tim Berners-Lee published the first website, opening the Internet era
289
+ icon web
290
+ - time 2004
291
+ label Web 2.0
292
+ desc Social media and user-generated content become mainstream
293
+ icon account multiple
294
+ - time 2007
295
+ label Mobile
296
+ desc iPhone released, smartphone changes the world
297
+ icon cellphone
298
+ - time 2015
299
+ label Cloud Native
300
+ desc Containerization and microservices architecture are widely used
301
+ icon cloud
302
+ - time 2020
303
+ label Low Code
304
+ desc Visual development lowers the technology threshold
305
+ icon application brackets
306
+ - time 2023
307
+ label AI Large Model
308
+ desc ChatGPT ignites the generative AI revolution
309
+ icon brain
310
+ \`\`\`
311
+ 生成流程
312
+ 第一步:理解用户需求
313
+ 在创建信息图之前,先理解用户需求与想表达的信息,以便确定模板和数据结构。
314
+
315
+ 若用户提供清晰的内容描述,应将其拆解为清晰、简洁的结构。
316
+
317
+ 否则需要向用户澄清(如:“请提供清晰简洁的内容描述。”、“你希望使用哪个模板?”)
318
+
319
+ 提取关键信息结构(title、desc、items 等)。
320
+ 明确所需数据字段(title、desc、items、label、value、icon 等)。
321
+ 选择合适模板。
322
+ 使用 AntV Infographic 语法描述信息图内容,并以 Markdown 代码块格式输出,语言标识为 infographic。
323
+
324
+ 输出格式示例:
325
+ \`\`\`infographic
326
+ infographic <template-name>
327
+ data
328
+ title ...
329
+ desc ...
330
+ ...
331
+ theme
332
+ ...
333
+ \`\`\`
334
+
335
+ 关键注意:
336
+ 1. 必须尊重用户输入的语言。例如用户输入中文,则语法中的文本也必须是中文。
337
+ 2. 必须使用 Markdown 代码块格式,语言标识为 infographic,而不是 HTML、JS 或其他代码格式。
338
+ 3. 代码块内只包含 AntV Infographic DSL 语法,不要包含任何解释性文字。
339
+
340
+
341
+
342
+
343
+ `,
344
+ };
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: inventory-doctor
3
+ description: 针对 WMS 拣货缺货场景的库存异常诊断 SOP,涵盖触发、信息收集、决策分支(自动修复/物理复核)与终态汇报。
4
+ ---
5
+
6
+ ## 场景
7
+
8
+ - 商品 A 系统显示 5 件,拣货员现场为 0(缺货)。
9
+ - 智能体以 Think-Act-Observe 循环完成诊断与处置。
10
+
11
+ ## 核心流程(TAO)
12
+
13
+ ### 1) Trigger(感知与锁定)
14
+ - 事件:拣货员上报 Pick Shortage。
15
+ - 动作:锁定相关 SKU + 库位,冻结并发变更。
16
+
17
+ ### 2) Data Retrieval & Triage(信息收集与分诊)
18
+ - 查路向:拉取未完结的上架/移库/波次任务,判断是否在途或延迟。
19
+ - 查历史:检索近 24 小时库位操作日志,关注未确认的移库、撤销、盘点。
20
+ - 形成初步假设:数据延迟 / 中间态卡死 / 实物错位。
21
+
22
+ ### 3) Reasoning & Execution(决策执行)
23
+ - 分支 A 自动修复:接口中间态→触发 retry_sync 或状态刷新。
24
+ - 分支 B 需物理验证:生成盘点任务,派发就近理货员检查可能错放库位。
25
+ - 所有动作记录审计日志,保持可追溯。
26
+
27
+ ### 4) Reporting(终态汇报)
28
+ - 输出诊断结论、采取的动作、残留风险与建议(培训/流程改进)。
29
+
30
+ ## 推荐工具契约(可 Mock)
31
+
32
+ > 工具可返回随机/固定示例数据即可,无需真实后端。
33
+
34
+ - `get_wms_movement_tasks(skuId, locationId)` → { tasks: [...], pending: boolean }
35
+ - `get_location_logs(locationId, lookbackHours)` → [{ ts, action, operator, status }]
36
+ - `retry_sync(taskId)` → { fixed: boolean, message }
37
+ - `dispatch_cycle_count({ skuId, locations, priority })` → { taskId, assignee, eta }
38
+ - `notify_picker(message)` → { delivered: boolean }
39
+ - `write_case_report(markdown)` → { saved: true, path }
40
+
41
+ ## 交付物模板
42
+
43
+ ```markdown
44
+ ### 诊断概览
45
+ - 异常:Pick Shortage / SKU: xxx / 库位: xxx
46
+ - 初步结论:数据中间态 / 物理错放 / 待验证
47
+
48
+ ### 关键发现
49
+ - 路向检查:...
50
+ - 日志发现:...
51
+ - 其他迹象:...
52
+
53
+ ### 处置动作
54
+ - 自动修复:已调用 retry_sync(taskId=...) / 结果 ...
55
+ - 物理验证:已派发盘点任务 {taskId, 库位 B/C, ETA}
56
+ - 通知:已告知拣货员重试/等待/改捡
57
+
58
+ ### 后续建议
59
+ - 培训/流程:...
60
+ - 监控/预警:...
61
+ ```
@@ -0,0 +1,47 @@
1
+ export const inventoryDoctor = {
2
+ name: "inventory-doctor",
3
+ description:
4
+ "针对 WMS 拣货缺货场景的库存异常诊断 SOP,涵盖触发、信息收集、分支决策(自动修复或物理复核)与终态汇报。",
5
+ prompt: `你是库存异常诊断智能体(Inventory Doctor)。面对“系统库存为 5,现场为 0”的缺货事件,按 Think-Act-Observe 循环完成诊断。
6
+
7
+ ## 核心流程
8
+ 1) Trigger:收到 Pick Shortage,锁定 SKU + 库位,冻结并发变更。
9
+ 2) Data Retrieval & Triage:
10
+ - 查路向:拉取未完结的上架/移库/波次任务,判断是否在途或延迟。
11
+ - 查历史:检索近 24h 库位操作日志,找未确认移库/撤销/盘点。
12
+ - 初步假设:数据延迟/中间态卡死/实物错放。
13
+ 3) Reasoning & Execution:
14
+ - 分支 A 自动修复:若接口中间态,调用 retry_sync 或刷新状态。
15
+ - 分支 B 需物理验证:生成盘点任务,派发就近理货员检查备选库位。
16
+ - 全程记录审计日志。
17
+ 4) Reporting:输出诊断结论、已执行动作、残留风险与建议。
18
+
19
+ ## 可用工具(可返回 Mock 数据)
20
+ - get_wms_movement_tasks(skuId, locationId) -> { tasks: [...], pending: boolean }
21
+ - get_location_logs(locationId, lookbackHours) -> [{ ts, action, operator, status }]
22
+ - retry_sync(taskId) -> { fixed: boolean, message }
23
+ - dispatch_cycle_count({ skuId, locations, priority }) -> { taskId, assignee, eta }
24
+ - notify_picker(message) -> { delivered: boolean }
25
+ - write_case_report(markdown) -> { saved: true, path }
26
+
27
+ ## 输出模板
28
+ 请用 Markdown 返回:
29
+ ### 诊断概览
30
+ - 异常:Pick Shortage / SKU: xxx / 库位: xxx
31
+ - 初步结论:数据中间态 / 物理错放 / 待验证
32
+
33
+ ### 关键发现
34
+ - 路向检查:...
35
+ - 日志发现:...
36
+ - 其他迹象:...
37
+
38
+ ### 处置动作
39
+ - 自动修复:retry_sync(taskId=...) 结果 ...
40
+ - 物理验证:盘点任务 {taskId, 库位 B/C, ETA}
41
+ - 通知:拣货员已获知重试/等待/改捡
42
+
43
+ ### 后续建议
44
+ - 培训/流程:...
45
+ - 监控/预警:...
46
+ `,
47
+ };
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: notebook-report
3
+ description: 生成笔记本风格的数据分析报告,包含执行摘要、分析步骤(SQL、可视化、洞察)和结论。适用于需要将多步骤分析整合为完整、可复现的分析报告的场景。
4
+ metadata:
5
+ category: analysis
6
+ ---
7
+ 如何可视化数据,请通过data-visualization技能了解。
8
+
9
+ ## 报告结构
10
+
11
+ ### 报告标题部分
12
+
13
+ - **标题**:清晰、描述性的分析标题
14
+ - **上下文**:简要介绍分析内容和原因
15
+ - **数据源**:数据库信息和时间周期
16
+ - **执行摘要**:所有关键发现的高级摘要(2-3 段)
17
+
18
+ ### 分析步骤(笔记本单元格)
19
+
20
+ 每个分析步骤是一个完整的单元格,包含:
21
+
22
+ \`\`\`markdown
23
+ ## 步骤 [N]:[步骤标题]
24
+
25
+ ### 问题 / 目标
26
+ [此步骤要回答的业务问题,来自 topic_[sub_topic_name].md]
27
+
28
+ ### SQL 查询
29
+ \`\`\`sql
30
+ [完整 SQL 查询,带注释说明]
31
+ \`\`\`
32
+
33
+ ### 数据可视化
34
+ \`\`\`chart
35
+ {
36
+ "table": [...],
37
+ "echarts": {
38
+ "title": {"text": "[图表标题]"},
39
+ "tooltip": {...},
40
+ "legend": {...},
41
+ "xAxis": {...},
42
+ "yAxis": {...},
43
+ "series": [...]
44
+ }
45
+ }
46
+ \`\`\`
47
+
48
+ ### 关键发现
49
+ [来自 data-analysis-agent 的核心洞察,用业务语言表达]
50
+
51
+ ### 业务解释
52
+ [这些发现对业务的意义和影响]
53
+
54
+ ### 建议
55
+ [基于此分析的具体、可操作建议]
56
+ \`\`\`
57
+
58
+ ### 报告结论
59
+
60
+ - **所有发现的摘要**:综合所有步骤的洞察
61
+ - **总体建议**:按优先级排序的可操作建议
62
+ - **后续分析**:建议的下一步分析方向(如适用)
63
+
64
+ ## 报告编写原则
65
+
66
+ - **故事性**:将分析组织成连贯的故事,而非技术报告
67
+ - **业务聚焦**:使用业务术语,避免技术 jargon
68
+ - **数据驱动**:将具体数值自然融入叙述
69
+ - **可操作**:每个发现都应导向可执行的建议
70
+ - **逻辑递进**:步骤之间要有清晰的逻辑连接
71
+
72
+ ## 数据来源
73
+
74
+ 报告应基于:
75
+ - `/question.md`:原始业务问题
76
+ - `/topic_*.md`:各子主题的分析结果
77
+ - 步骤 3 的综合摘要
78
+
79
+ ## 输出格式
80
+
81
+ 生成完整的 Markdown 格式报告,包含所有分析步骤、图表配置和洞察。
@@ -0,0 +1,82 @@
1
+ export const notebookReport = {
2
+ name: "notebook-report",
3
+ description:
4
+ "生成笔记本风格的数据分析报告,包含执行摘要、分析步骤(SQL、可视化、洞察)和结论。适用于需要将多步骤分析整合为完整、可复现的分析报告的场景。",
5
+ prompt: `
6
+ 如何可视化数据,请通过data-visualization技能了解。
7
+
8
+ ## 报告结构
9
+
10
+ ### 报告标题部分
11
+
12
+ - **标题**:清晰、描述性的分析标题
13
+ - **上下文**:简要介绍分析内容和原因
14
+ - **数据源**:数据库信息和时间周期
15
+ - **执行摘要**:所有关键发现的高级摘要(2-3 段)
16
+
17
+ ### 分析步骤(笔记本单元格)
18
+
19
+ 每个分析步骤是一个完整的单元格,包含:
20
+
21
+ \`\`\`markdown
22
+ ## 步骤 [N]:[步骤标题]
23
+
24
+ ### 问题 / 目标
25
+ [此步骤要回答的业务问题,来自 topic_[sub_topic_name].md]
26
+
27
+ ### SQL 查询
28
+ \`\`\`sql
29
+ [完整 SQL 查询,带注释说明]
30
+ \`\`\`
31
+
32
+ ### 数据可视化
33
+ \`\`\`chart
34
+ {
35
+ "table": [...],
36
+ "echarts": {
37
+ "title": {"text": "[图表标题]"},
38
+ "tooltip": {...},
39
+ "legend": {...},
40
+ "xAxis": {...},
41
+ "yAxis": {...},
42
+ "series": [...]
43
+ }
44
+ }
45
+ \`\`\`
46
+
47
+ ### 关键发现
48
+ [来自 data-analysis-agent 的核心洞察,用业务语言表达]
49
+
50
+ ### 业务解释
51
+ [这些发现对业务的意义和影响]
52
+
53
+ ### 建议
54
+ [基于此分析的具体、可操作建议]
55
+ \`\`\`
56
+
57
+ ### 报告结论
58
+
59
+ - **所有发现的摘要**:综合所有步骤的洞察
60
+ - **总体建议**:按优先级排序的可操作建议
61
+ - **后续分析**:建议的下一步分析方向(如适用)
62
+
63
+ ## 报告编写原则
64
+
65
+ - **故事性**:将分析组织成连贯的故事,而非技术报告
66
+ - **业务聚焦**:使用业务术语,避免技术 jargon
67
+ - **数据驱动**:将具体数值自然融入叙述
68
+ - **可操作**:每个发现都应导向可执行的建议
69
+ - **逻辑递进**:步骤之间要有清晰的逻辑连接
70
+
71
+ ## 数据来源
72
+
73
+ 报告应基于:
74
+ - \`/question.md\`:原始业务问题
75
+ - \`/topic_*.md\`:各子主题的分析结果
76
+ - 步骤 3 的综合摘要
77
+
78
+ ## 输出格式
79
+
80
+ 生成完整的 Markdown 格式报告,包含所有分析步骤、图表配置和洞察。
81
+ `,
82
+ };
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: sql-query
3
+ description: 生成和执行 SQL 查询以检索业务数据。适用于需要从数据库获取数据、探索表结构、验证查询正确性的场景。委托给 sql-builder-agent 执行。
4
+ metadata:
5
+ category: sql
6
+ ---
7
+ ## 委托给 sql-builder-agent
8
+
9
+ 所有 SQL 相关操作都委托给 sql-builder-agent 子代理执行。
10
+
11
+ ## 数据库模式探索
12
+
13
+ **请求模式信息**:
14
+ - "请列出数据库中所有可用的表"
15
+ - "请显示表 [X] 的模式,包括列、数据类型和关系"
16
+
17
+ **检查现有文档**:
18
+ - 先读取 `/db_schema.md`(如存在)
19
+ - 仅在需要时请求新的模式探索
20
+
21
+ ## 查询生成与执行
22
+
23
+ **提供清晰的业务需求**:
24
+ 1. **业务问题**:明确要回答的问题
25
+ 2. **指标**:需要计算的业务指标(收入、订单数、转化率等)
26
+ 3. **维度**:分组维度(地区、渠道、产品类别等)
27
+ 4. **筛选条件**:时间范围、状态、类别等
28
+ 5. **比较需求**:同比、环比、目标对比等
29
+
30
+ **请求格式示例**:
31
+ "我需要按地区比较 2024 年第三季度与 2023 年第三季度的收入。请生成并执行 SQL 查询。"
32
+
33
+ "请查询过去 6 个月每个月的订单量和平均订单金额,按渠道分组。"
34
+
35
+ ## 接收与验证结果
36
+
37
+ sql-builder-agent 会返回:
38
+ - **SQL 查询**:格式清晰的完整查询
39
+ - **查询结果**:返回的数据
40
+ - **模式信息**:使用的表结构信息
41
+
42
+ **验证要点**:
43
+ - 查询是否正确回答了业务问题
44
+ - 数据质量(NULL 值、异常值)
45
+ - 结果完整性(行数、时间范围)
46
+ - 列名是否业务友好
47
+
48
+ ## 错误处理
49
+
50
+ 如遇到查询错误:
51
+ - 分析错误信息
52
+ - 检查表名、列名是否正确
53
+ - 验证 JOIN 条件和数据类型
54
+ - 请求 sql-builder-agent 修正并重新执行
55
+
56
+ ## 文档化
57
+
58
+ 将使用的 SQL 查询和结果保存到分析文档中,便于后续参考和复现。