microsoft / microsoft/vscode-mssql

[Feature Request]: Respect SSMS database instructions in the VS Code MSSQL extension

Open
#21,952 0 comments 0 reactions 0 assignees View on GitHub
Area - GitHub Copilot Enhancement User-filed
Dominant language
TypeScript
Stars
1.9k
Forks
610
Avg merge
2d 3h
Merged PRs (30d)
97

Description

### Feature Description

I would like the MSSQL extension for VS Code to read and apply the database instructions model already introduced in SQL Server Management Studio (SSMS).

Official documentation: https://learn.microsoft.com/en-us/ssms/github-copilot/database-instructions

According to the official SSMS documentation, database instructions provide GitHub Copilot with database-specific context and guidance that lives directly in the database. Database owners and teams can use them to describe business rules, data conventions, and usage patterns. The documentation also states that these instructions act as living documentation that travels with the database and is automatically applied during Copilot interactions.

In SSMS, this model supports both:
- database-wide guidance through a constitution, using CONSTITUTION.md
- object-level guidance through extended properties named AGENTS.md

This is very valuable because it allows teams to store guidance close to the data itself, such as:
- database-wide rules and conventions
- object-specific usage guidance
- business meaning and interpretation of a table
- safety requirements for write operations
- naming, filtering, or data-handling conventions

The VS Code MSSQL extension should retrieve and respect these instructions automatically when connected to that database, so Copilot-generated queries, explanations, and suggestions follow the same rules already defined in SSMS.

Ideally, there should also be a clear precedence model between:
1. CONSTITUTION.md at database level
2. AGENTS.md at object level
3. VS Code custom instructions

This would provide consistency across Microsoft’s official SQL Server tools and make the SSMS feature actually useful in mixed-tool environments.

### Problem and Motivation

Currently, I can define database-level and object-level instructions in SSMS, but those instructions are not consulted or respected by the MSSQL extension in VS Code.

This is especially problematic because the official documentation describes database instructions as metadata stored in the database, automatically discovered and applied at runtime, and as living documentation that travels with the database. That promise currently breaks when developers use VS Code instead of SSMS.

This creates a fragmented and inconsistent experience across Microsoft’s own SQL Server tooling. A team may invest time in defining rules and guidance in the database, expecting them to be reused by official clients, but developers working from VS Code do not benefit from them at all.

This is not equivalent to the existing custom instructions feature in VS Code. VS Code custom instructions are editor or workspace scoped. SSMS database instructions are database scoped and travel with the database itself. That is a very important difference.

These database-scoped instructions can define rules that are specific to the environment and data model, for example:
- mandatory safety requirements for write queries
- business meaning and interpretation of a table
- object-specific usage guidance
- conventions that should be shared by all developers connected to the same database

Without support in VS Code, the value of the SSMS implementation is heavily reduced. Teams cannot rely on a single source of truth for AI guidance, and behavior differs depending on whether a developer works from SSMS or VS Code.

With this feature, I could define the rules once at the database level and expect both SSMS and the MSSQL extension in VS Code to guide developers consistently and safely.

At the moment, this makes the SSMS feature much less useful than it should be, because the instructions are only effective in one Microsoft tool and ignored in another.

Expected behavior: when a connection is opened, the MSSQL extension should discover available CONSTITUTION.md and AGENTS.md instructions from extended properties and inject them into the Copilot context automatically.

### Related Area

- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [ ] Query editor
- [ ] Query results panel
- [ ] Object Explorer
- [x] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [ ] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [ ] SQL Database projects
- [ ] Query Plan Visualizer
- [ ] Other (please describe below)

### If you selected "Other", please describe the area

_No response_

### Confirmation

- [x] I have searched existing feature requests and couldn't find a match
- [ ] I want to help implement this feature

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the GitHub Copilot integration and the connection-open flow described in the issue. Review how the extension currently builds Copilot context, then determine how to discover CONSTITUTION.md and AGENTS.md from database metadata and define precedence with VS Code custom instructions. Done means database- and object-level guidance is automatically applied consistently to generated queries, explanations, and suggestions.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript, vscode
Domain
ai, databases, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.