GitHub Copilot Guide
Vibe Coding
GitHub Copilot Guide

Use GitHub Copilot for autocomplete, chat, code generation, and practical AI coding workflows.

GitHub Copilot Guide代码建议

Copilot Suggestions

Copilot 最稳定、也最常用的能力,仍然是 suggestions 本身。它真正擅长的不是“替你决定架构”,而是当你已经起了头之后,顺着当前上下文把第一稿补快很多。

#它通常在什么时候最有用

  • 你已经写了函数名或函数头
  • 你先写了几行注释
  • 你在补一段重复性很高的实现
  • 你在写测试骨架或数据映射代码

Copilot 不是凭空理解你的产品需求,它更像是在“你已经给出足够方向”之后帮你接着写。

#常见 suggestion 类型

#Inline completion

适合接当前语句、对象结构、链式调用和局部实现。

#Multi-line completion

当上下文足够清楚时,它会直接补一整段代码。写 CRUD、测试 skeleton、mapping function 时尤其明显。

#Alternative suggestions

如果第一条不对,不要急着否定整次补全。很多时候只是第一个候选不合适。

#怎么让 suggestions 更靠谱

#先给结构

ts
async function fetchUserProfile(userId: string) { // 1. call API // 2. handle error // 3. return normalized object }

#先给注释

ts
// load user settings from local storage // return default settings if missing export function loadUserSettings() { // Copilot continues here }

#类型和命名尽量清楚

如果参数、类型和变量名都很模糊,Copilot 猜错是正常结果,不是异常。

#一个更稳的使用原则

把 suggestions 当“first-draft accelerator”,不是“final implementation generator”。

它特别适合:

  • boilerplate
  • test skeleton
  • 结构明确的工具函数
  • 数据映射和类型补全

但如果是权限逻辑、关键分支、安全判断,这些仍然更适合人工把关。

Vibe Coding

AI coding workflows, tools, and practical habits

Build a stronger AI-assisted development workflow from scratch.

Open Vibe Coding →

Related Roadmaps