VS Code + GitHub Copilot

Before You Write a
Single Line of Code

How to set up VS Code so your AI assistant actually understands your project, your stack, and your standards.

Visual Studio Code
README.md
customer_lookup.sql
1# Customer Reporting Workspace
2
3Monthly retail-banking reports from the enterprise data warehouse.
4
5## Getting Started
6
7sqlcmd -i queries/customer_lookup.sql
8EXEC usp_refresh_daily
The Environment

VS Code is your coding workspace

It is the application where you write code. Think of it as a capable text editor that understands programming languages, shows your file tree, runs your terminal, and connects to AI tools like GitHub Copilot.

Out of the box, Copilot can see the file you have open. But it knows nothing about your project's purpose, your team's conventions, or what you are building.

The Problem

Copilot is flying blind

Without context, Copilot gives generic answers. It does not know your stack. It guesses at your conventions. It suggests patterns that may be completely wrong for your project.

You end up rewriting its output on every request. That defeats the point.

No folder opened
No open editors
No file is open Open a file from the sidebar

Copilot sees nothing. Every suggestion is a guess.

my-project
copilot-instructions.md
1# Project Instructions
2
3## About This Project
4Monthly customer reporting for retail banking.
5Refreshes from the enterprise data warehouse.
6
7## Stack
8- Database: SQL Server 2022
9- Reporting: Excel + Power Query
10- Scripts: T-SQL, PowerShell, VBA
The Solution

One file changes everything

GitHub Copilot automatically reads .github/copilot-instructions.md whenever you open the folder. No extra configuration needed.

Whatever you write in that file becomes Copilot's permanent context for this project. Every suggestion, every chat answer, every completion starts from this foundation.

Create the file once. Every conversation after that is smarter.

File Contents

Four sections. That is it.

You do not need a long document. Copilot reads the whole file on every request, so short and specific beats long and vague every time.

1 - Project Identity
What this workspace produces and who it serves, in one sentence. Copilot uses this to understand what "good output" means in your context.
## About
Monthly customer reporting for retail
banking. Refreshes from the enterprise
data warehouse. Audience: branch
managers and the AML compliance team.
2 - Tech Stack
List the exact technologies, with versions where it matters. Copilot will stop suggesting Pandas when you are already in SQL Server, or guessing at table names.
## Stack
- Database: SQL Server 2022
- Reporting: Excel + Power Query M
- Scripts: T-SQL, PowerShell 7
- ETL: SSIS packages in azure-pipelines/
3 - Run Commands
Run commands are how you actually trigger work in your environment: a stored procedure call, a saved query path, a macro, a pipeline script. Without these listed, Copilot invents plausible-sounding names that do not exist on your servers, so its answers point to dead ends. List them once and every "how do I run X?" answer becomes something you can actually paste and use.
## Commands
- Daily refresh: EXEC usp_refresh_daily
- Monthly report: macro RunMonthlyReport
- Common query: queries/customer_lookup.sql
- QA pipeline: scripts/qa/run_all.sql
4 - Code Standards
Your team's non-negotiable conventions: naming, formatting, what to avoid. Saves a review round on every suggestion.
## Standards
- Lowercase names with underscores (customer_id, not CustomerID)
- Always alias joined tables (c, a, b)
- No SELECT *, list columns explicitly
- T-SQL date helpers, never inline GETDATE math

Specific vs Vague

Copilot cannot act on vague instructions. It needs concrete facts.

Vague - Copilot ignores this
We work with customer data.
Please write efficient queries.
Use good naming.
Make reports look professional.
Specific - Copilot uses this
DB: SQL Server 2022, enterprise data warehouse
Tables: customers, accounts, branches
Style: lowercase_with_underscores, alias every join
Dates: always use fn_period_start helper
In Practice

Ask anything. Get a real answer.

Once the instructions file is in place, Copilot Chat stops being generic. It knows your stack. It follows your conventions automatically, without you having to repeat them.

You stop explaining your setup at the start of every conversation. The file does that for you, on every request, forever.

workspace - Visual Studio Code
query.sql
1-- Your query will appear here
1-- Top 10 customers by deposits, last month
2SELECT
3 c.customer_name,
4 b.branch_name,
5 SUM(a.balance) AS total_deposits
6FROM customers c
7JOIN accounts a ON c.customer_id = a.customer_id
8JOIN branches b ON a.branch_id = b.branch_id
9WHERE a.txn_date >= DATEADD('month', -1, GETDATE())
10GROUP BY c.customer_name, b.branch_name
11ORDER BY total_deposits DESC
12LIMIT 10;
Copilot Chat
Show me the top 10 customers by deposit balance, grouped by branch, for last month.
I'll use your customers, accounts, and branches tables, your lowercase_with_underscores naming, and your standard date helper. Want me to write it?
Yes, write it.
Done. Written to query.sql using your conventions.
Step 1 of 5 - Ask Copilot
Click the token to see the cost of that conversation
Without instructions file
You repeat your schema every time
I'm on SQL Server. We use lowercase names with underscores for
tables and columns (customer_id, not CustomerID).
Customer data lives in three tables: customers (customer_id,
customer_name), accounts (account_id, customer_id, balance,
txn_date), and branches (branch_id, branch_name).
For date math use DATEADD and GETDATE(), not DATE_SUB or NOW().

Show me the top 10 customers by deposit balance,
grouped by branch, for last month.
0 tokens / request
With instructions file
You just ask the question
Show me the top 10 customers by deposit balance,
grouped by branch, for last month.
0 tokens / request
0
tokens saved per request
At 50 requests per workday, that is roughly 155,000 tokens recovered per month. More than half a 300k monthly premium-model budget, freed by a single file. Free models are uncapped and do not count against this number.
Going Deeper

There are five layers of context

The instructions file is Layer 1. As projects grow, Copilot can draw from additional context layers. Each one is opt-in - add them when you need them.

01
Instructions File
Always on. Defines project identity, stack, and standards. Copilot reads this on every single request.
Always active
02
Open Files
The files you have open in your editor tabs. Copilot automatically includes these as live context.
Contextual
03
Chat Selection
When you highlight code before opening chat, Copilot focuses on that selection. On-demand, you choose the scope.
On demand
04
Workspace Index
Copilot can index your entire codebase. Reference files with #file or use @workspace in chat to search across it.
Indexed
05
Personal Instructions
VS Code settings let you define global instructions that apply to every project on your machine. Your preferences, always enforced.
Global
Different Five Layers
These five layers answer "where does Copilot get its context?" There is a separate set of five layers that answers "what files can I write to customize Copilot?" Same number, different question. Read the companion page: The 5 Authoring Layers.
The Difference

Same question. Completely different answer.

Without Instructions

Generic. Slow. Requires cleanup.

  • -
    Copilot suggests jQuery when your project uses React
  • -
    Generated code uses .then() chains, your team uses async/await
  • -
    You explain your stack from scratch in every chat message
  • -
    Every suggestion needs manual review against your conventions
  • -
    AI is faster to type, but slower to trust
With Instructions File

Specific. Usable. Already correct.

  • +
    Suggestions match your exact stack on every request
  • +
    async/await by default, because you wrote that in the file
  • +
    You ask what you need. No preamble, no setup.
  • +
    Standards are enforced by context, not by memory
  • +
    Copilot produces code you can actually commit
Get Started

You are 5 minutes away from a Copilot that knows your project

  • 1
    Create .github/copilot-instructions.md. In your project root, create a .github folder, then create the file inside it.
  • 2
    Write the four sections. Project identity, tech stack, run commands, code standards. Two to three lines each is enough to start.
  • 3
    Open Copilot Chat and ask anything. Press Ctrl+Shift+I. Notice the difference immediately.
Sources

Where this comes from

Every claim about Copilot behavior on this page links to its source in the official GitHub or Microsoft documentation. Verify anything you want to. The patterns shown here are not invented; they are what the vendors document.

  1. [1]
    VS Code Docs Use custom instructions in VS Code

    Documents how .github/copilot-instructions.md is loaded automatically, the priority order with AGENTS.md and CLAUDE.md, and what content belongs in the file. Backs the entire premise of scenes 4 and 5.

    code.visualstudio.com/docs/copilot/customization/custom-instructions
  2. [2]
    VS Code Docs Customize AI in Visual Studio Code (overview)

    Umbrella reference for every Copilot customization surface. Backs the framing in scene 7 about additional context layers (open files, chat selection, workspace index, personal instructions).

    code.visualstudio.com/docs/copilot/customization/overview
  3. [3]
    VS Code Docs Chat in VS Code (Copilot Chat)

    Reference for Copilot Chat behavior, panel keyboard shortcut, and how chat selection scoping works. Backs scene 6.

    code.visualstudio.com/docs/copilot/copilot-chat