Give Copilot the context it needs to debug faster

Before you can fix a bug, you have to find it. That usually means digging through pull requests, hunting for design documents, and re-reading security guidelines just to figure out where to start. GitHub Copilot hits the same wall: without project context, its suggestions stay generic and detached from your actual codebase.

GitHub Copilot Spaces closes that gap. It gives Copilot access to the files, issues, pull requests, and repos that define your project, grounding its responses in what your code actually does. Here's how to use it to debug issues faster.

Set up a space around an issue

Suppose a contributor files an issue about an unsafe usage of check_call. As a maintainer, you might not know the right fix immediately, and you'd normally start searching through the repo and past PRs to piece together the project's conventions.

With Spaces, you skip that manual reconnaissance. Create a space, add the issue along with the relevant files, and Copilot can reason across all of them at once. Add to the space:

  • Design documents, such as /docs/security/check-patterns.md or /docs/design/architecture-overview.md
  • Security guidelines and accessibility recommendations
  • The full repository, or a curated set of the most relevant files — Spaces work best when you're intentional about what you include
  • The URL of the issue

Add instructions that keep Copilot grounded

Each space has an Instructions panel, where you define how Copilot should behave for your project. These instructions keep its output consistent, and telling it to cite sources prevents it from inventing patterns that don't exist in the repo.

You are an experienced engineer working on this codebase.
Always ground your answers in the linked docs and sources in this space.
Before writing code, produce a 3–5 step plan that includes:
  - The goal
  - The approach
  - The execution steps
Cite the exact files that justify your recommendations.
After I approve a plan, use the Copilot coding agent to propose a PR.

Start the debugging loop

Once the space is configured, ask Copilot to debug the issue. Because the issue is linked to the space, Copilot already knows what you mean. It parses every source you've added and returns a concrete plan, not a generic LLM answer.

For example, it will identify the goal — fixing unsafe usage of runBinaryCheck to validate input paths — and lay out its approach:

  1. Search the repo for usages of runBinaryCheck
  2. Compare each usage against the safe pattern in the security docs
  3. Identify the required refactor
  4. Prepare a diff for each file with unsafe usage

Approve the plan and tell Copilot to propose code changes using the Copilot coding agent. It generates a pull request with before/after versions, an explanation of what changed, and references to the exact files and instructions that informed the fix.

Iterate and share

If something's off, mention @copilot in the pull request comments to iterate on the existing PR, or go back to the space and generate a fresh one.

Spaces are private by default, but you can share them with individuals, teams, or your whole organization if admins allow it. Enterprise admins keep control over sharing to align with company security policies.

Spaces from your IDE

Spaces also work inside your editor through the GitHub MCP Server. Install it and you can call your spaces directly from your IDE, using the same curated context without switching between the browser and your code.

On the roadmap

  • Public API
  • Image support
  • Additional file types, such as .doc/.docx and PDFs

Where teams are using Spaces now

Code generation and debugging. Pair Spaces with the Copilot coding agent to produce pull requests aligned with your patterns, security rules, and architecture.

Feature planning. Link issues, design docs, and repos to plan features and draft requirements. Ask for a technical plan and Copilot generates the corresponding pull request.

Knowledge sharing and onboarding. Spaces become living knowledge bases. New engineers onboard faster, and existing ones stop re-answering the same questions.

Try it on your next issue

  1. Create a GitHub Copilot Space.
  2. Add one issue and three to four key files.
  3. Set simple instructions.
  4. Ask Copilot to analyze the issue and propose a debugging plan.
  5. Approve the plan.
  6. Trigger the coding agent to generate a pull request.

A debugging session should not start with a context scavenger hunt. When Copilot already knows your project, you go from issue report to grounded fix in one flow.