DevOps

Vibe Coding with GitHub Copilot: How to Use Custom Instructions the Right Way  

GitHub Copilot Custom Instructions

Let’s say you’re working on a large enterprise application, one with multiple modules, a complex directory structure, and established utility functions that handle everything from API calls to logging. You’ve got a team of developers working across different features, and naturally, your codebase has strict guidelines around how things are done. 

You start using GitHub Copilot to speed things up and maybe to refactor some code, build new features, or write tests. It performs well at first, but soon shows limitations.

But soon, you notice a few problems — the Vibe Coding flow breaks when Copilot doesn’t understand your project context.

Where Copilot Agent Mode Falls Short

Copilot’s Agent mode is powerful, but it often lacks the context needed to behave properly in a mature codebase. It might: 

  • Modify files; it shouldn’t touch 
  • Create new utility functions instead of using the ones you already have 
  • Suggest code that breaks formatting or violates naming conventions 
  • Miss important architectural patterns your team follows 

And every time you start a new Copilot chat, you’re back to square one, having to re-explain the structure, patterns, and expectations of your project just to get meaningful output. 

This can be incredibly frustrating, especially on long-term projects or collaborative codebases. 

Enter Custom Instructions

That’s where Vibe Coding meets real efficiency and where GitHub Copilot Custom Instructions come in.

Custom Instructions give Copilot a way to “understand” your project before generating responses. You create a markdown file that outlines your project structure, utilities, coding standards, and more. Copilot uses that file as a reference every time it assists you. 

Think of it as onboarding Copilot to your project, the same way you would with a new developer. 

What Are Custom Instructions? 

Custom Instructions live in a file called

copilot-instructions.md

This file should be placed at the root of your project directory. It serves as a guidebook that tells Copilot how to behave inside your specific environment. 

Here’s a simplified sample: 

# Copilot Custom Instructions 



## Project Overview

Modular web app with React frontend, Node.js backend, and PostgreSQL.



## Utilities to Reuse

showNotification(type, message)

logError(error)

apiClient.get/post/put/delete



## Coding Standards

camelCase for variables/functions

PascalCase for components

Arrow functions preferred

No default exports



## File Structure

/src/api → API layer

/src/components → UI components

/src/utils → Common helpers



## Refer to additional guides:

api-guidelines.md

ui-components.md

utils.md

By defining these rules, you give Copilot a strong foundation to generate cleaner, more relevant suggestions that match your team’s conventions. 

Setting It Up 

There are two ways to create this file: 

Option 1: Manual Setup 

Perfect for teams with clear internal documentation. Just create the copilot-instructions.md file and fill in your architecture, standards, and utilities manually. 

Option 2: Auto-Generate Instructions

Want to save time? Let Copilot do the initial work. 

  1. Open your project in VS Code 
  2. Go to Copilot Chat → Configure Chat
  3. Click Generate Instructions 

This scans your project and creates a starter file at .github/copilot-instructions.md. You can then edit or extend it.  

Auto-Generate Instructions

Why Custom Instructions Matter?

Once set up, you’ll notice immediate improvements: 

1. Consistent Code Suggestions 

Copilot will stop making random edits or introducing redundant utilities. Instead, it will align with your existing patterns and use your shared helpers. 

2. No More Repeating Yourself 

Copilot reads your instructions with every new chat. You won’t have to explain how your project works over and over again. 

This is a game-changer for medium to large projects, especially across sprints or team handoffs. 

Organizing for Larger Projects

As your project grows, so will your instructions. To avoid one giant file, break it down into modular markdown files. 

For example, here’s a dedicated file for API development: 

# api-guidelines.md 

## Use apiClient wrapper

apiClient.get(url)

apiClient.post(url, data)

## Rules

Use async/await, not .then()

Don’t hardcode URLs – use route constants

Types must be defined and reused

All errors must go through logError()

## Example

const getUser = async (id) => {
try {
const res = await apiClient.get(`/users/${id}`);
return res.data;
} catch (err) {
logError(err);
throw err;
}
};


# Prompt-Based Routing (Advanced)

You can even route Copilot to specific instruction files based on keywords in the prompt.

Here’s how to define it in your copilot-instructions.md file:

## Prompt Routing Table

| If Prompt Contains | Refer to |
|-------------------------|----------------------|
| API, endpoint | api-guidelines.md |
| component, button | ui-components.md |
| form, input | form-guidelines.md |
| validate, parse | utils.md |
 

With this logic in place, Copilot will read only the relevant instruction file based on what the developer is asking, keeping answers sharp and relevant. 

Conclusion

GitHub Copilot is a powerful tool, but without direction, it can waste more time than it saves, especially on large projects. 

Custom Instructions are the missing link. With minimal effort, you can turn Copilot into a context-aware teammate that codes just like your team would. 

With Custom Instructions, you bring back the Vibe Coding rhythm where AI assists, not interrupts.

Pro Tip
Set a recurring reminder (once per sprint) to review and update your copilot-instructions.md. Your future self will thank you. 

mayur-sonar

Technical Lead