Automatically analyze and locate issues in TAPD Bug tickets, supporting multiple analysis strategies.
Usage
/tapd-bug <bug_url> [--env <environment>] [--region <region>]
Parameters
bug_url: Required, TAPD Bug ticket link (e.g.:https://www.tapd.cn/xxxxx/bugtrace/bugs/view/xxxxxx)--env: Optional, environment name: dev/test/prod (defaults to automatic determination based on URL)--region: Optional, region: shanghai/hangzhou (default shanghai)
Instructions
When the user invokes this skill, execute the following steps:
Step 1: Parse the TAPD Bug link
Extract workspace_id and bug_id from the Bug link:
URL 格式: https://www.tapd.cn/{workspace_id}/bugtrace/bugs/view/{bug_id}
示例: https://www.tapd.cn/12345678/bugtrace/bugs/view/1012345678001234567
Step 2: Get Bug details
Use the TAPD MCP tool to get Bug ticket details:
调用 mcp__mcp-server-tapd__get_bug 工具:
- workspace_id: 从 URL 解析得到
- options: {"id": "<bug_id>", "fields": "id,title,description,status,severity,priority,reporter,current_owner,created,modified"}
Step 3: Analyze the Bug description and choose an analysis strategy
Carefully read the Bug description (description field), and choose an analysis strategy by priority:
Strategy A: Contains traceId
Check whether the Bug description contains a traceId (usually a 16-character hexadecimal string):
- Regex match:
[a-f0-9]{16} - Common format:
traceId: xxx,trace_id=xxx,X-B3-TraceId: xxx
If a traceId is found, directly call sls-trace-analyzer:
~/.claude/skills/sls-trace-analyzer/.venv/bin/python \
~/.claude/skills/sls-trace-analyzer/sls-query.py \
--trace-id "<traceId>" \
--region "<region>" \
--env "<env>"
Note: By default, the script queries both the regular storage and long-term storage logstores at the same time to obtain complete logs.
Strategy B: Contains request URL (with timestamp)
Check whether the Bug description contains an API request URL:
- URL pattern:
http(s)://xxx.abczs.cn/api/... - Timestamp parameter: the 13-digit number at the end of the URL (millisecond timestamp)
Example URL:
http://32.ftest.abczs.cn/api/v2/patientorders/his/ffffffff0000000035246dd0adec0000/hospital?1768198926187
If a URL with a timestamp is found, directly call sls-trace-analyzer (URL mode):
~/.claude/skills/sls-trace-analyzer/.venv/bin/python \
~/.claude/skills/sls-trace-analyzer/sls-query.py \
--url "<完整URL含时间戳>"
sls-trace-analyzer will automatically:
- Parse the domain, path, and timestamp in the URL
- Determine the environment (dev/test/prod) and region based on the domain
- Query gateway logs to obtain the traceId
- Use the traceId to query the complete call chain logs
- Output the log analysis results
Strategy C: Neither traceId nor timestamp
Perform code analysis based on the Bug description:
- Extract key information (error messages, functional modules, operation steps)
- Use codebase-retrieval to search for related code
- Analyze the business logic and infer the cause of the issue
Step 4: Log analysis and issue localization
After obtaining the traceId, call sls-trace-analyzer for in-depth analysis:
-
Identify errors and exceptions
- Find ERROR and WARN level logs
- Identify Java exception stack traces (Exception, Caused by)
- Extract error messages and error codes
-
Trace the request chain
- Sort log entries by time
- Identify the request entry point (Controller) and exit point
- Mark RPC/Feign calls and responses
-
Locate code issues
- Extract class names and line numbers from exception stack traces
- Prioritize concern with
cn.abcyuncode under the package - Use codebase-retrieval to find the corresponding code
Step 5: Output the analysis report
Generate a structured analysis report:
## TAPD Bug 分析报告
### Bug 基本信息
- **Bug ID**: xxx
- **标题**: xxx
- **状态**: xxx
- **严重程度**: xxx
- **报告人**: xxx
- **处理人**: xxx
### 分析策略
- 使用策略: A/B/C
- TraceId: xxx(如有)
- 请求时间: xxx(如有)
### 错误摘要
- **错误类型**: xxx
- **错误消息**: xxx
- **发生位置**: `文件路径:行号`
### 调用链路
1. [入口] POST /api/xxx
2. [Service] XxxService.method()
3. [RPC] 调用 xxx 服务
4. [Error] 发生异常
### 问题定位
- **根因分析**: xxx
- **相关代码**:
```java
// 问题代码片段
Fix suggestions
- xxx
- xxx
## Examples
### 示例 1: Bug 描述中包含 traceId
```bash
/tapd-bug https://www.tapd.cn/12345678/bugtrace/bugs/view/1012345678001234567
Bug description content:
用户反馈下单失败,错误信息:系统繁忙,请稍后重试
traceId: 8989a698c36e5189
Execution flow:
- Parse the URL to obtain workspace_id=12345678, bug_id=1012345678001234567
- Call TAPD MCP to get Bug details
- Extract traceId from the description: 8989a698c36e5189
- Call sls-trace-analyzer to analyze logs
- Output analysis report
Example 2: The Bug description contains a request URL
/tapd-bug https://www.tapd.cn/12345678/bugtrace/bugs/view/1012345678001234568 --env test
Bug description content:
测试环境下单接口报错 500
请求地址:http://32.ftest.abczs.cn/api/v2/patientorders/his/ffffffff0000000035246dd0adec0000/hospital?1768198926187
Execution flow:
- Parse the URL to get workspace_id and bug_id
- Call TAPD MCP to get Bug details
- Extract the request URL (including timestamp) from the description
- Call sls-trace-analyzer (URL mode) for log analysis
- Output analysis report
Example 3: A Bug described in plain text
/tapd-bug https://www.tapd.cn/12345678/bugtrace/bugs/view/1012345678001234569
Bug description content:
患者在门诊缴费时,选择医保支付后点击确认,页面提示"医保结算失败",
但实际上 HIS 系统显示已经结算成功。
复现步骤:
1. 登录患者端 APP
2. 选择待缴费订单
3. 选择医保支付
4. 点击确认支付
预期结果:支付成功,跳转到支付成功页面
实际结果:提示"医保结算失败"
Execution flow:
- Parse the URL to get workspace_id and bug_id
- Call TAPD MCP to get Bug details
- No traceId or timestamp found
- Analyze the description to extract keywords: outpatient payment, medical insurance payment, medical insurance settlement
- Use codebase-retrieval to search related code
- Analyze the business logic and infer possible causes
- Output analysis report
Example 4: Real case - prescription does not display specification
Input:
/tapd-bug https://www.tapd.cn/43780818/bugtrace/bugs/view/1143780818001109821
Bug description content:
问题概述:处方不展示规格
门店id: ffffffff000000003526121e726a0004
收费单id:ffffffff000000003526dc97b673c003
补充说明:后台没返回药品档案的规格
Execution flow:
- Parse URL: workspace_id=43780818, bug_id=1143780818001109821
- Call TAPD MCP to get Bug details
- Analyze the description: no traceId, no timestamp URL → use strategy C
- Extract keywords: prescription, specification, drug profile
- Use codebase-retrieval to search related code
- Located at PrescriptionService.java:678-680
Problem localization result:
// PrescriptionService.java:678-680
if (goodsItem.getType() == 2) {
prescriptionFormItem.setSpecification(...);
}
Root cause analysis: The specification field of Western medicine prescriptions is only set when type==2 (materials); the specification is not set for ordinary Western medicines (type=1).
Fix suggestion: Set the specification for all drug types, preferring the GoodsItem.displaySpec field.