OmniCode
Copilot instructions12 starsChanged 6 months agoMITView on GitHub
Visual Studio Code is built with a layered architecture using TypeScript, web APIs and Electron, combining web technologies with native app capabilities. The codebase is organized into key architectural layers: The core architecture follows these principles: - Layered architecture - from base, platform, editor, to workbench - Dependency injection - Services are injected through constructor parameters - If non-service parameters are needed, they need to come after the service parameters - Contribution model - Features contribute to registries and extension…
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,349 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- launchSkill
- accessibilitySkill
- add-policySkill
- author-contributionsSkill
- auto-perf-optimizeSkill
- azure-pipelinesSkill
- chat-customizations-editorSkill
- chat-perfSkill
- component-fixturesSkill
- cpu-profile-analysisSkill
- fix-ci-failuresSkill
- fix-errorsSkill
- heap-snapshot-analysisSkill
- hygieneSkill
- integration-testsSkill
- memory-leak-auditSkill
- omnicode-logsSkill
- otelSkill
- sessionsSkill
- tool-rename-deprecationSkill
- unit-testsSkill
- update-screenshotsSkill
- vscode-dev-workbenchSkill
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
43 rules. About 1 is common, 21 are distinctive, and 21 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
21
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
If non-service parameters are needed, they need to come after the service parameters
- Distinctive: line 46
Semantic search first: Use file search for general concepts
- Common: line 47
Grep for exact strings: Use grep for error messages or specific function names
- Distinctive: line 48
Follow imports: Check what files import the problematic module
- Distinctive: line 55
NEVER run tests if there are compilation errors
- Very specific: line 56
NEVER use npm run compile to compile TypeScript files
- Very specific: line 59
If the #runTasks/getTaskOutput tool is available, check the VS Code - Build watch task output for compilation errors.
- Very specific: line 60
If the tool is not available (e.g.
- Very specific: line 61
If you changed built-in extensions under extensions/ and the tool is not available, run the corresponding gulp task npm run gulp …
- Very specific: line 66
Use npm run valid-layers-check to check for layering issues
- Very specific: line 76
Use PascalCase for type names
- Very specific: line 77
Use PascalCase for enum values
- Very specific: line 78
Use camelCase for function and method names
- Very specific: line 79
Use camelCase for property names and local variables
- Distinctive: line 80
Use whole words in names when possible
- Very specific: line 84
Do not export types or functions unless you need to share it across multiple components
- Very specific: line 85
Do not introduce new types or values to the global namespace
- Very specific: line 89
Use JSDoc style comments for functions, interfaces, enums, and classes
- Distinctive: line 93
Use "double quotes" for strings shown to the user that need to be externalized (localized)
- Distinctive: line 94
Use 'single quotes' otherwise
- Very specific: line 95
All strings visible to the user need to be externalized using the vs/nls module
- Distinctive: line 99
Use title-style capitalization for command labels, buttons and menu items (each word is capitalized).
- Distinctive: line 100
Don't capitalize prepositions of four or fewer letters unless it's the first or last word (e.g.
- Very specific: line 104
Use arrow functions => over anonymous function expressions
- Very specific: line 105
Only surround arrow function parameters when necessary.
- Distinctive: line 113
Always surround loop and conditional bodies with curly braces
- Distinctive: line 130
All files must include Microsoft copyright header
- Very specific: line 131
Prefer async and await over Promise and then calls
- Very specific: line 132
All user facing messages must be localized using the applicable localization framework (for example nls.localize() method)
- Distinctive: line 133
Don't add tests to the wrong test suite (e.g., adding to end of file instead of inside relevant suite)
- Distinctive: line 134
Look for existing test patterns before creating new structures
- Very specific: line 135
Use describe and test consistently with existing patterns
- Distinctive: line 136
Prefer regex capture groups with names over numbered capture groups.
- Distinctive: line 137
If you create any temporary new files, scripts, or helper files for iteration, clean up these files by removing them at the end of the task
- Distinctive: line 138
Never duplicate imports. Always reuse existing imports if they are present.
- Distinctive: line 139
When removing an import, do not leave behind blank lines where the import was.
- Very specific: line 140
Do not use any or unknown as the type for variables, parameters, or return values unless absolutely necessary.
- Distinctive: line 141
When adding file watching, prefer correlated file watchers (via fileService.createWatcher) to shared ones.
- Distinctive: line 142
When adding tooltips to UI elements, prefer the use of IHoverService service.
- Distinctive: line 143
Do not duplicate code. Always look for existing utility functions, helpers, or patterns in the codebase before implementing new …
- Very specific: line 146
Use IEditorService to open editors instead of IEditorGroupsService.activeGroup.openEditor to ensure that the editor opening logic is …
- Very specific: line 147
Avoid using bind(), call() and apply() solely to control this or partially apply arguments.
- Distinctive: line 148
Avoid using events to drive control flow between components.
≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
VS Code Copilot Instructions
Project Overview
Visual Studio Code is built with a layered architecture using TypeScript, web APIs and Electron, combining web technologies with native app capabilities. The codebase is organized into key architectural layers:
Root Folders
src/: Main TypeScript source code with unit tests insrc/vs/*/test/foldersbuild/: Build scripts and CI/CD toolsextensions/: Built-in extensions that ship with VS Codetest/: Integration tests and test infrastructurescripts/: Development and build scriptsresources/: Static resources (icons, themes, etc.)out/: Compiled JavaScript output (generated during build)
Core Architecture (src/ folder)
src/vs/base/- Foundation utilities and cross-platform abstractionssrc/vs/platform/- Platform services and dependency injection infrastructuresrc/vs/editor/- Text editor implementation with language services, syntax highlighting, and editing featuressrc/vs/workbench/- Main application workbench for web and desktopworkbench/browser/- Core workbench UI components (parts, layout, actions)workbench/services/- Service implementationsworkbench/contrib/- Feature contributions (git, debug, search, terminal, etc.)workbench/api/- Extension host and VS Code API implementation
src/vs/code/- Electron main process specific implementationsrc/vs/server/- Server specific implementationsrc/vs/sessions/- Agent sessions window, a dedicated workbench layer for agentic workflows (sits alongsidevs/workbench, may import from it but not vice versa)
The core architecture follows these principles:
- Layered architecture - from
base,platform,editor, toworkbench - Dependency injection - Services are injected through constructor parameters
- If non-service parameters are needed, they need to come after the service parameters
- Contribution model - Features contribute to registries and extension points
- Cross-platform compatibility - Abstractions separate platform-specific code
Built-in Extensions (extensions/ folder)
The extensions/ directory contains first-party extensions that ship with VS Code:
- Language support -
typescript-language-features/,html-language-features/,css-language-features/, etc. - Core features -
git/,debug-auto-launch/,emmet/,markdown-language-features/ - Themes -
theme-*folders for default color themes - Development tools -
extension-editing/,vscode-api-tests/
Each extension follows the standard VS Code extension structure with package.json, TypeScript sources, and contribution points to extend the workbench through the Extension API.
Finding Related Code
- Semantic search first: Use file search for general concepts
- Grep for exact strings: Use grep for error messages or specific function names
- Follow imports: Check what files import the problematic module
- Check test files: Often reveal usage patterns and expected behavior
Validating TypeScript changes
MANDATORY: Always check for compilation errors before running any tests or validation scripts, or declaring work complete, then fix all compilation errors before moving forward.
- NEVER run tests if there are compilation errors
- NEVER use
npm run compileto compile TypeScript files
TypeScript compilation steps
- If the
#runTasks/getTaskOutputtool is available, check theVS Code - Buildwatch task output for compilation errors. This task runsCore - BuildandExt - Buildto incrementally compile VS Code TypeScript sources and built-in extensions. Start the task if it's not already running in the background. - If the tool is not available (e.g. in CLI environments) and you only changed code under
src/, runnpm run compile-check-ts-nativeafter making changes to type-check the main VS Code sources (it validates./src/tsconfig.json). - If you changed built-in extensions under
extensions/and the tool is not available, run the corresponding gulp tasknpm run gulp compile-extensionsinstead so that TypeScript errors in extensions are also reported. - For TypeScript changes in the
buildfolder, you can simply runnpm run typecheckin thebuildfolder.
TypeScript validation steps
- Use the run test tool if you need to run tests. If that tool is not available, then you can use
scripts/test.sh(orscripts\test.baton Windows) for unit tests (add--grep <pattern>to filter tests) orscripts/test-integration.sh(orscripts\test-integration.baton Windows) for integration tests (integration tests end with .integrationTest.ts or are in /extensions/). - Use
npm run valid-layers-checkto check for layering issues
Coding Guidelines
Indentation
We use tabs, not spaces.
Naming Conventions
- Use PascalCase for
typenames - Use PascalCase for
enumvalues - Use camelCase for
functionandmethodnames - Use camelCase for
propertynames andlocal variables - Use whole words in names when possible
Types
- Do not export
typesorfunctionsunless you need to share it across multiple components - Do not introduce new
typesorvaluesto the global namespace
Comments
- Use JSDoc style comments for
functions,interfaces,enums, andclasses
Strings
- Use "double quotes" for strings shown to the user that need to be externalized (localized)
- Use 'single quotes' otherwise
- All strings visible to the user need to be externalized using the
vs/nlsmodule - Externalized strings must not use string concatenation. Use placeholders instead (
{0}).
UI labels
- Use title-style capitalization for command labels, buttons and menu items (each word is capitalized).
- Don't capitalize prepositions of four or fewer letters unless it's the first or last word (e.g. "in", "with", "for").
Style
- Use arrow functions
=>over anonymous function expressions - Only surround arrow function parameters when necessary. For example,
(x) => x + xis wrong but the following are correct:
x => x + x
(x, y) => x + y
<T>(x: T, y: T) => x === y- Always surround loop and conditional bodies with curly braces
- Open curly braces always go on the same line as whatever necessitates them
- Parenthesized constructs should have no surrounding whitespace. A single space follows commas, colons, and semicolons in those constructs. For example:
for (let i = 0, n = str.length; i < 10; i++) {
if (x < 10) {
foo();
}
}
function f(x: number, y: string): void { }- Whenever possible, use in top-level scopes
export function x(…) {…}instead ofexport const x = (…) => {…}. One advantage of using thefunctionkeyword is that the stack-trace shows a good name when debugging.
Code Quality
- All files must include Microsoft copyright header
- Prefer
asyncandawaitoverPromiseandthencalls - All user facing messages must be localized using the applicable localization framework (for example
nls.localize()method) - Don't add tests to the wrong test suite (e.g., adding to end of file instead of inside relevant suite)
- Look for existing test patterns before creating new structures
- Use
describeandtestconsistently with existing patterns - Prefer regex capture groups with names over numbered capture groups.
- If you create any temporary new files, scripts, or helper files for iteration, clean up these files by removing them at the end of the task
- Never duplicate imports. Always reuse existing imports if they are present.
- When removing an import, do not leave behind blank lines where the import was. Ensure the surrounding code remains compact.
- Do not use
anyorunknownas the type for variables, parameters, or return values unless absolutely necessary. If they need type annotations, they should have proper types or interfaces defined. - When adding file watching, prefer correlated file watchers (via fileService.createWatcher) to shared ones.
- When adding tooltips to UI elements, prefer the use of IHoverService service.
- Do not duplicate code. Always look for existing utility functions, helpers, or patterns in the codebase before implementing new functionality. Reuse and extend existing code whenever possible.
- You MUST deal with disposables by registering them immediately after creation for later disposal. Use helpers such as
DisposableStore,MutableDisposableorDisposableMap. Do NOT register a disposable to the containing class if the object is created within a method that is called repeadedly to avoid leaks. Instead, return aIDisposablefrom such method and let the caller register it. - You MUST NOT use storage keys of another component only to make changes to that component. You MUST come up with proper API to change another component.
- Use
IEditorServiceto open editors instead ofIEditorGroupsService.activeGroup.openEditorto ensure that the editor opening logic is properly followed and to avoid bypassing important features such asrevealIfOpenedorpreserveFocus. - Avoid using
bind(),call()andapply()solely to controlthisor partially apply arguments; prefer arrow functions or closures to capture the necessary context, and use these methods only when required by an API or interoperability. - Avoid using events to drive control flow between components. Instead, prefer direct method calls or service interactions to ensure clearer dependencies and easier traceability of logic. Events should be reserved for broadcasting state changes or notifications rather than orchestrating behavior across components.
- Service dependencies MUST be declared in constructors and MUST NOT be accessed through the
IInstantiationServiceat any other point in time.
Learnings
- Minimize the amount of assertions in tests. Prefer one snapshot-style
assert.deepStrictEqualover multiple precise assertions, as they are much more difficult to understand and to update. - Do not stub a global object (e.g.
(mainWindow as any).ResizeObserver = ...) or useanycasts to install fakes in tests. Instead, make the dependency injectable: add an optional constructor parameter on the production class that defaults to the real implementation (e.g.targetWindow.ResizeObserver), and have the test pass a fake that implements the real interface.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

