-
Notifications
You must be signed in to change notification settings - Fork 4
docs: Enhance Copilot instruction files for project files #621
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7108180
docs: allow copilot to read individual instruction sets based on what…
rjmurillo 53a0cf6
docs: add additional instructions for copilot
rjmurillo afdcb9f
docs: update copilot instructions with critical rules and troubleshoo…
rjmurillo 775c949
docs: update project instructions with dependency management and vali…
rjmurillo a257545
docs: add detailed instructions for .editorconfig, generic files, .gi…
rjmurillo c6f85c3
docs: add Decision Trees section for complex changes in C# and generi…
rjmurillo d09bdce
docs: enhance test data guidelines across C# and generic instructions…
rjmurillo 9611604
docs: add instruction file index for various file types to enhance gu…
rjmurillo 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
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,20 @@ | ||
| # Instruction File Index | ||
|
|
||
| This table maps file patterns in the repository to their corresponding instruction files. Use this as a quick reference to ensure you are following the correct guidance for each file type. If a file type is not listed, refer to `generic.instructions.md`. | ||
|
|
||
| | File Pattern | Instruction File | Description/Notes | | ||
| |------------------------|----------------------------------------------------|-----------------------------------------| | ||
| | `*.cs` | `csharp.instructions.md` | C# source files | | ||
| | `*.csproj`, `*.sln` | `project.instructions.md` | Project/solution files | | ||
| | `*.md` | `markdown.instructions.md` | Markdown documentation | | ||
| | `*.json` | `json.instructions.md` | JSON config | | ||
| | `*.yml`, `*.yaml` | `yaml.instructions.md` | CI/CD workflows | | ||
| | `*.sh`, `*.ps1` | `shell.instructions.md` | Shell/PowerShell scripts | | ||
| | `*.xml` | `xml.instructions.md` | XML config/docs | | ||
| | `*.txt` | `text.instructions.md` | Text files | | ||
| | `.editorconfig` | `editorconfig.instructions.md` | EditorConfig rules | | ||
| | `.gitignore` | `gitignore.instructions.md` | Git ignore rules | | ||
| | `*.props`, `*.targets` | `msbuild.instructions.md` | MSBuild property/target files | | ||
| | _Other_ | `generic.instructions.md` | Fallback for unknown file types | | ||
|
|
||
| **Note:** If you are editing a file type not listed above, always check for a matching instruction file in this directory or use the generic fallback. When in doubt, escalate by tagging `@repo-maintainers` in your PR. |
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 |
|---|---|---|
| @@ -1,4 +1,89 @@ | ||
| --- | ||
| applyTo: '**/*.cs' | ||
| --- | ||
| Always read and apply the instructions in [.github/copilot-instructions.md](../copilot-instructions.md) when working on C# source or project files | ||
|
|
||
| # C# File Instructions | ||
|
|
||
| > **MANDATORY:** You MUST follow these instructions when editing any C# file in this repository. | ||
|
|
||
| - **For complex changes, see the Decision Trees section below** | ||
|
|
||
| ## Primary Instructions | ||
|
|
||
| Always read and apply the instructions in [.github/copilot-instructions.md](../copilot-instructions.md) when working on C# source or project files. | ||
|
|
||
| ## Additional Context | ||
|
|
||
| This instruction file works in conjunction with the comprehensive C# development guidelines in the main copilot-instructions.md file. The main file contains detailed requirements for: | ||
|
|
||
| - Roslyn analyzer development | ||
| - Code quality standards | ||
| - Testing requirements | ||
| - Performance considerations | ||
| - XML documentation standards | ||
| - Workflow requirements | ||
|
|
||
| ## File-Specific Requirements | ||
|
|
||
| When working with C# files, ensure you also review: | ||
|
|
||
| - **Project files**: See [project.instructions.md](project.instructions.md) for .csproj and .sln files | ||
| - **XML files**: See [xml.instructions.md](xml.instructions.md) for XML documentation and configuration | ||
| - **Documentation**: See [markdown.instructions.md](markdown.instructions.md) for documentation updates | ||
|
|
||
| ## Maintenance Note | ||
|
|
||
| If you update guidance in copilot-instructions.md that affects C# development, ensure consistency across all related instruction files. | ||
|
|
||
| ## Decision Trees for Complex Scenarios | ||
|
|
||
| ### Multi-File/Feature Change Flowchart | ||
|
|
||
| 1. **Identify all affected file types** | ||
| 2. **For each file type:** | ||
| - Locate and read the corresponding instruction file | ||
| - Note any validation, documentation, or escalation requirements | ||
| 3. **Plan the change:** | ||
| - List all files to be edited | ||
| - Determine order of operations (e.g., code first, then docs, then config) | ||
| - Identify dependencies between files | ||
| 4. **Edit files in logical order** | ||
| 5. **After each file edit:** | ||
| - Run required validation (build, test, lint, etc.) | ||
| - Document evidence as required | ||
| 6. **After all edits:** | ||
| - Re-run all tests and validations | ||
| - Update documentation and release notes as needed | ||
| - Prepare a comprehensive PR description with evidence for each file type | ||
| 7. **If blocked or uncertain at any step:** | ||
| - Escalate by tagging @repo-maintainers | ||
|
|
||
| ### Introducing a New Analyzer or Code Fix Flowchart | ||
|
|
||
| 1. **Read csharp.instructions.md and project.instructions.md** | ||
| 2. **Scaffold the new analyzer/fixer in the correct directory** | ||
| 3. **Add or update unit tests (see test instructions)** | ||
| 4. **Update documentation:** | ||
| - Add/modify rule docs in docs/rules/ | ||
| - Update AnalyzerReleases.Unshipped.md | ||
| 5. **Update project files if needed** | ||
| 6. **Run all validations (build, test, lint, Codacy, etc.)** | ||
| 7. **Prepare PR with validation evidence for each file type** | ||
| 8. **If any diagnostic span or test fails more than once, STOP and escalate** | ||
| 9. **If uncertain about Roslyn APIs, Moq semantics, or workflow, escalate** | ||
|
|
||
| ## Test Data & Sample Inputs/Outputs | ||
|
|
||
| ### What Constitutes Good Test Data? | ||
| - Cover all code paths: positive, negative, and edge cases | ||
| - Include both minimal and complex/realistic examples | ||
| - Test for invalid inputs, exceptions, and boundary conditions | ||
| - Include performance-sensitive scenarios if relevant | ||
| - For analyzers/code fixes: test all diagnostic locations, fix applications, and no-fix scenarios | ||
|
|
||
| ### Coverage Strategy | ||
| - For every new analyzer/code fix, include: | ||
| - At least one positive, one negative, and one edge case test | ||
| - Data-driven tests for all fixable patterns | ||
| - Performance test if analyzer is non-trivial | ||
| - Document test data rationale in comments or PR description |
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,49 @@ | ||
| --- | ||
| applyTo: '.editorconfig' | ||
| --- | ||
|
|
||
| **Critical Rules:** Always read this file before editing. Never skip validation steps. All changes must be fully validated, documented, and reviewed. If you are uncertain or blocked, escalate immediately by tagging @repo-maintainers. Failure to follow these rules may result in PR rejection. | ||
|
|
||
| # .editorconfig Instructions (Quick Reference) | ||
|
|
||
| - **Read this file before editing .editorconfig** | ||
| - **Complete the Validation Checklist before submitting** | ||
| - **Escalate if blocked or uncertain** | ||
|
|
||
| ## Context Loading for Copilot | ||
|
|
||
| When working on this file, you MUST: | ||
| 1. Read this entire instruction file before making any changes | ||
| 2. Validate your understanding by checking the "Validation Checklist" section | ||
| 3. If uncertain about any requirement, stop and request clarification | ||
|
|
||
| **Escalation Path:** | ||
| If you (AI or human) are blocked or cannot proceed, leave a comment in the PR describing the blocked step and tag @repo-maintainers for escalation. | ||
|
|
||
| ## Validation Checklist | ||
|
|
||
| Before submitting any changes, verify: | ||
| - [ ] All formatting and linting rules are correct and documented | ||
| - [ ] All changes are compatible with project coding standards | ||
| - [ ] All affected files are re-formatted and linted | ||
| - [ ] Machine-readable evidence is attached (see below) | ||
| - [ ] PR description includes validation evidence and checklist | ||
|
|
||
| ## Validation Evidence Requirements | ||
| - Attach a log section titled `## EditorConfig Validation Log` showing the output of `dotnet format` or equivalent | ||
| - Include a checklist like: | ||
| - [x] All files formatted | ||
| - [x] Lint clean | ||
| - Paste CI run link under `## CI Evidence` | ||
|
|
||
| ## .editorconfig Guidance | ||
| - .editorconfig controls code formatting and linting for the repository | ||
| - Changes may affect build results, code reviews, and CI | ||
| - Only update rules when necessary and after confirming with maintainers | ||
| - After changes, run `dotnet format` and ensure no formatting/linting errors | ||
| - Document any rule changes in the PR description | ||
|
|
||
| ## Related Instruction Files | ||
| - [csharp.instructions.md](csharp.instructions.md) - For C# code formatting | ||
| - [markdown.instructions.md](markdown.instructions.md) - For markdown formatting | ||
| - [project.instructions.md](project.instructions.md) - For build configuration |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Mixed Framework Versions in Documentation
Conflicting .NET and C# target framework versions are specified across the documentation.
copilot-instructions.mdcontains internal inconsistencies (referencing both .NET 8/C# 12 and .NET 9/C# 13), and these contradictions extend to other instruction files likeproject.instructions.mdandjson.instructions.md. This creates confusion for developers and AI agents regarding the correct target framework.Locations (3)
.github/copilot-instructions.md#L4-L25.github/instructions/project.instructions.md#L33-L34.github/instructions/json.instructions.md#L181-L182Fix in Cursor • Fix in Web