Asking an LLM "how does this project work?" usually gets you a bland, confident summary that misses your actual dependency bottlenecks. 365Finds has tested this across messy monolithic repositories and decoupled micro-frontends: if you throw an unanchored question at GitHub Copilot in Visual Studio Code, it will latch onto a random README or hallucinate a generic MVC structure.
To extract real architectural insight—dependency flow, state boundaries, auth lifecycles—you need to deliberately configure chat participants, target slash commands, and pin workspace context variables. Here is how to configure GitHub Copilot in VS Code so it actually understands your repository's structure.
The Triad: Participants, Commands, and Variables
In VS Code, Copilot Chat breaks your prompt into a deterministic execution pattern:
@participant /command #variable [query]
Treating this syntax as an ad-hoc query string is a mistake. 365Finds views each component as a strict scoping layer:
@workspace(Participant): Tells Copilot not to look at just your active buffer or general internet knowledge, but to route the question through VS Code's local workspace indexing engine (AST symbols, semantic embeddings, and grep search).- Slash Commands (
/explain,/new): Instructs the participant on the task intent. For architectural discovery,/explainis the primary workhorse. - Context Variables (
#codebase,#file:,#folder:): The most critical piece developers omit. Without these,@workspaceguesses where to search. With them, you anchor the RAG retrieval pipeline to the exact architectural spine you care about.
| Syntax Element | Purpose in Architectural Queries | Example Query |
|---|---|---|
@workspace | Directs the model to search project symbols and local indexes | @workspace explain the application lifecycle |
@workspace /explain | Requests a breakdown of architectural logic across targeted code | @workspace /explain how requests propagate to database models |
#codebase | Forces a repository-wide semantic search across indexed files | @workspace #codebase where is tenant isolation enforced? |
#file: / #folder: | Explicitly injects critical configuration or entrypoint files | @workspace /explain #folder:src/core #file:src/main.ts |
Step-by-Step: Setting Up Workspace Architecture Queries
1. Build and Verify the Workspace Semantic Index
Copilot cannot map your architecture if its index is stale or missing. VS Code automatically indexes open workspaces, but large projects frequently fall behind.
- Open the Command Palette (
Ctrl+Shift+Pon Linux/Windows,Cmd+Shift+Pon macOS). - Type and run:
GitHub Copilot: Build Codebase semantic index(or check index status in the Chat view). - Verify that your
.gitignoreand.vscode/settings.jsondo not exclude files you need Copilot to inspect. Files excluded underfiles.excludeor ignored by Git will be invisible to Copilot's indexing agent.
At 365Finds, we find that remote indexes on GitHub-hosted repos provide fast semantic lookups, but if you work on a private monorepo or offline development container, local index generation is non-negotiable.
2. Standardize Context with .github/copilot-instructions.md
You should never retype your architectural conventions in every prompt. The most effective configuration in VS Code is creating a workspace-level instructions file.
Create a file at .github/copilot-instructions.md at the root of your repository:
# Architectural Context & Rules
## Project Structure
- `apps/web`: Next.js frontend handling routing and edge rendering.
- `packages/api`: tRPC router definitions and input validation schemas.
- `packages/db`: Prisma client and migration definitions.
## Boundaries & Constraints
- Database queries must never be invoked inside `apps/web`; they must go through the tRPC router in `packages/api`.
- Domain events emit through Redis pub/sub defined in `packages/events`.
- Authentication is handled exclusively by middleware in `apps/web/middleware.ts`.
VS Code reads .github/copilot-instructions.md automatically on every chat turn. When you subsequently invoke @workspace, Copilot evaluates the project through these declared boundaries rather than guessing what your folders mean.
If you have isolated domains—such as legacy modules or strict microservices—you can also place scoped instruction files using YAML frontmatter in .github/instructions/:
---
applyTo: "services/billing/**"
---
# Billing Service Architecture
- All payments run through Stripe webhooks processed idempotently via Redis locks.
- Never write database mutations without an audit transaction log entry.
3. Querying Component Flow and System Boundaries
Once indexing and instruction files are in place, use targeted prompt combinations in the Copilot Chat panel (Ctrl+Alt+I or Cmd+Alt+I).
Querying End-to-End Data Flow
Do not ask: @workspace how does data flow?
Instead, specify entry and termination points using #file or #folder:
@workspace /explain #file:apps/web/src/pages/api/checkout.ts #folder:packages/api Trace the lifecycle of an order creation request from the API handler down to persistence.
Locating Structural Violations
Copilot excels at auditing whether new or existing code adheres to your architecture:
@workspace #codebase Are there any files under apps/web that directly import database dependencies from packages/db?
Understanding Cross-Cutting Concerns
To map authentication, logging, or error handling across the workspace:
@workspace #codebase Summarize how auth session context is passed between middleware and backend API routes.
Where Copilot Shines—and Where It Struggles
365Finds does not recommend relying on GitHub Copilot to automatically generate your comprehensive architectural blueprint from scratch. If your codebase contains spaghetti code or circular module imports, @workspace often outputs superficial diagrams that mirror the surface chaos rather than clarifying design intent.
Copilot's true value lies in pinpointing cross-module relationships: tracing how an interface in package A feeds an event subscriber in package B. By pinning critical boundary files with #file and feeding architectural invariants through .github/copilot-instructions.md, you turn Copilot from an unpredictable autocomplete bot into an active architectural navigational guide.
VS Code also permits dragging and dropping files directly into the Copilot Chat input window to pin them instantly as context attachments alongside @workspace.