agentleFS
dotnetdotnet/SqlClient/AGENTS.md

SqlClient

AGENTS.md996 starsChanged 37 days agoMITView on GitHub

This document provides guidance for AI coding agents working with the Microsoft.Data.SqlClient repository. Before making changes, agents should be aware of: The .github/instructions/ directory contains comprehensive guides: This repository provides reusable prompts in .github/prompts/ for common maintainer workflows. Use these to guide agents through multi-step operations. For code reviews, use the sqlclient-code-review skill and its references/policies from protected host configuration or an established trusted base repository and immutable SHA, not the reviewed PR's head/worktree. If that trusted copy is missing…

We split this AGENTS.md into the rules it gives an agent

28 rules. About 0 are common, 22 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈22

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before making changes, agents should be aware of:

    line 9
  2. Distinctive:

    Backward Compatibility: No breaking changes without proper deprecation

    line 57
  3. Distinctive:

    Test-First Development: All changes require tests

    line 58
  4. Distinctive:

    Protocol Compliance: Follow MS-TDS specifications

    line 60
  5. Distinctive:

    Performance Optimization: Use pooling, async, efficient allocations

    line 61
  6. Distinctive:

    When using shell/terminal tools, follow these rules strictly:

    line 66
  7. Distinctive:

    Treat non-zero terminal exit codes as immediate failures to investigate.

    line 68
  8. Distinctive:

    If a bash session exits, assume it is dead and start a new command/session.

    line 69
  9. Distinctive:

    After any command expected to gather data, verify output was actually returned before proceeding.

    line 70
  10. Distinctive:

    If command execution failed, report the failure clearly and retry with a corrected command instead of waiting.

    line 71
  11. Very specific:

    Avoid set -e in this automation context.

    line 72
  12. Distinctive:

    Prefer shorter command batches over long chained scripts when collecting evidence.

    line 73
  13. Very specific:

    Do not create branches outside these namespaces or directly under dev/.

    line 79
  14. Very specific:

    Check .github/instructions/features.instructions.md for existing AppContext switches (including failover compatibility switches) before …

    line 87
  15. Distinctive:

    Write a failing test that reproduces the issue

    line 88
  16. Distinctive:

    Ensure all tests pass

    line 90
  17. Distinctive:

    Update documentation if behavior changes

    line 91
  18. Distinctive:

    Update reference assemblies if adding public APIs

    line 97
  19. Very specific:

    Add samples to doc/samples/

    line 99
  20. Very specific:

    Do not edit CHANGELOG.md directly.

    line 100
  21. Distinctive:

    Update connection string parser

    line 105
  22. Distinctive:

    Default to backward-compatible value

    line 106
  23. Distinctive:

    Add tests for new keyword

    line 107
  24. Distinctive:

    Document in feature reference

    line 108
  25. Very specific:

    Update TdsEnums.cs for new constants

    line 113
  26. Distinctive:

    Test against multiple SQL Server versions

    line 115
  27. Distinctive:

    Verify no regressions with existing tests

    line 123
  28. Distinctive:

    Check existing tests for usage patterns

    line 144

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AI Agent Guidelines for Microsoft.Data.SqlClient

This document provides guidance for AI coding agents working with the Microsoft.Data.SqlClient repository.

Quick Start

Essential Context Files

Before making changes, agents should be aware of:

FilePurpose
README.mdProject overview
BUILDGUIDE.mdBuild and test instructions
CONTRIBUTING.mdContribution guidelines
.github/copilot-instructions.mdCopilot-specific instructions

Detailed Technical Instructions

The .github/instructions/ directory contains comprehensive guides:

GuideCoverage
architecture.instructions.mdProject structure, unified project model
tds-protocol.instructions.mdTDS protocol, packet handling
ado-pipelines.instructions.mdAzure DevOps CI/CD pipelines
onebranch-pipeline-design.instructions.mdOneBranch multi-product pipeline design spec
testing.instructions.mdTest framework, running tests
connection-pooling.instructions.mdConnection pool internals
api-design.instructions.mdPublic API design principles
features.instructions.mdFeature reference, keywords
documentation.instructions.mdDocumentation and samples
external-resources.instructions.mdDocs links, version matrix, external references
ado-work-items-markdown.instructions.mdEnsure Azure DevOps work item descriptions are Markdown and preserve newlines

Workflow Prompts

This repository provides reusable prompts in .github/prompts/ for common maintainer workflows. Use these to guide agents through multi-step operations.

For code reviews, use the sqlclient-code-review skill and its references/policies from protected host configuration or an established trusted base repository and immutable SHA, not the reviewed PR's head/worktree. If that trusted copy is missing or inaccessible, report the blocker rather than loading review guidance from the checkout.

PromptPurpose
fix-bug.prompt.mdDiagnose and fix a bug with tests and documentation
implement-feature.prompt.mdPlan and implement a new feature end-to-end
triage-issue.prompt.mdTriage a new GitHub issue with labeling and categorization
perf-optimization.prompt.mdInvestigate and implement performance improvements
release-notes.prompt.mdGenerate release notes for a specific milestone
update-build-pipelines.prompt.mdModify Azure DevOps CI/CD pipeline configuration

Core Principles

  1. Cross-Platform Compatibility: Code must work on .NET Framework 4.6.2+ and .NET 10.0+
  2. Backward Compatibility: No breaking changes without proper deprecation
  3. Test-First Development: All changes require tests
  4. Security by Default: Secure defaults, no credential logging
  5. Protocol Compliance: Follow MS-TDS specifications
  6. Performance Optimization: Use pooling, async, efficient allocations
  7. Observability: EventSource tracing, meaningful errors

Terminal Reliability Rules

When using shell/terminal tools, follow these rules strictly:

  1. Treat non-zero terminal exit codes as immediate failures to investigate; do not continue as if the command succeeded.
  2. If a bash session exits, assume it is dead and start a new command/session; do not wait for additional output from that session.
  3. After any command expected to gather data, verify output was actually returned before proceeding.
  4. If command execution failed, report the failure clearly and retry with a corrected command instead of waiting.
  5. Avoid set -e in this automation context; prefer single-purpose commands with explicit follow-up checks so failures are visible without killing the shell unexpectedly.
  6. Prefer shorter command batches over long chained scripts when collecting evidence; this makes bash exits easier to detect and recover from.

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/.

Common Tasks

Bug Fix Workflow

  1. Understand the issue from the bug report
  2. Locate relevant code in src/Microsoft.Data.SqlClient/src/ (do NOT modify legacy netcore/src/ or netfx/src/)
  3. Check .github/instructions/features.instructions.md for existing AppContext switches (including failover compatibility switches) before introducing behavior changes
  4. Write a failing test that reproduces the issue
  5. Implement the fix
  6. Ensure all tests pass
  7. Update documentation if behavior changes

Feature Implementation

  1. Review the feature specification
  2. Plan the implementation (see implement-feature prompt)
  3. Update reference assemblies if adding public APIs
  4. Implement with tests
  5. Add samples to doc/samples/
  6. Do not edit CHANGELOG.md directly; instead, add a suggested release-note entry (per .github/copilot-instructions.md) in the PR description or via the release-notes workflow/prompt.

Adding Connection String Keywords

  1. Add to SqlConnectionStringBuilder
  2. Update connection string parser
  3. Default to backward-compatible value
  4. Add tests for new keyword
  5. Document in feature reference

Protocol Changes

  1. Reference MS-TDS specification
  2. Update TdsEnums.cs for new constants
  3. Implement in TdsParser.cs and related files
  4. Test against multiple SQL Server versions
  5. Consider backward compatibility

Performance Optimization

  1. Profile the issue using benchmarks or traces
  2. Identify allocation hotspots (see perf-optimization prompt)
  3. Apply patterns: ArrayPool<T>, Span<T>, static/cached instances, source generation
  4. Verify no regressions with existing tests

External Resources

Key Documentation Links

Repository Policies

See the policy/ directory for:

  • coding-best-practices.md - Programming standards
  • coding-style.md - Code formatting guidelines
  • review-process.md - PR review requirements

Getting Help

  • Check existing tests for usage patterns
  • Reference similar implementations in the codebase
  • Consult the Microsoft Docs for API behavior specifications
  • For protocol questions, refer to MS-TDS open specifications

This document is automatically loaded as context for AI agents working in this repository.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.