SqlClient
Copilot instructions996 starsChanged 37 days agoMITView on GitHub
We split this copilot-instructions.md into the rules it gives an agent
53 rules. About 0 are common, 24 are distinctive, and 29 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈24
Distinctive · estimate
This author's own choices. Worth a look.
29
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 6
Writing Tests: Ensure all changes are covered by unit tests and integration tests.
- Distinctive: line 7
Documentation: Update documentation for public APIs, features, and usage examples.
- Distinctive: line 8
Pull Requests: Create and submit PRs for review, ensuring they follow project conventions and include necessary tests and documentation.
- Very specific: line 17
Implementations: All source code in src/Microsoft.Data.SqlClient/src/.
- Distinctive: line 67
When a new issue is created, follow these steps:
- Very specific: line 70
Update issue type as Bug, Feature, Task, or Epic if not done already, based on:
- Very specific: line 71
Use Bug for issues opened following ISSUE_TEMPLATE\bug-report.md template, and is complaining about an unexpected behavior.
- Very specific: line 72
Use Feature for issues opened following ISSUE_TEMPLATE\feature_request.md template, containing proposals to incorporate.
- Very specific: line 73
Use Task for issues opened as sub-issues.
- Very specific: line 74
Use Epic for issues acting as a high-level work linked to multiple sub-issues.
- Distinctive: line 75
Request Missing Information: If any required details are missing based on the issue template, ask the reporter to provide them.
- Very specific: line 77
Use Triage Needed :new: for new issues that need initial review.
- Very specific: line 78
Use Performance :chart_with_upwards_trend: for issues that are targeted to performance improvements/concerns.
- Very specific: line 79
Use Needs more info :information_source: for issues that require additional information.
- Distinctive: line 80
Link Related Issues: If the issue is related to other issues, link them for better context.
- Distinctive: line 83
Ask for any missing information.
- Very specific: line 86
Use the @ mention feature to notify relevant team members or stakeholders.
- Distinctive: line 92
Use the issue description to understand the problem and identify the root cause.
- Distinctive: line 93
If the issue is a bug, ensure you can reproduce it with the provided code sample.
- Distinctive: line 94
If the issue is a feature request, review the proposal and assess its feasibility.
- Distinctive: line 95
If the issue is a task, follow the instructions provided in the issue description.
- Distinctive: line 96
If the issue is an epic, break it down into smaller tasks or bugs and create sub-issues as needed.
- Very specific: line 98
If public APIs are changed, update corresponding ref/ projects.
- Very specific: line 99
Add or update tests in tests/ to validate the fix.
- Distinctive: line 104
Follow a test-driven approach: write failing tests before implementing fixes.
- Very specific: line 106
Use the existing test framework in the tests/ directory.
- Distinctive: line 107
Follow the naming conventions and structure of existing tests.
- Distinctive: line 108
Ensure tests are comprehensive and cover edge cases.
- Very specific: line 109
If the issue involves changes to public APIs, update the corresponding ref/ projects to reflect those changes.
- Very specific: line 110
Add sample code snippets in the 'doc/samples/' directory to demonstrate the new or fixed functionality and link them in the documentation …
- Very specific: line 113
All public documentation for APIs should be updated in the doc/ directories.
- Distinctive: line 114
When adding or changing XML docs, ensure they are clear and follow the existing style.
- Very specific: line 117
Use the Fixes #issue_number syntax in the PR description to automatically close the issue when the PR is merged.
- Very specific: line 119
Add [x] checkboxes for:
- Distinctive: line 124
Ensure the PR passes all CI checks before merging.
- Distinctive: line 127
Add a comment summarizing the fix and referencing the PR
- Very specific: line 137
Do not create branches outside these namespaces or directly under dev/.
- Very specific: line 140
All source code is in src/Microsoft.Data.SqlClient/src/.
- Very specific: line 142
Check for platform-specific differences using file suffixes (.netfx.cs, .netcore.cs, .windows.cs, .unix.cs) and conditional compilation …
- Distinctive: line 144
Do not introduce breaking changes without proper justification and documentation
- Very specific: line 145
Use the doc/ directory for any new documentation or updates to existing documentation
- Very specific: line 146
Use the tests/ directory for any new tests or updates to existing tests
- Very specific: line 147
Use the doc/samples/ directory for any new code samples or updates to existing samples
- Very specific: line 148
Use the policy/ directory for any new policies or updates to existing policies
- Very specific: line 151
Do not modify the CODEOWNERS file directly.
- Very specific: line 152
Do not modify CHANGELOG.md unless executing a release workflow (see release-notes prompt).
- Distinctive: line 153
Do not close issues without a fix or without providing a clear reason.
- Distinctive: line 156
Treat any non-zero shell exit code as a failed step that requires correction before proceeding.
- Distinctive: line 157
If a bash process exits, do not wait for more output from that process.
- Distinctive: line 159
When terminal execution fails, surface the failure immediately and retry with a corrected command.
- Very specific: line 160
Avoid set -e in this automation workflow.
- Distinctive: line 161
Prefer short, single-purpose terminal commands over long chained scripts when debugging or gathering state.
- Very specific: line 164
Update policies and guidelines in the policy/ directory as needed based on trending practices and team feedback.
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 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
GitHub Copilot Instructions for dotnet/SqlClient
🧑💻 Roles and Responsibilities
- Triage: Review new issues, categorize them, and assign them to appropriate team members.
- Fixing Issues: Address bugs, implement feature requests, and complete tasks as assigned.
- Writing Tests: Ensure all changes are covered by unit tests and integration tests.
- Documentation: Update documentation for public APIs, features, and usage examples.
- Pull Requests: Create and submit PRs for review, ensuring they follow project conventions and include necessary tests and documentation.
- Code Reviews: Review PRs from other contributors, providing feedback and suggestions for improvements.
- Continuous Improvement: Identify areas for improvement in the code base, documentation, and processes, and implement changes to enhance the project.
📚 Project Overview
This project is a .NET data provider for SQL Server, enabling .NET applications to interact with SQL Server databases. It supports various features like connection pooling, transaction management, and asynchronous operations.
The project builds from a single unified project at src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj, targeting net462;net10.0 (minimum runtime compatibility: .NET Framework 4.6.2 and .NET 10). Public API declarations are unified under src/Microsoft.Data.SqlClient/ref/; reference and unsupported-platform projects additionally preserve netstandard2.0. The legacy netfx/ and netcore/ directories are no longer used.
The project includes:
- Public APIs: Defined by
src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csprojand the reference source files beside it. - Implementations: All source code in
src/Microsoft.Data.SqlClient/src/. - Tests: Located in the
tests/directory, covering unit and integration tests.- Unit Tests: Located in
src/Microsoft.Data.SqlClient/tests/UnitTests/. - Functional Tests: Located in
src/Microsoft.Data.SqlClient/tests/FunctionalTests/. - Manual Tests: Located in
src/Microsoft.Data.SqlClient/tests/ManualTests/. - Performance/Stress Tests: Located in
src/Microsoft.Data.SqlClient/tests/PerformanceTests/andsrc/Microsoft.Data.SqlClient/tests/StressTests/.
- Unit Tests: Located in
- Documentation: Found in the
doc/directory, including API documentation, usage examples. - Policies: Contribution guidelines, coding standards, and review policies in the
policy/directory. - Building: The repo uses
build.projfor orchestrated build/test/pack workflows,src/Microsoft.Data.SqlClient.slnxfor solution-centric development tooling, and Azure DevOps YAML undereng/pipelines/pluseng/pipelines/onebranch/for CI and official release flows. SeeBUILDGUIDE.mdfor local build details. - CI/CD: ADO Pipelines for CI/CD and Pull request validation are defined in the
eng/directory, ensuring code quality and automated testing.
📦 Products
This project includes several key products and libraries that facilitate SQL Server connectivity and data access:
- Microsoft.Data.SqlClient: The primary library for SQL Server data access, providing a rich set of APIs for connecting to SQL Server databases, executing commands, and retrieving data.
- Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider: Enables Always Encrypted with Azure Key Vault integration, allowing SQL Server column encryption and decryption using keys managed in Azure Key Vault.
- Microsoft.SqlServer.Server: Supplies APIs for SQL Server-specific features, including user-defined types (UDTs) and SQL Server-specific attributes.
🛠️ Key Features
- Connectivity to SQL Server: Provides robust and secure connections to SQL Server databases, using various authentication methods, such as Windows Authentication, SQL Server Authentication, and Entra ID authentication, e.g.
ActiveDirectoryIntegrated,ActiveDirectoryPassword,ActiveDirectoryServicePrincipal,ActiveDirectoryInteractive,ActiveDirectoryDefault, andActiveDirectoryManagedIdentity. - Connection Resiliency: Implements connection resiliency features to handle transient faults and network issues, ensuring reliable database connectivity.
- TLS Encryption: Supports secure connections using TLS protocols to encrypt data in transit. Supports TLS 1.2 and higher, ensuring secure communication with SQL Server. Supported encryption modes are:
- Optional: Encryption is used if available, but not required.
- Mandatory: Encryption is mandatory for the connection.
- Strict: Enforces strict TLS requirements, ensuring only secure connections are established.
- TLS 1.3 Support: Supports TLS 1.3 for enhanced security and performance in data transmission when connecting with 'Strict' encryption mode.
- TDS Protocol: Implements the Tabular Data Stream (TDS) protocol for communication with SQL Server, supported protocol versions include TDS 7.4 and 8.0.
- Data Access: Supports executing SQL commands, retrieving data using
SqlDataReader, and managing data withSqlCommandandSqlConnectionobjects. - MultipleActiveResultSets (MARS): Supports Multiple Active Result Sets, allowing multiple active commands to be executed on a single connection.
- Asynchronous Operations: Supports async/await patterns for non-blocking database operations.
- Connection Pooling: Efficiently manages database connections in pools to improve performance.
- Transaction Management: Supports transaction management using local transaction management and Global transactions using MSDTC for data integrity and consistency.
- Parameterization: Supports prevention of SQL injection attacks by using parameterized queries.
- Data Types: Supports a wide range of SQL Server data types, including Json, Vector, custom types and UDTs.
- Data Encryption: Supports data encryption for secure data transmission.
- Logging and Diagnostics: Provides event source tracing diagnostic capabilities for troubleshooting.
- Failover Support: Handles automatic failover scenarios for high availability.
- Compatibility switch:
Switch.Microsoft.Data.SqlClient.UseLegacyFailoverAlternationOnLoginSqlErrors(defaultfalse) can restore legacy alternation behavior inLoginWithFailoverfor login-phase SQL errors.
- Compatibility switch:
- Cross-Platform Support: Compatible with .NET Framework 4.6.2+ on Windows and .NET 10+ on Windows, Linux, and macOS.
- Column Encryption AKV Provider: Supports Azure Key Vault (AKV) provider for acquiring keys from Azure Key Vault to be used for encryption and decryption.
🧩 SNI Implementations
There are two implementations of the SQL Server Network Interface (SNI) layer used in this project:
- Managed SNI: A managed implementation of SNI that is used in .NET 10+ environments. It provides cross-platform support for SQL Server connectivity.
- Native SNI: A native implementation of SNI that is used in .NET Framework and .NET Core environments on Windows. It's shipped as part of the
Microsoft.Data.SqlClient.SNIandMicrosoft.Data.SqlClient.SNI.Runtimepackages.- Microsoft.Data.SqlClient.SNI: This package provides the native SNI layer for .NET Framework applications.
- Microsoft.Data.SqlClient.SNI.Runtime: This package provides the native SNI layer for .NET Core applications on Windows.
📌 Instructions for Copilot
🐛 Triage Issues
When a new issue is created, follow these steps:
- Acknowledge Receipt: Respond within 48 hours to confirm the issue is being triaged.
- Set Issue Type:
- Update issue type as
Bug,Feature,Task, orEpicif not done already, based on:- Use
Bugfor issues opened followingISSUE_TEMPLATE\bug-report.mdtemplate, and is complaining about an unexpected behavior. - Use
Featurefor issues opened followingISSUE_TEMPLATE\feature_request.mdtemplate, containing proposals to incorporate. - Use
Taskfor issues opened as sub-issues. - Use
Epicfor issues acting as a high-level work linked to multiple sub-issues.
- Use
- Update issue type as
- Request Missing Information: If any required details are missing based on the issue template, ask the reporter to provide them.
- Labeling: Apply appropriate labels like
Area\Engineering,Area\Json,Area\AKV Provider,Area\Connection Pooling, etc. based on the issue content.- Use
Triage Needed :new:for new issues that need initial review. - Use
Performance :chart_with_upwards_trend:for issues that are targeted to performance improvements/concerns. - Use
Needs more info :information_source:for issues that require additional information.
- Use
- Link Related Issues: If the issue is related to other issues, link them for better context.
- Add Comments: As you triage issues, comment on the issue to:
- Confirm receipt and triage status.
- Ask for any missing information.
- Provide initial thoughts or questions to clarify the issue.
- Include links to relevant documentation or code examples.
- Use the
@mention feature to notify relevant team members or stakeholders.
🛠️ Fixing Issues
- Focus on issues assigned to you.
- For issues labeled
Needs more info :information_source:, ask for clarifications or additional details. - For issues labeled
Performance :chart_with_upwards_trend:, prioritize performance-related improvements. - Use the issue description to understand the problem and identify the root cause.
- If the issue is a bug, ensure you can reproduce it with the provided code sample.
- If the issue is a feature request, review the proposal and assess its feasibility.
- If the issue is a task, follow the instructions provided in the issue description.
- If the issue is an epic, break it down into smaller tasks or bugs and create sub-issues as needed.
- Cross-reference issue descriptions with code in
src/Microsoft.Data.SqlClient/src/. Do NOT add code to the legacynetfx/src/ornetcore/src/directories. - If public APIs are changed, update corresponding
ref/projects. - Add or update tests in
tests/to validate the fix.
🧪 Writing Tests
- For every bug fix, ensure there are unit tests and manual (integration) tests that cover the scenario.
- For new features, write tests that validate the functionality.
- Follow a test-driven approach: write failing tests before implementing fixes.
- Cover both sync and async code paths where the API exposes both variants (e.g.,
Open/OpenAsync,ExecuteReader/ExecuteReaderAsync). Sync and async implementations often differ internally. - Use the existing test framework in the
tests/directory. - Follow the naming conventions and structure of existing tests.
- Ensure tests are comprehensive and cover edge cases.
- If the issue involves changes to public APIs, update the corresponding
ref/projects to reflect those changes. - Add sample code snippets in the 'doc/samples/' directory to demonstrate the new or fixed functionality and link them in the documentation in
doc/folder.
📝 Documentation
- All public documentation for APIs should be updated in the
doc/directories. - When adding or changing XML docs, ensure they are clear and follow the existing style.
🔁 Creating Pull Requests
- Use the
Fixes #issue_numbersyntax in the PR description to automatically close the issue when the PR is merged. - Include a summary of the fix and link to the related issue
- Add
[x]checkboxes for:- Tests added or updated
- Public API changes documented
- Verified against customer repro (if applicable)
- Ensure no breaking changes introduced
- Ensure the PR passes all CI checks before merging.
✅ Closing Issues
- Add a comment summarizing the fix and referencing the PR
⚙️ Automating Workflows
- Auto-label PRs based on folder paths (e.g., changes in
src/Microsoft.Data.SqlClient/src/→Area\SqlClient, changes intests/→Area\Testing) and whether they add new public APIs or introduce a breaking change. - Suggest release note entries for fixes by updating files under
release-notes/or by using therelease-notesprompt (instead of editingCHANGELOG.mddirectly). - Tag reviewers based on
CODEOWNERSfile
🌿 Branch Naming
- Interactive agents, working under direct human guidance, may create and use branches under
dev/<name>/when the human specifies or approves the namespace and branch name (e.g.,dev/paul/aot/phase-1.1). - Autonomous agents, working without interactive human direction, must create branches under
dev/automation/(e.g.,dev/automation/fix-connection-timeout). - Do not create branches outside these namespaces or directly under
dev/.
🧠 Contextual Awareness
- All source code is in
src/Microsoft.Data.SqlClient/src/. Do NOT add code to legacynetfx/src/ornetcore/src/directories. - Public API changes must update the unified
src/Microsoft.Data.SqlClient/ref/sources for each affected target framework. - Check for platform-specific differences using file suffixes (
.netfx.cs,.netcore.cs,.windows.cs,.unix.cs) and conditional compilation (#if NETFRAMEWORK,#if NET,#if _WINDOWS,#if _UNIX). - Respect API compatibility rules across .NET versions
- Do not introduce breaking changes without proper justification and documentation
- Use the
doc/directory for any new documentation or updates to existing documentation - Use the
tests/directory for any new tests or updates to existing tests - Use the
doc/samples/directory for any new code samples or updates to existing samples - Use the
policy/directory for any new policies or updates to existing policies
Constraints
- Do not modify the
CODEOWNERSfile directly. - Do not modify
CHANGELOG.mdunless executing a release workflow (seerelease-notesprompt). - Do not close issues without a fix or without providing a clear reason.
Terminal Execution Safety
- Treat any non-zero shell exit code as a failed step that requires correction before proceeding.
- If a bash process exits, do not wait for more output from that process; rerun the command in a fresh terminal session.
- Validate that expected command output was produced before using it as evidence for conclusions.
- When terminal execution fails, surface the failure immediately and retry with a corrected command.
- Avoid
set -ein this automation workflow; use focused commands and verify each result explicitly so shell exits are observable and attributable. - Prefer short, single-purpose terminal commands over long chained scripts when debugging or gathering state.
📝 Notes
- Update policies and guidelines in the
policy/directory as needed based on trending practices and team feedback. - Regularly review and update the
doc/directory to ensure it reflects the current state of the project.
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,297 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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agentic-workflowsSkill
- fetch-milestone-prsSkill
- generate-mstest-filterSkill
- review-pr-feedbackSkill
- sqlclient-code-reviewSkill
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.

