Copilot instructions
.github/copilot-instructions.mdCopilot instructions
Quality
97/100
Scores the file, not the repository.Length
1,124 words
15 headings · 5 code blocksRepository
21k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# Roslyn (.NET Compiler Platform) — Copilot Instructions23> This is the **canonical** repo-wide agent entry point. `AGENTS.md` at the repo root points here. Path-scoped rules in `.github/instructions/{Compiler,IDE,Razor}.instructions.md` apply automatically by area and supplement this file. This file establishes the memory-first orientation protocol and doc-maintenance obligation.45## Project Overview67Roslyn is the open-source C# and Visual Basic compilers plus the language services and IDE features built on their APIs. Built around **immutable** syntax trees, semantic models, symbols, and workspace snapshots. Major components:8- **Compilers** (`src/Compilers/`) — C#/VB compilers (syntax, semantics, emit).9- **Workspaces** (`src/Workspaces/`) — Solution/Project/Document model + MEF host.10- **Features / EditorFeatures** (`src/Features/`, `src/EditorFeatures/`) — IDE features.11- **Analyzers / CodeStyle** (`src/Analyzers/`, `src/CodeStyle/`) — IDE0xxx diagnostics & fixes.12- **LanguageServer** (`src/LanguageServer/`) — LSP server.13- **VisualStudio** (`src/VisualStudio/`) — VS integration.14- **Razor** (`src/Razor/src/`) — Razor compiler & tooling (merged sub-tree).1516## Project Structure1718```19src/20 Compilers/ # C#/VB compilers (Core, CSharp, VisualBasic, Server)21 Workspaces/ # Solution model, MSBuild loading, Remote (OOP)22 Features/ # Language-agnostic IDE feature logic23 EditorFeatures/ # Editor/text-buffer integration24 Analyzers/ # IDE0xxx code-style analyzers & fixes25 LanguageServer/ # LSP server26 VisualStudio/ # VS language services & UI27 Razor/src/ # Razor compiler + tooling (own layout)28 ExpressionEvaluator/ Scripting/ Interactive/ RoslynAnalyzers/29eng/ # Arcade build engineering (eng/common is DARC-synced)30docs/ # Contributor & design docs31```3233## Build & Test3435### Build specific projects during development (preferred)36```bash37dotnet build Compilers.slnf # compilers only38dotnet build Ide.slnf # IDE only39dotnet build Razor.slnf # Razor compiler & tooling only40dotnet build <path/to/Project.csproj>41```4243### Run tests for modified code44```bash45dotnet test <path/to/Specific.UnitTests.csproj>46dotnet test <proj> --filter "FullyQualifiedName~MyTestClass"47```4849Tests can take a while to build and run — monitor output and wait for completion unless you're confident a run is hung.5051### Full build/test (final validation only)52```bash53./build.sh # Build.cmd on Windows54./test.sh # Test.cmd on Windows55```5657Other entry points: `dotnet run --file eng/generate-compiler-code.cs` (regenerate Syntax/BoundNodes code), `dotnet msbuild <proj> /t:UpdateXlf` (refresh `.xlf` after `.resx` edits).5859## Code Style6061- 4-space indent for code; 2-space for project/XML/JSON. Never tabs. UTF-8-BOM, final newline for `*.cs`/`*.vb`.62- **Blank lines must be completely empty** (no spaces/tabs); no trailing whitespace — both are hard lint failures.63- Private fields `_camelCase`; namespaces `Microsoft.CodeAnalysis.[Language].[Area]`.64- Always thread `CancellationToken` through async operations. (Null-checking style is layer-specific — see the area's instruction file: `Contract.ThrowIfNull` in IDE, `Debug.Assert` in the compiler.)65- Language services are exported **per-language** (`[ExportLanguageService(..., LanguageNames.CSharp), Shared]`), never shared across C#/VB.66- No `TODO`/`TODO2` comments — track follow-ups as linked GitHub issues in code; existing `TODO2`s are only a frozen enforcement baseline. No `PROTOTYPE` comments in PRs to `main`.67- Update `PublicAPI.Unshipped.txt` for public API changes. Never hand-edit generated code or `eng/common`.6869Full conventions: `.github/memory/CONVENTIONS.md` and `.github/instructions/{Compiler,IDE,Razor}.instructions.md`.7071## Agent Orientation7273When starting any task or answering any question about this repo:741. **Read `.github/memory/INDEX.md` first** — it's the loading map for the knowledge base. Use it to find authoritative answers before searching the file system.752. **For any non-trivial task, also read `.github/memory/ARCHITECTURE.md` and `.github/memory/CONVENTIONS.md`** as your baseline.763. **Read the path-scoped instruction file for the area you're editing** — `.github/instructions/Compiler.instructions.md`, `IDE.instructions.md`, or `Razor.instructions.md` (these auto-apply to `.cs`/`.vb` under their glob and carry the layer's directory detail, conventions, and key files/APIs). For that layer's **known issues** and **test conventions**, load `.github/memory/known-issues/<area>.md` and `.github/memory/testing/<area>.md` on demand (see the INDEX loading map).774. After completing work, run the `update-agent-docs` skill.7879### Memory8081`.github/memory/` is your persistent knowledge base. You may freely create new focused files, update existing ones when you find corrections, and reorganize when structure no longer fits. Use descriptive filenames.8283**Memory freshness is your responsibility.** Files can drift from the code:84- **Always cross-check memory claims against actual code** before relying on them.85- **If a memory file is stale, fix it immediately.** If you learn something worth keeping, write it to `.github/memory/` immediately.8687### Doc Update Obligation8889Every task that changes code must end with a doc pass:90- Added or moved files? → Update `.github/memory/FILE_MAP.md` (top-level) and the matching `.github/instructions/<area>.instructions.md` (directory detail).91- Changed a public interface, diagnostic ID, or API? → Update the relevant `.github/instructions/<area>.instructions.md` and `PublicAPI.Unshipped.txt`.92- Hit something surprising or undocumented? → Repo-wide → `.github/memory/KNOWN_ISSUES.md`; layer-specific → `.github/memory/known-issues/<area>.md`.93- Established a new pattern? → Repo-wide → `.github/memory/CONVENTIONS.md`; layer-specific → the matching `.github/instructions/<area>.instructions.md`.94- Changed test base classes or conventions? → Repo-wide layout → `.github/memory/TESTING_STRATEGY.md`; layer-specific → `.github/memory/testing/<area>.md`.95- Added/removed/renamed a memory file? → Update `.github/memory/INDEX.md`.9697### Skills9899Skills live in `.github/skills/<skill-name>/SKILL.md` and are auto-discovered by their YAML `description`. Useful ones here include `code-review`, `ci-analysis`, `analyzer-codefix`, `merge-into-branch`, `snap`, and `update-agent-docs`.100101## Working Loop (plan first)102103For any **non-trivial** change, start with a short plan **before** writing the implementing diff — and surface it so it can be reviewed before a large diff appears. "Non-trivial" means anything that is cross-file or cross-area, touches a public API / diagnostic ID / analyzer, changes behavior (not just a typo/comment/formatting fix), or where the approach isn't obvious. When in doubt, write the plan — it's cheap.104105Write the plan to `plan.md` in your session folder (see the session context) and keep it updated at milestones. A plan is a working artifact, not a deliverable: keep it lean.106107**Plan template** (drop unneeded fields):108109```markdown110## Plan: <short title>111112- **Scope:** what this change will do.113- **Non-goals:** what this change explicitly will NOT do.114- **Affected areas:** projects/files/layers touched (e.g. `src/Compilers/CSharp`, matching `.instructions.md`).115- **Approach:** the intended implementation, and any alternatives considered/rejected.116- **Acceptance:** observable done-state — the behavior/tests that prove it works.117- **Validation:** exact build + targeted test commands you'll run (see Build & Test).118```119120**Post the plan and wait for approval before writing the implementing diff** — the plan is meant to be reviewed now, not after a large diff already exists.121122Then implement, keeping the diff **scoped and reviewable** — prefer the smallest change that fully addresses the task over a broad refactor. If the plan changes materially while implementing, update it rather than silently diverging. Only after the plan's **Acceptance** and **Validation** are satisfied (and the Validation Checklist below passes) is the work "done."123124Trivial changes don't need a written plan — go straight to the Validation Checklist.125126## Validation Checklist127128When making changes:1291. **Read `.github/memory/INDEX.md` first.**1302. For non-trivial tasks, read `ARCHITECTURE.md` and `CONVENTIONS.md`, and the `.github/instructions/<area>.instructions.md` for the area you're editing.1313. **Build the specific project(s) modified** (`Compilers.slnf` / `Ide.slnf` / `Razor.slnf` / the project).1324. **Run targeted tests** for affected test project(s).1335. If you edited a `.resx`, run `/t:UpdateXlf`; if you edited Syntax/BoundNodes XML, regenerate code. Update `PublicAPI.Unshipped.txt` for public API changes.1346. Follow existing patterns in similar files.1357. **Doc pass** (mandatory) — run the `update-agent-docs` skill and apply the Doc Update Obligation above.136
Also in dotnet/roslyn
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotnet/roslyn.github/instructions/Compiler.instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 99/100 | 3 days ago | |
| dotnet/roslyn.github/instructions/IDE.instructions.md · 21k | Copilot instructions | stylearch | 70/100 | 3 days ago | |
| dotnet/roslyn.github/instructions/Razor.instructions.md · 21k | Copilot instructions | buildstyletypesdo-not+1 | 67/100 | 3 days ago | |
| dotnet/roslynAGENTS.md · 21k | AGENTS.md | buildagent-behaviour | 43/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| pytorch/pytorch.github/copilot-instructions.md · 102k | Copilot instructions | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| dotnet/roslyn.github/instructions/Compiler.instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 99/100 | 3 days ago | |
| hiyouga/LlamaFactory.github/copilot-instructions.md · 74k | Copilot instructions | setupbuildtestlint-format+5 | 97/100 | 2 days ago | |
| rtk-ai/rtk.github/copilot-instructions.md · 74k | Copilot instructions | buildtestlint-formatstyle+2 | 97/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.github/copilot-instructions.md · 31k | Copilot instructions | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 3 days ago |
