关于 quick-fix-suggestion
quick-fix-suggestion 是用于分析 Gitee Issue 并为仓库贡献者整理代码修改建议的技能。它结合 Gitee Issue 信息与本地优先的代码搜索,提供候选文件、修改草案和实施计划。
主要功能
- 01获取 Gitee Issue 详情和评论
- 02优先搜索本地仓库文件
- 03定位可能修改的文件和代码位置
- 04生成实现片段和步骤计划
- 05标注置信度与复杂度
适用场景
- 01调查本地克隆仓库中的缺陷报告
- 02查找与功能请求相关的代码
- 03准备供评审的修改方案
MCP 相关
该技能通过已配置的 Gitee MCP 服务获取 Issue 详情和评论,并在本地搜索之后将其代码搜索工具用作备用方案。
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ oschina/ gitee-agent-skills --skill quick-fix-suggestion安装后在 Claude Code 中输入/quick-fix-suggestion确认已加载。
附带文件references/TOOL_REFERENCE.md
详细介绍
注意:如果你已在本地安装
mcporter,应使用mcporter调用 MCP 工具,而不是直接调用 MCP 工具。mcporterCLI 提供了更便捷的界面和更完善的错误处理。
通过 Gitee MCP 快速提出修复建议
分析 Gitee Issue 并生成智能修复建议,包括:
- 确定需要修改的文件
- 提供代码位置提示(行号、函数名)
- 提供实现代码片段草稿
- 制定分步实施计划
前提条件
- 已配置 Gitee MCP 服务(工具:
get_repo_issue_detail、list_comments(resource_type: issue)、search_files_by_content、get_file_content) - 必须在仓库的本地克隆中执行
- 用户必须提供:仓库所有者、仓库名称、Issue 编号
本地优先搜索策略
为什么优先搜索本地?
此技能优先使用本地文件操作进行代码搜索,而不是调用 Gitee API:
- 速度:本地搜索只需几毫秒,API 调用则需要几秒
- 无速率限制:不受每分钟 100 次请求的限制
- 实时性:搜索结果包含尚未提交的本地更改
- 成本:无需支付 API 使用费用
工具选择优先级
| 优先级 | 工具 | 可用性 |
|---|---|---|
| 第 1 优先 | glob、grep(内置) | 100% |
| 第 2 优先 | ast_grep_search、lsp_find_references | 100% |
| 第 3 优先 | Git 命令(通过 bash) | 约 90% |
| 最后 | Gitee API(search_files_by_content) | 仅用作备用方案 |
步骤
步骤 1:获取 Issue 详情
使用 get_repo_issue_detail 获取完整的 Issue 信息:
- 标题和描述
- 标签(bug/feature/enhancement)
- 现有评论
步骤 2:分析 Issue 内容
识别 Issue 类型:
bug:error、crash、broken、not working、错误、失败feature:add、support、implement、new、新增、添加enhancement:improve、optimize、改进、优化
提取代码实体:
- 函数名(位于反引号中或符合特定模式)
- 类名
- 文件名
- 错误消息 / 堆栈跟踪
步骤 3:搜索代码(本地优先)
按优先级顺序使用内置工具:
// 1. File name search (fastest)
glob(`**/*${keyword}*.{js,ts,py,go}`, { cwd: localRepoPath })
// 2. Content search
grep({
pattern: `function\\s+${funcName}`,
path: localRepoPath,
output_mode: "content"
})
// 3. AST search (semantic)
ast_grep_search({
pattern: "function $NAME($$$) { $$$ }",
lang: "javascript",
paths: [localRepoPath]
})
// 4. Fallback: Remote search (max 3 calls)
if (localResults.length < 3) {
search_files_by_content({ owner, repo, query: keyword, limit: 10 })
}
步骤 4:读取并分析关键文件
读取每个候选文件,以便:
- 找出相关函数 / 类
- 了解代码结构
- 评估 Issue 与该文件的关联
步骤 5:生成修复建议
按以下格式呈现结果:
## Issue #{number}: {title}
**Type**: {bug/feature} | **Confidence**: {score}% | **Complexity**: {low/medium/high}
### Primary Files (Must Modify)
**1. `{file_path}`** [Confidence: XX%]
- **Change**: {modify/add/delete}
- **Location**: Around line {X}
<details>
<summary>Code Draft</summary>
```{language}
// Current:
{existing_code}
// Suggested:
{suggested_code}
可能需要更改的次要文件
{file_path}:{reason}
实施计划
- {step 1} - 文件:`{file}``,约 {time}
- {step 2} - 文件:`{file}``,约 {time}
测试建议
- {test suggestion}
需要向你确认的问题
- {uncertainty_question}
### Step 6: Handle User Response
- **Approve**: Summarize and transition to `implement-issue` skill
- **Adjust**: Re-analyze with new information
- **Search More**: Expand search scope
- **Cancel**: Offer other help
## Notes
- Always indicate confidence level - ask for clarification when uncertain
- Follow existing code patterns when suggesting changes
- Warn immediately if Issue mentions credentials/secrets
- If unable to locate relevant code, ask for more context rather than guessing
## References
- [Tool Reference Guide](references/TOOL_REFERENCE.md) - Detailed search patterns and tool usage
评论
支持 Markdown