众所周知,github copilot 除了便宜没有优点,基本已经没人用了
有个ai cr 的功能好像暂时没见别的 ai ide 有过,这里分享下个人自用的提示词
使用方法参考:Custom instructions for GitHub Copilot in VS Code
其实就是配置文件直接添加即可
[
{
"text": "Code clarity and readability: Naming conventions, appropriate comments, consistent formatting."
},
{
"text": "Functional correctness: Does the code work as intended? Are edge cases handled?"
},
{
"text": "Performance efficiency: Are there any performance bottlenecks? Is resource usage reasonable?"
},
{
"text": "Maintainability: Is the code structure clear? Is it easy to modify and extend?"
},
{
"text": "Testability: Is the code easy to test? Are unit tests sufficiently comprehensive?"
},
{
"text": "Security: Are there any security vulnerabilities? Is sensitive data handled properly?"
},
{
"text": "Consistency: Does it follow the project's established coding standards, style guidelines, and architectural patterns?"
},
{
"text": "Simplicity (KISS): Avoid unnecessary complexity—is there a simpler implementation?"
},
{
"text": "Avoid repetition (DRY): Are functions, classes, or modules effectively used to encapsulate reusable logic?"
},
{
"text": "Constructive feedback: Review comments should be objective, respectful, and focused on the code rather than the author."
},
{
"text": "Scope of review: Focus on the current changes and avoid unrelated large-scale refactoring suggestions."
}
]
中文翻译:
[
{
"text": "代码清晰易懂:命名规范,注释恰当,格式统一。"
},
{
"text": "功能正确性:代码是否按预期工作?是否处理了边界情况?"
},
{
"text": "性能效率:是否存在性能瓶颈?资源使用是否合理?"
},
{
"text": "可维护性:代码结构是否清晰?是否易于修改和扩展?"
},
{
"text": "可测试性:代码是否易于测试?单元测试是否覆盖充分?"
},
{
"text": "安全性:是否存在安全漏洞?敏感数据处理是否得当?"
},
{
"text": "一致性:是否遵循项目既定的编码规范、风格指南和架构模式?"
},
{
"text": "简洁性 (KISS):避免不必要的复杂性,是否有更简单的实现方式?"
},
{
"text": "避免重复 (DRY):是否有效利用函数、类或模块封装了可复用逻辑?"
},
{
"text": "建设性反馈:评审意见应客观、尊重,聚焦代码本身而非作者。"
},
{
"text": "关注范围:评审应聚焦于本次变更的内容,避免不相关的大范围重构建议。"
}
]
也不建议全部启用,可以按需选择一部分。
不过说实话,暂时感觉心里安慰居多,主要目前太久没上班了,没太多生产环境的大变更。
这也是一个好处吧,这个功能的话确实如果功能没明显问题也不会提示
也是坏处,目前如果没实际代码修改上的建议,则不会提。其实很多架构上的虽然不改,但是也能了解到一些东西
佬们有什么更好的也可以分享下。
顺便分享下加 commit message 的吧,不过这个就比较常规了
"github.copilot.chat.commitMessageGeneration.instructions": [
{
"text": "first line use proper emoji + type(like `feat: `), and Succinctly summarise what the main changes are."
},
{
"text": "second line to describe the changes in detail."
}
],