Skip to content
bug-diagnosis-expert logo

Bug 辅助诊断专家

bug-diagnosis-expert

Bug 辅助诊断专家 - 两种模式:批量分析历史 Bug 生成模式库,实时诊断定位嫌疑文件。 模式A: 读取 data/bug_analysis/ 的 JSON 数据,分析并生成 bug-patterns.md 到模块 Skill。 模式B: 接收 Bug ID 或描述,路由到对应模块专家,聚合诊断建议。 触发关键词: Bug诊断, 缺陷分析, 问题排查, bug diagnosis, 更新Bug模式库, Bug模式, 嫌疑文件, regression, 崩溃分析, 黑图排查, bug-patterns

SKILL.md

Full skill instructions

Bug 辅助诊断专家

模式A 分析历史 Bug 生成知识库 | 模式B 实时诊断定位问题


🔴 执行声明(强制)

开始执行时

🔍 **正在执行: Bug Diagnosis Expert** (`#bug-diagnosis-expert`)

⭕ 工作模式: [模式A: 生成Bug模式库 / 模式B: 实时诊断]
⭕ 当前步骤: [步骤描述]

执行完成时

✅ **执行完成**: Bug Diagnosis Expert

参考来源:
- 数据: data/​bug_analysis/​{module}.json
- 模块专家: #{skill-name}

产出物: [生成/更新的文件列表 或 诊断结论]

模式判断

用户意图模式关键词
分析历史 Bug、生成/更新模式库A更新模式库、分析历史Bug、生成bug-patterns
排查具体 Bug、定位问题BBug#12345、崩溃、黑图、排查、诊断

不确定时 → 使用 ask_questions 询问用户。


模式 A:生成/更新 Bug 模式库

前置检测

检查 data/​bug_analysis/ 目录是否有数据:

list_dir("data/​bug_analysis/")

如果目录不存在或为空 → 引导用户:

⚠️ 暂无 Bug 分析数据。

🚀 **推荐使用交互式引导**(会帮你完成全部配置和数据采集):
  在 Copilot Chat 中输入 `@GuidedDev` → 选择"🐛 Bug 修复/分析" → "🔍 分析历史 Bug"

📝 **或者手动运行**(需要先配置 data/​user_preferences.json):
  python scripts/​analyze_bug_prs.py --app {{APP_NAME}} --days 180

如果数据已就绪 → 直接进入分析流程(Step A1-A6)。

📖 完整分析流程见 references/​diagnosis-workflow.md

执行流程(数据已就绪)

A1. 选择目标模块

使用 ask_questions 让用户从可用 JSON 中选择模块。

A2. 读取与分析

按以下顺序读取:

  1. data/​bug_analysis/​{module}.json — Bug 元数据 + PR + 文件统计
  2. data/​bug_analysis/​diffs/​{bugId}_PR{prId}.diff — 高频文件和跨模块 Bug 的 diff
  3. templates/​skills/​{module}-expert/​SKILL.md — 模块知识(常见陷阱/上下游)
  4. references/​analysis-prompt-template.md — 分析维度框架

分析维度:

  1. 高频嫌疑文件 — 哪些文件 Bug 最多(从 diff 看根因)
  2. Bug 类型聚类 — 黑图/崩溃/状态不同步/配置遗漏
  3. 跨模块联动陷阱 — 改 A 漏了对 B 的影响
  4. 修复模式归纳 — 常见修复手法
  5. 隐含规则提取 — 非代码约束

数据量策略:

Bug 数量策略
≤ 20全量 Bug + 全部 Diff
20-50全量元数据 + 高频/跨模块 Diff
> 50统计摘要 + Top-10 典型 Diff
A3. 生成 bug-patterns.md

写入 templates/​skills/​{module}-expert/​references/​bug-patterns.md:

# {模块名} Bug 模式库
> 🤖 由 #bug-diagnosis-expert 分析生成
> 📅 最后更新: {date} | 数据源: {N}个Bug / {M}个PR / {K}个diff

## 高频嫌疑文件
| 排名 | 文件路径 | Bug 次数 | 典型场景 |

## Bug 类型分布
| 类型 | 数量 | 占比 | 典型 Bug ID |

## 跨模块联动 Bug
| 触发模块 | 受影响操作 | Bug 数 | 典型模式 |

## 修复模式摘要
| 模式 | 频率 | 说明 |

## 隐含规则(从 Diff 提取)
- ✅ {规则} — 来源: Bug #{id}
A4. 追加 AI 建议到 experience-notes.md

仅追加到 🤖 AI 建议 区域。禁止修改其他章节。


模式 B:实时 Bug 诊断

B1. 信息收集

接收 Bug ID 或问题描述。有 Bug ID 时:

python scripts/​get_bug_prs.py {id} --show-changes

B2. 模块识别

从 Bug 标题/复现步骤/描述中提取关键词,匹配模块:

关键词模块对应 Skill
<!-- 🤖 AI 填充指南 将以下提示词发送给你的 AI 助手: --- 我的应用有以下业务模块: [列出模块名称和对应的 Skill 名] 请帮我生成 Bug 关键词 → 模块映射表,让 AI 能通过 Bug 描述中的关键词自动定位到对应模块。 格式:| Bug关键词 | 对应模块 | 域专家 Skill 名 | --- -->

| [你的关键词] | [模块名] | #app-[模块]-expert |

无法判断时 → 使用 ask_questions 让用户选择模块。

B3. 加载模块知识

依次读取:

  1. 对应模块 Skill 的 references/​bug-patterns.md — 历史 Bug 模式
  2. 对应模块 Skill 的 references/​experience-notes.md — 团队经验
  3. 对应模块 Skill 的主 SKILL.md — 代码入口和常见陷阱
  4. docs/功能依赖关系.md — 下游影响矩阵(如已配置)

B4. 输出诊断建议

## 🔍 Bug 诊断报告

### 嫌疑文件(优先级排序)
| 优先级 | 文件 | 原因 |
|:------:|------|------|
| 🔴 P0 | `xxx.cs` | 历史 Bug 高频文件 + 团队经验标记 |
| 🟡 P1 | `xxx.cpp` | 从 Bug 描述匹配到的代码入口 |

### 历史相似 Bug
| Bug ID | 标题 | 解决方案 |
|--------|------|---------|

### 团队经验参考
- {来自 experience-notes.md 的相关条目}

### 影响范围
| 下游模块 | 可能影响 | 需要验证 |
|---------|---------|---------|

### 建议排查步骤
1. {具体操作}
2. {具体操作}

⚠️ 文件保护规则

文件策略
references/​bug-patterns.md🤖 可覆盖 — AI 重新生成时整体替换
references/​experience-notes.md🔒 仅追加 — 只能向 🤖 AI 建议 区域追加内容
data/​bug_analysis/​*.json🤖 可覆盖 — 脚本重新采集时替换
data/​bug_analysis/​diffs/​*.diff🤖 可覆盖 — 脚本重新采集时替换

参考文件

  • 执行流程: read_file("references/​diagnosis-workflow.md")
  • 分析模板: read_file("references/​analysis-prompt-template.md")
  • 功能依赖: read_file("docs/功能依赖关系.md")(如已配置)
  • 功能清单: read_file("docs/功能模块清单.md")(如已配置)

More skills from gabrielmoreira

workflow-router logo
gabrielmoreira/agent-skills-mirror

workflow-router

研发工作流入口 - 帮助用户快速进入正确的工作流阶段。 触发关键词: 工作流, 流程, 从哪开始, 帮我, 我该怎么做, 下一步, workflow, 不知道用什么, 新手引导, 怎么用

19 0
View
平台架构知识 logo
gabrielmoreira/agent-skills-mirror

平台架构知识

Periodically refreshed mirror of agents, skills, prompts and instruction files from public repositories.

19 0
View
unity-profiler logo
gabrielmoreira/agent-skills-mirror

unity-profiler

Read-only Unity runtime performance snapshots — FPS, frame time, batches/draw calls, triangles/vertices, memory (total/mono/per-asset), object counts, AssetBundle stats. Exact signatures via GET /skills/schema.

19 0
View
ads-audit logo
gabrielmoreira/agent-skills-mirror

ads-audit

Full multi-platform paid advertising audit with parallel subagent delegation. Analyzes Google Ads, Meta Ads, LinkedIn Ads, TikTok Ads, Microsoft Ads, and Apple Ads accounts via 6 parallel audit agents. Amazon Ads, cross-platform attribution, and server-side tracking are covered by their standalon...

19 0
View
unity-skills logo
gabrielmoreira/agent-skills-mirror

unity-skills

Unity Editor automation via REST API — create scripts, analyze scenes, manage assets, control editor, orchestrate workflows, run batch jobs, and route by Unity version. Triggers: Unity, Unity Skills, in Unity, automate Unity, Unity editor automation, create Unity script, scene summary, analyze Un...

19 0
View
purple-cow-audit logo
gabrielmoreira/agent-skills-mirror

purple-cow-audit

Score product remarkability 1-10 to decide if it's worth promoting. Seth Godin's Purple Cow test. Triggers on: "is this product worth promoting", "should I promote", "product audit", "purple cow", "remarkable product", "is it remarkable", "rate this product", "product quality check", "worth my re...

19 0
View
unity-cleaner logo
gabrielmoreira/agent-skills-mirror

unity-cleaner

Project cleanup and audit — find unused assets, content-hash duplicates, missing references, empty folders, large assets, dependency trees; two-step confirm-token delete. Exact signatures via GET /skills/schema.

19 0
View
skill-manager-guide logo
gabrielmoreira/agent-skills-mirror

skill-manager-guide

**GUIDE SKILL** — Guide to the Skill Manager for Copilot extension. USE FOR: adding/removing skill repos, syncing skills, pushing feedback, configuring sync intervals, troubleshooting sync issues, understanding skill format. DO NOT USE FOR: creating new skills (use skill-creator), creating agents...

19 0
View
configure-nightwatch logo
gabrielmoreira/agent-skills-mirror

configure-nightwatch

Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies. Use when setting up Nightwatch, managing data volume, protecting sensitive data (PII), or optimizing event collection for production workloads.

19 0
View
research-and-write logo
gabrielmoreira/agent-skills-mirror

research-and-write

End-to-end workflow: research a topic and then write a LinkedIn post about it. Use this skill whenever the user wants the full pipeline — from a topic idea to a finished LinkedIn post. Triggers on: 'research and write a post about', 'create a LinkedIn post about [topic]', 'I want to post about', ...

19 0
View
AI Tutor Persona logo
gabrielmoreira/agent-skills-mirror

AI Tutor Persona

Periodically refreshed mirror of agents, skills, prompts and instruction files from public repositories.

19 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View