Skip to content
>_devvkit
$devvkit learn --librarie github-copilot-guide

GitHub Copilot Guide

[ai][completion][github][vibe-coding]
AI / LLM Tools
Install
# VS Code extension:
# Install "GitHub Copilot" from marketplace

# CLI:
npm install -g @githubnext/github-copilot-cli
# Or: gh extension install github/gh-copilot

# Settings: github.com/settings/copilot

GitHub Copilot is the most widely used AI coding assistant. Its core strength is inline autocomplete — as you type, it suggests the next lines of code. The suggestions are context-aware (reading your open files, imports, and project structure) and improve dramatically with practice.

Copilot Chat (Ctrl+I or the chat panel) lets you ask questions about your codebase, generate code, explain snippets, and fix issues. The `/fix` and `/tests` slash commands handle common tasks. Copilot can also generate PR descriptions from your diff and answer questions about docs repos.

The gh-copilot CLI extends Copilot to the terminal — describe what command you need in plain English and it generates the shell command. This is particularly useful for `docker`, `git`, `kubectl`, and `aws` CLI commands you cannot remember.

Autocomplete

Trigger autocompleteGet suggestions as you type.
# Copilot suggests automatically as you type.
# Accept: Tab
# Accept word: Ctrl+Right
# Reject: Esc
# Next: Alt+]
# Previous: Alt+[

# Tip: Write a clear function name and parameters
# Copilot will infer the implementation from context
async function fetchUserWithPosts(userId: string) {
  // Copilot suggests the implementation here
}

Chat

Chat — inlineEdit code with AI.
# Select code, press Ctrl+I (Cmd+I on Mac)
# Type your instruction:
"Add input validation"
"Handle the error case"
"Make this more performant"

# Or open chat panel:
# Click the Copilot icon in the sidebar
# Or Ctrl+Shift+I (Cmd+Shift+I)
PR descriptionsAuto-generate PR summary.
# In the GitHub PR page:
# Click "Copilot" button in the PR description box
# Select "Generate with Copilot"
# Copilot reads the diff and writes a summary

# Or use gh CLI:
gh pr create --fill
# Copilot fills the title and description

Slash Commands

Slash commandsBuilt-in chat commands.
# In Copilot Chat:
/fix       # Fix issues in selected code
/tests     # Generate unit tests
/explain   # Explain the selected code
/doc       # Add documentation comments
/optimize  # Suggest performance improvements
/clear     # Clear chat history

# Example:
# Select a function, type:
/tests # Copilot generates test cases

CLI

Copilot for CLINatural language shell commands.
# Install:
gh extension install github/gh-copilot

# Use:
gh copilot suggest "find all files larger than 100MB and compress them"
gh copilot explain "git log --oneline --graph --all"

# Explain: shows what a complex command does
# Suggest: generates commands from description

# Evaluate before running — always review!
gh copilot suggest "find the top 10 CPU hogging processes" -t evaluate

Tips

Context engineeringGet better suggestions.
# Tips for better suggestions:

# 1. Open relevant files — Copilot reads open tabs
# 2. Write good imports first
import { z } from 'zod'
import { prisma } from '@/lib/prisma'

# 3. Use descriptive names
async function calculateMonthlyRevenue(userId: string, year: number, month: number): Promise<number>

# 4. Add type annotations — Copilot uses types
async function syncUserToCRM(user: User): Promise<SyncResult>

# 5. Write a comment describing the goal
// Fetches all orders, filters by date range, and returns aggregated metrics