Instruction file imported from MCPRUNNER/mssqlMCP (
.github/instructions/tsql.instructions.md). Copyright stays with the author.
T-SQL Instructions
General Guidelines
- Use clear and concise language.
- Follow the T-SQL coding conventions.
- Ensure all code is well-documented using standard SQL comments (
--for single-line and/* ... */for multi-line). - Implement error handling with try catch
- Add logging where appropriate.
- Use meaningful names for variables, tables, and other database objects.
- Optimize queries for performance and efficiency.
- Use transactions where necessary to maintain data integrity.
- Include comments to explain complex logic or business rules.
- Follow best practices for security, such as avoiding SQL injection.
- Use CTEs (Common Table Expressions) for better readability in complex queries.
- Ensure proper indexing strategies are considered in query design.
- Use schema prefixes for all database objects to avoid ambiguity.
- Format SQL code for better readability (indentation, line breaks, etc.).
- Use appropriate data types for columns to optimize storage and performance.
- Regularly review and refactor SQL code to improve performance and maintainability.
- Use column names in INSERT statements for clarity and to avoid errors.
- Avoid using SELECT * in queries; specify the required columns instead.