-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Add copilot-instructions to repo #35812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
813cb17
Add copilot-instructions to repo
wadepickett 5e6a926
improved auth example question
wadepickett 89ce497
Added rule for ms.date format
wadepickett 00fc198
Update copilot-instructions.md
wadepickett 8d60470
Update copilot-instructions.md
wadepickett 23314f7
Update copilot-instructions.md
wadepickett ebe7aff
Update copilot-instructions.md
wadepickett d2f1046
Update copilot-instructions.md
wadepickett 9cdbe3b
Update copilot-instructions.md
wadepickett df5d6be
Update copilot-instructions.md
wadepickett a2b1c1a
Update .github/copilot-instructions.md
wadepickett f000dea
Update .github/copilot-instructions.md
wadepickett e948bab
Update copilot-instructions.md
wadepickett 3157f4d
Ensure ms.date format and upate
wadepickett 270764d
Fixed typo
wadepickett 7ad64c9
Added blank line for formatting
wadepickett 6d5fba2
Update copilot-instructions.md
wadepickett 873bf06
Update copilot-instructions.md
wadepickett da48207
Update copilot-instructions.md
wadepickett 6d195a1
Apply suggestions from code review
wadepickett bbd4801
Update .github/copilot-instructions.md
wadepickett 4d685d7
Apply suggestions from code review
wadepickett 658b8ac
Apply suggestions from code review
wadepickett 2f63cfa
Update .github/copilot-instructions.md
wadepickett 089f5b7
Update .github/copilot-instructions.md
wadepickett 812fc78
More suggestion added and clean up.
wadepickett 74f1650
Formatting and organziational fixes
wadepickett 06fa80a
Added guardrex code snippet suggestions
wadepickett d9d187b
Update .github/copilot-instructions.md
wadepickett d378c11
Update .github/copilot-instructions.md
wadepickett e16c857
Apply suggestions from code review
wadepickett 2ac229c
Updates per tdykstra suggestions
wadepickett ca17b39
Fixed pre-view instruction per tdykstra suggestion
wadepickett 999a274
update for API ref verify per tdykstra suggestion
wadepickett f9a8aa6
Added issue overview instructions per tdykstra suggestion
wadepickett 171777f
One last check for grammar
wadepickett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| --- | ||
| author: wadepickett | ||
| ms.author: wpickett | ||
| ms.date: 07-28-2025 | ||
| --- | ||
wadepickett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Copilot Instructions for `dotnet/AspNetCore.Docs` | ||
|
|
||
| ## Introduction | ||
|
|
||
| This document contains repository-specific instructions for GitHub Copilot when assisting with the `dotnet/AspNetCore.Docs` repository. **Unless otherwise specified, all ".NET" references refer to modern .NET, not .NET Framework.** | ||
|
|
||
| ## Repository-Specific Guidelines | ||
|
|
||
| - Follow the [Microsoft Writing Style Guide](https://learn.microsoft.com/en-us/style-guide/welcome/) | ||
wadepickett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - **Repository Exceptions**: | ||
| - Number ordered lists as "1." for every item (don't use sequential numbers) | ||
| - Use backticks, also called backquotes or graves, around content specifically for file names (`file.txt`), folders (`folder`), file paths (`folder/file.txt`), custom types (`myVariable`, `MyClass`), raw URLs in the text (`https://www.contoso.com`), URL segments (`/product/id/199`), file extensions (`.razor`), NuGet packages (`Microsoft.AspNetCore.SignalR.Client`), and code that should never be localized | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - For Blazor's Razor components mentioned in article text, use backticks around the name of the component (example: `Counter` component) | ||
| - For any new or updated .md file, ensure the standard frontmatter (metadata) is included as specified in [Metadata for Microsoft Learn documentation.](https://learn.microsoft.com/en-us/contribute/content/metadata) | ||
| - For any new .md file added to the repository or any updated .md file ensure the following frontmatter (meta data) is included. | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Metadata `ai-usage: ai-assisted` if any AI assistance was used | ||
| - The correct order of metadata lines is to place the title (`title`) first and the rest of the metadata lines in alphabetical order. Example: `title`, `author`, `description`, `monikerRange`, `ms.author`, `ms.custom`, `ms.date`, `uid`, `zone_pivot_groups` | ||
| - Metadata `ms.date: <today's date>` with a format of MM-DD-YYYY. If the file already has a `ms.date` metadata, update it to today's date if more than 50 characters are changed in the file. | ||
tdykstra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Version Targeting | ||
|
|
||
| ### Detection Priority Order | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 1. **Explicit PR/Issue Instructions** - Prioritize explicit version ranges mentioned | ||
| 2. **File Metadata** - Check YAML frontmatter for specifications | ||
| 3. **Inline Moniker Tags** - Look for version range specifications | ||
| 4. **Repository Branch Context** - Consider branch where PR will be merged | ||
| 5. **Directory Structure** - Check for version-specific directories | ||
|
|
||
| ### Common Range Patterns | ||
| - Fixed Range: `>= aspnetcore-7.0 <= aspnetcore-9.0` | ||
| - Open Upper Bound: `>= aspnetcore-7.0` | ||
| - Open Lower Bound: `<= aspnetcore-9.0` | ||
| - Specific Version: `== aspnetcore-9.0` | ||
|
|
||
| ## API References and Verification | ||
|
|
||
| - Never guess API documentation IDs, always verify. If unable to verfy, say so. | ||
| - Check if features were introduced after .NET Core 3.1 | ||
| - Default to most compatible syntax when uncertain | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - For breaking changes, check: | ||
| - Changes to default behavior of existing APIs | ||
| - Removed or renamed public API elements | ||
| - Modified method signatures or return types | ||
| - Changed serialization formats | ||
| - Altered dependency requirements | ||
| - Changes to configuration schema | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Links and References | ||
|
|
||
| - Use relative links for files within this repo | ||
| - When adding external links into a document, strip out the language/culture segment of the URL if present (example: remove the `en-us` or `en` part of links to English versions of webpages) | ||
| - For learn.microsoft.com links, remove `https://learn.microsoft.com/en-us` from URLs | ||
| - Use cross-references for APIs: `<xref:api-doc-ID>` | ||
|
||
| - Get doc ID from the relevant XML doc in dotnet-api-docs, and omit the first two characters of the doc ID | ||
|
|
||
| ## Markdown File Naming and Organization | ||
|
|
||
| - If you're adding a new Markdown file, it should be named in all lowercase with hyphens separating words. Also, omit any filler words such as "the" or "a" from the file name. | ||
|
|
||
| ## Code Snippets | ||
|
|
||
| - For snippets **longer than 6 lines**: | ||
| - Place in separate `.cs` file in a `snippets` folder next to the Markdown file | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Create a subfolder named after the document | ||
| - For version-specific code, include a version folder | ||
| - Add a simple `.csproj` file targeting the appropriate .NET version | ||
|
|
||
| - Reference snippets using triple-colon syntax: | ||
| - **Use file-relative paths** for snippets specific to a single doc file: | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
| :::code language="csharp" source="../snippets/my-doc/Program.cs"::: | ||
| ``` | ||
| - **Use repository root-relative paths** for shared snippets: | ||
| ``` | ||
| :::code language="csharp" source="~/tutorials/min-web-api/samples/9.x/todoGroup/TodoDb.cs"::: | ||
| ``` | ||
| - For longer snippets, highlight specific lines: | ||
| ``` | ||
| :::code language="csharp" source="~/path/to/file.cs" range="5-10" highlight="2-3"::: | ||
| ``` | ||
| - Use the latest, non-preview C# coding patterns in non-preview code examples | ||
| - Use the latest preview C# coding patterns in preview code examples | ||
|
|
||
| The following table indicates the code language to use for markdown code blocks or the `language` attribute of a code snippet and the amount of indentation to use. | ||
|
|
||
| Content of the snippet | Code language | Indentation in spaces | ||
| :---: | :---: | :---: | ||
| C# | csharp | 4 | ||
| HTML | html | 4 | ||
| CSS | css | 4 | ||
| JavaScript | javascript | 2 (4 spaces for line continuation) | ||
| XML | xml | 2 | ||
| JSON | json | 2 | ||
| Console | console | 2 | ||
| Text | - | 2 | ||
|
|
||
| ## ASP.NET Core Specific Guidelines | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - Use the latest supported version for examples unless otherwise specified | ||
wadepickett marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - Title and section header casing is sentence case (capitalize the first word and any proper nouns) | ||
| - For parts of a title or section header that normally use code style in article text (backticks around the content), also use code style in the title or section header (example H1 header: "# Modify the `Program.cs` file") | ||
| - Use code style for any words that shouldn't be localized | ||
| - For bullet lists, use an asterisk as the bullet marker | ||
| - Bullet lists should have two or more entries at the same level in the list. If there is only one item under a bullet, remove its bullet marker and roll that item into its parent bullet. | ||
| - Lead with Microsoft recommended approaches | ||
| - Include differences between Minimal API and controller-based approaches when relevant | ||
| - For middleware content and examples, use the middleware class approach | ||
|
|
||
| ## Issue Handling | ||
|
|
||
| When creating a PR for an issue: | ||
| 1. Read the full issue and all linked references | ||
| 2. Study code samples from linked PRs for pre-release features | ||
| 3. For labeled issues: | ||
| - **new-feature:** State which version introduced the feature | ||
| - **bug:** Focus on correcting technical inaccuracies | ||
| 4. When you're assigned an issue, after you've completed your work and the workflows (status checks) have run, check to make sure there are no build warnings under the OpenPublishing.Build status check. If there are, open the build report (under View Details) and resolve any build warnings you introduced. | ||
wadepickett marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.