Help us learn about your current experience with the documentation. Take the survey.

GitLab Duo Chat 最佳实践

当向 GitLab Duo Chat 提问时,请遵循以下最佳实践,以获得具体的示例和明确的指导。

进行对话

将聊天视为对话,而不是搜索表单。从一个类似搜索的问题开始,然后通过后续的相关问题来缩小范围。通过一来一回的交流来构建上下文。

例如,你可以这样问:

c# start project best practices

然后接着问:

Please show the project structure for the C# project.

优化提示词

为了获得更好的回答,请提前提供更多上下文。 仔细思考你需要帮助的全部范围,并将其包含在一个提示中。

How can I get started creating an empty C# console application in VS Code?
Please show a .gitignore and .gitlab-ci.yml configuration with steps for C#,
and add security scanning for GitLab.

遵循提示词模式

将提示词的结构组织为:问题陈述、请求帮助,然后增加具体细节。 不必一开始就把所有问题都问出来。

I need to fulfill compliance requirements. How can I get started with Codeowners and approval rules?

然后可以接着问:

Please show an example for Codeowners with different teams: backend, frontend, release managers.

使用低上下文沟通

即使选中了代码,也要提供上下文,就好像代码不可见一样。 对于语言、框架和需求等因素,要具体说明。

When implementing a pure virtual function in an inherited C++ class,
should I use virtual function override, or just function override?

重复提问

如果得到意想不到或奇怪的回答,尝试换个方式提问。增加更多上下文。

How can I get started creating an C# application in VS Code?

然后接着问:

How can I get started creating an empty C# console application in VS Code?

保持耐心

避免提出是/否问题。从一般性的问题开始,然后根据需要提供具体细节。

Explain labels in GitLab. Provide an example for efficient usage with issue boards.

必要时重置

如果对话偏离了正确的方向,使用 /reset 命令。重新开始。

优化斜杠命令提示

不要只使用基础的斜杠命令。结合更具体的建议来使用它们。

/refactor into a multi-line written string. Show different approaches for all C++ standards.

或者:

/explain why this code has multiple vulnerabilities

相关主题