Skip to content

Copilot in VS Code

This guide helps you order GitHub Copilot, sign in correctly, and use Copilot effectively in your codebase—especially if you're new to the project or to Copilot.


Step 1: Order GitHub Copilot

Full instructions

  • Order GitHub Enterprise access:
    • In IDM, go to "System Access" → "GitHub"
  • Order GitHub Copilot Enterprise Plan (not GitHub Copilot Business Standalone):
    • In IDM, go to "Order" → "New Order" → "GitHub Teams" → "msg.P.ZT.GitHubEnterprise.Copilot"

Step 2: Sign in to Visual Studio Code

Switching between Copilot variants

  • Use this username format: Firstname-Lastname_msggroup
Sign in to VS Code


Step 3: Use Copilot in Your Source Code

Copilot as code suggestion tool

Official Documentation on using Copilot in VS Code

Chat with Copilot

Official Documentation on using Copilot Chat

Open Copilot chat

Add Repository-Wide Custom Instructions

Official Documentation on Repository Instructions

  • Onboard AI into your codebase using "Generate AI instructions"
Generate AI instructions

  • A summary of the project is generated at .github/copilot-instructions.md
copilot-instructions.md file

  • Use .github/copilot-instructions.md as context in chat. Optionally, also add the README.md file if the project has one.
Add instructions as contextContext selection

[!TIP] Commit this copilot-instructions.md file to the repository so the whole team uses the same instructions


Step 4: Prompting

Prompt Best Practices

Cheat Sheet

Prompt best practices

Examples

Example 1: Onboard in an existing codebase

  • Copy and paste the prompt below into Copilot Chat. In this example, the Update Candidate user flow is explored.
  • Use "Ask" mode.
You are onboarding me as a junior developer.

Using the rules and architecture described in copilot-instructions.md, explain how the
"Update Candidate" business scenario is implemented in this codebase.

1. Describe the end-to-end flow starting from the API/controller layer.
2. Explain which files and layers are involved and why.
3. Explain the business rules enforced (not just technical steps).
4. Point out where validations, permissions, and side effects happen.
5. Highlight anything that would be easy for a junior developer to misunderstand.

Assume I am new to both the project and Copilot.
Use simple, concrete language.

Onboarding prompt output


Example 2: Generate a backend unit test for a controller

  1. First, identify missing unit tests (use "Plan" mode). In this example, the Save Candidate user flow is examined.

Prompt 1:

Create a plan to improve unit test coverage for the saveCandidate service

1. Identify the main business scenarios handled by saveCandidate.
2. Check which of these scenarios are not currently covered by unit tests.
3. Propose a list of missing test cases, including:
   - happy path scenarios
   - business rule or validation failures
   - error cases (for example, when a dependency fails)
4. For each proposed test case, briefly explain what should be verified.

Do NOT write test code.
Assume I am a junior developer and keep explanations clear and simple.
Plan mode output

  1. Verify the plan, then generate one test (use "Ask" mode).

Prompt 2:

Using the plan above, write a unit test for Test 3: saveCandidate_withSkills_shouldSaveCorrectly.

Rules:
- Do NOT change production code. Tests only.
- Follow the testing style, tools, and naming conventions
- Mock all external dependencies.

- Implement the proposed test case
- Use Arrange / Act / Assert.
- Keep tests readable and add short comments explaining each test.

Output the complete test code.
Unit test generation output

  1. Run the test code
  • You can copy and paste the generated code and run it yourself.
Run generated tests

[!TIP] Instead of copy-pasting, let Copilot assist using Agent mode. This will be discussed in a later section.

Copyright © MSG Systems Romania AI Labs