GitHub Copilot: AI-Powered Coding Assistant
Back to Tutorials
Developer ToolsBeginner5 Steps

GitHub Copilot: AI-Powered Coding Assistant

GithubOctober 25, 202593 min watch1:33:23 video

Master GitHub Copilot for faster, smarter coding. Learn code completions, Copilot Chat, slash commands, and best practices for prompt engineering in your IDE.

GitHub Copilot: Your AI Pair Programmer

GitHub Copilot is an AI coding assistant powered by OpenAI models, integrated directly into your IDE. It provides code completions, generates functions, writes tests, explains code, and helps debug — all in real time.

Plans

Plan Features
Copilot Free 2,000 completions/month, 50 chat messages/month
Copilot Pro Unlimited completions & chat, access to multiple models
Copilot Business Organization management, policy controls
Copilot Enterprise Fine-tuning on your codebase, knowledge bases

Setup

VS Code

  1. Install the GitHub Copilot extension
  2. Sign in with your GitHub account
  3. Copilot is now active — start typing!

Visual Studio

  1. Go to ExtensionsManage Extensions
  2. Search for "GitHub Copilot"
  3. Install and sign in

JetBrains IDEs

  1. Go to SettingsPlugins
  2. Search for "GitHub Copilot"
  3. Install and authenticate

Code Completions

Copilot provides inline suggestions as you type. Press Tab to accept.

Example: Type a function signature

def calculate_mortgage_payment(principal, annual_rate, years):
    # Copilot suggests the full implementation:
    monthly_rate = annual_rate / 12 / 100
    num_payments = years * 12
    payment = principal * (monthly_rate * (1 + monthly_rate)**num_payments) /               ((1 + monthly_rate)**num_payments - 1)
    return round(payment, 2)

Tips for Better Completions

  • Write clear function namescalculate_shipping_cost gets better suggestions than calc
  • Add comments first — Describe what you want, then let Copilot implement
  • Provide context — Open related files so Copilot understands your codebase
  • Be specific in comments// Sort users by last login date, most recent first

Copilot Chat

Open the chat panel (Ctrl+Shift+I) for interactive AI assistance.

Common Questions

  • "Explain this function" — Select code and ask for explanation
  • "Find the bug in this code" — Paste problematic code
  • "How do I connect to Azure SQL from .NET?"
  • "Write unit tests for this class"

Chat Context

Copilot Chat understands:

  • Current file — The file you have open
  • Selected code — Any highlighted code
  • Workspace — Files in your project (with @workspace)
  • Terminal — Recent terminal output (with @terminal)

Slash Commands

Quick actions in the chat:

Command Description
/explain Explain selected code
/fix Suggest a fix for problems
/tests Generate unit tests
/doc Generate documentation
/new Scaffold a new project
/newNotebook Create a Jupyter notebook

Example

/tests for the calculate_mortgage_payment function using pytest

Copilot generates:

import pytest
from calculator import calculate_mortgage_payment

def test_standard_mortgage():
    result = calculate_mortgage_payment(300000, 6.5, 30)
    assert result == 1896.20

def test_zero_principal():
    result = calculate_mortgage_payment(0, 6.5, 30)
    assert result == 0.0

def test_short_term():
    result = calculate_mortgage_payment(100000, 5.0, 15)
    assert result == 790.79

Chat Participants (@mentions)

Participant Purpose
@workspace Ask about your entire project
@terminal Ask about terminal output/errors
@vscode Ask about VS Code settings and features

Examples

  • @workspace How is authentication handled in this project?
  • @terminal What caused this build error?
  • @vscode How do I change the font size?

Copilot in the CLI

# Install
gh extension install github/gh-copilot

# Ask questions
gh copilot explain "git rebase -i HEAD~3"

# Suggest commands
gh copilot suggest "find all large files in this repo"

Best Practices

  1. Review all suggestions — Copilot is an assistant, not an authority. Always review generated code.
  2. Provide context — Comments, types, and good naming improve suggestions dramatically.
  3. Iterate — If the first suggestion isn't right, modify your prompt or add more context.
  4. Use chat for complex tasks — Inline completions are great for simple code; use chat for architecture questions, debugging, and learning.
  5. Keep sensitive data out — Don't paste API keys or secrets into chat.

Resources

Video: Watch the official GitHub Copilot intro on the GitHub YouTube channel.

GitHub CopilotAI CodingVisual Studio CodeProductivityMicrosoft

Share this tutorial

Chapters (5)

  1. 1

    GitHub Copilot Overview

    What Copilot offers and supported IDEs

    00:00
  2. 2

    Code Completions

    Inline suggestions, tab completion, and multi-line generation

    05:00
  3. 3

    Copilot Chat

    Ask questions, explain code, and generate tests

    12:00
  4. 4

    Slash Commands & Agents

    Use /fix, /tests, /doc and workspace agents

    20:00
  5. 5

    Prompt Engineering Tips

    Write better prompts for better code suggestions

    26:00

About the Author

KH

Github

Microsoft MVP | AI Engineer

Software & AI Engineer specializing in Microsoft Azure, .NET, and cutting-edge AI technologies.

Need help with your project?

Let's discuss how I can help bring your ideas to life.

Get In Touch