agentleFS
MicrosoftKnown publishermicrosoft/sqlsimtools/sqlsim/.github/copilot-instructions.md

sqlsimtools / sqlsim

Copilot instructions42 starsChanged 32 days agoMITView on GitHub

On Ubuntu 24.04/26.04 LTS x64, use: The Ubuntu Release binary is build/linux-x64/sqlsim. Do not invoke CMake directly. For the Private Preview macOS Apple Silicon path, use: The Private Preview macOS ARM64 binary is build/macos-arm64/sqlsim. Do not invoke CMake directly. Treat macOS as invitation-only while customer and tester validation, live SQL testing, signing, and notarization decisions remain incomplete. On Windows, always use the build script to compile both architectures: Always use the build script to compile both architectures: Do NOT use…

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

27 rules. About 0 are common, 19 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use the build script to compile both architectures:

    line 25
  2. Distinctive:

    Do NOT use cmake, msbuild, or other build commands directly.

    line 29
  3. Very specific:

    CRITICAL: Always build both architectures (x64 and ARM64) by running .\build.ps1 without -Architecture.

    line 31
  4. Very specific:

    Use -Architecture x64 or -Architecture ARM64 to build only one architecture when the user explicitly requests it.

    line 33
  5. Distinctive:

    After a successful build, ask the user whether to run:

    line 39
  6. Very specific:

    Note: Always use -SkipBuild when running tests immediately after .\build.ps1 to avoid redundant rebuilds.

    line 43
  7. Very specific:

    When adding a live test, build its arguments from the suite's auth arguments and launch sqlsim through the suite's launcher (& $runSqlsim …

    line 45
  8. Distinctive:

    CRITICAL: Before running any command (build, test, or sqlsim.exe), ALWAYS check the VS Code terminal context first:

    line 54
  9. Very specific:

    Look at Last Command: to see what the user already ran

    line 55
  10. Very specific:

    Look at Exit Code: to see if it succeeded (0) or failed (non-zero)

    line 56
  11. Distinctive:

    Do NOT re-run commands the user has already executed successfully

    line 57
  12. Distinctive:

    If the user just ran a command, ask about the results or wait for them to share output instead of running it again

    line 58
  13. Distinctive:

    CRITICAL: Always use valid syntax when running sqlsim.

    line 62
  14. Distinctive:

    If Copilot skips this step, stop it immediately and ask: "What does your copilot-instructions say about this type of change?"

    line 147
  15. Distinctive:

    STOP: Search for ALL related occurrences FIRST: - Use grep/search to find everywhere the string or pattern appears:

    line 153
  16. Distinctive:

    STOP: Read documentation FIRST: - Check sqlsim.md BEFORE making changes to understand:

    line 161
  17. Distinctive:

    After ANY code change, you MUST:

    line 183
  18. Distinctive:

    Ask the user: "Should I run full-test-suite.ps1 -SkipBuild?"

    line 186
  19. Distinctive:

    Run the chosen test suite: - Do NOT consider a change complete until all tests pass.

    line 188
  20. Distinctive:

    Verify test counts: - If you add or remove tests, update the test counts in:

    line 190
  21. Very specific:

    Ask about publishing: - If you changed sqlsim.exe behavior OR sqlsim.md, ask the user: "Would you like to publish?

    line 199
  22. Very specific:

    Validate release package: - After publishing, if example scripts were changed, remind user: "Run .\test-nonazure-release-examples.ps1 to …

    line 202
  23. Distinctive:

    Evaluate README.md and BUILD.md: - If you changed smoke-test.ps1 or full-test-suite.ps1, check whether:

    line 206
  24. Distinctive:

    Test counts in README.md need updating

    line 207
  25. Distinctive:

    Test counts in BUILD.md need updating

    line 208
  26. Distinctive:

    Test descriptions need updating

    line 209
  27. Distinctive:

    Use cmake/msbuild directly (always use build.ps1)

    line 261

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

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

Copilot Instructions for sqlsim

Building the Code

On Ubuntu 24.04/26.04 LTS x64, use:

bash ./build-linux.sh
bash ./smoke-test-linux.sh --skip-build

The Ubuntu Release binary is build/linux-x64/sqlsim. Do not invoke CMake directly.

For the Private Preview macOS Apple Silicon path, use:

bash ./build-macos.sh
bash ./smoke-test-macos.sh --skip-build

The Private Preview macOS ARM64 binary is build/macos-arm64/sqlsim. Do not invoke CMake directly. Treat macOS as invitation-only while customer and tester validation, live SQL testing, signing, and notarization decisions remain incomplete.

On Windows, always use the build script to compile both architectures:

Always use the build script to compile both architectures:

.\build.ps1

Do NOT use cmake, msbuild, or other build commands directly.

CRITICAL: Always build both architectures (x64 and ARM64) by running .\build.ps1 without -Architecture. Do NOT use -Architecture x64 to build only one platform, even during iterative development. Both architectures must compile cleanly before testing.

Use -Architecture x64 or -Architecture ARM64 to build only one architecture when the user explicitly requests it.

  • x64: build\x64\Release\sqlsim.exe
  • ARM64: build\ARM64\Release\sqlsim.exe

Note: There is NO build\Release\ folder - always use the architecture-specific paths.

After a successful build, ask the user whether to run:

  • .\full-test-suite.ps1 -SkipBuild (comprehensive validation, ~15 seconds)
  • .\publish.ps1 (create release package for distribution)

Note: Always use -SkipBuild when running tests immediately after .\build.ps1 to avoid redundant rebuilds.

When adding a live test, build its arguments from the suite's auth arguments and launch sqlsim through the suite's launcher (& $runSqlsim or Invoke-Sqlsim in PowerShell, with_secret in Bash). The launcher hands the token or password over on stdin; calling the executable directly with the auth arguments fails, because -T - expects the secret on stdin. Add the test to the PowerShell and Bash suites together; scripts/check-suite-parity.ps1 checks.

Checking Terminal Output Before Acting

CRITICAL: Before running any command (build, test, or sqlsim.exe), ALWAYS check the VS Code terminal context first:

  • Look at Last Command: to see what the user already ran
  • Look at Exit Code: to see if it succeeded (0) or failed (non-zero)
  • Do NOT re-run commands the user has already executed successfully
  • If the user just ran a command, ask about the results or wait for them to share output instead of running it again

Running sqlsim for Testing/Debugging

CRITICAL: Always use valid syntax when running sqlsim. Authentication is REQUIRED.

Valid Command Patterns

# Minimal connection test (Windows Auth)
.\build\x64\Release\sqlsim.exe -S localhost -E

# Query with Windows Auth
.\build\x64\Release\sqlsim.exe -S localhost -E -Q "SELECT @@VERSION"

# Query with database specified
.\build\x64\Release\sqlsim.exe -S localhost -d testdb -E -Q "SELECT 1"

# Multiple threads/iterations
.\build\x64\Release\sqlsim.exe -S localhost -E -Q "SELECT 1" -n 4 -r 10

# Verbose mode
.\build\x64\Release\sqlsim.exe -S localhost -E -Q "SELECT 1" -v

# JSON output
.\build\x64\Release\sqlsim.exe -S localhost -E -Q "SELECT 1" -json

# Input file
.\build\x64\Release\sqlsim.exe -S localhost -E -i examples\sql\01-simple-queries.sql

# Quiet mode (suppress results)
.\build\x64\Release\sqlsim.exe -S localhost -E -Q "SELECT 1" -q

Authentication Options (one REQUIRED)

OptionDescription
-EWindows Authentication
-AMicrosoft Entra (interactive)
-A ActiveDirectoryMsiManaged Identity
-T <token>Access token
-U <user> -P <pass>SQL Authentication

Common Invalid Patterns (DO NOT USE)

# WRONG: Missing authentication
.\build\x64\Release\sqlsim.exe -S localhost -Q "SELECT 1"

# WRONG: Long option names not supported (except --help)
.\build\x64\Release\sqlsim.exe --server localhost

# WRONG: Unix-style double-dash options
.\build\x64\Release\sqlsim.exe --verbose

Getting Help

# Any of these show help:
.\build\x64\Release\sqlsim.exe
.\build\x64\Release\sqlsim.exe -h
.\build\x64\Release\sqlsim.exe -?
.\build\x64\Release\sqlsim.exe --help

Key Parameters

ParameterDescription
-S <server>Server name (defaults to localhost if omitted)
-d <database>Database name (optional)
-Q <query>Query string (use GO on own line for multiple batches)
-i <file>Input file with queries
-n <threads>Number of concurrent threads (default: 1)
-r <iterations>Iterations per thread (default: 1)
-vVerbose mode
-qQuiet mode
-jsonJSON output
-o <file>Output to file
-stoponerrorStop on first error

CRITICAL: Code Change Workflow (Follow This Order!)

⚠️ MANDATORY: Before ANY code change, say aloud:

"This change affects [type]. Per the dependency table, I must also update [list of files]."

If Copilot skips this step, stop it immediately and ask: "What does your copilot-instructions say about this type of change?"


BEFORE Editing Any Code:

  1. STOP: Search for ALL related occurrences FIRST - Use grep/search to find everywhere the string or pattern appears:

    • Source files (src/.cpp, include/.h)
    • Tests (smoke-test.ps1, full-test-suite.ps1)
    • Documentation (sqlsim.md, BUILD.md, README.md, SETUP.md)
    • Examples (examples/sql/.sql, examples/powershell/.ps1)

    List all files that will need changes BEFORE proceeding.

  2. STOP: Read documentation FIRST - Check sqlsim.md BEFORE making changes to understand:
    • Current sample outputs that may need updating
    • Feature descriptions that may need updating
    • Parameter tables that may need changes
    • Behavioral descriptions that may conflict with your changes

DURING Code Changes:

  1. Update ALL affected files in a SINGLE response (not separately):

    • Source code (src/.cpp, include/.h)
    • Tests (smoke-test.ps1, full-test-suite.ps1)
    • Documentation (sqlsim.md, BUILD.md, README.md, SETUP.md)
    • Examples (examples/sql/.sql, examples/powershell/.ps1)

    Do NOT wait for user to ask "what about docs?" - include them proactively.

AFTER Editing Code:

  1. Build and evaluate sqlsim.md:
    .\build.ps1
    After ANY code change, you MUST:
    • Build with .\build.ps1
    • Evaluate whether sqlsim.md needs updates (sample outputs, parameter docs, behavior descriptions)
    • Ask the user: "Should I run full-test-suite.ps1 -SkipBuild?"
  2. Run the chosen test suite - Do NOT consider a change complete until all tests pass.
  3. Verify test counts - If you add or remove tests, update the test counts in:
    • smoke-test.ps1 (header comment and output message)
    • BUILD.md (smoke test and full test suite counts)
    • README.md (test counts)

BEFORE Saying "Done":

  1. Review the dependency table below - For each type of change made, verify all dependent files were updated.
  2. Ask about publishing - If you changed sqlsim.exe behavior OR sqlsim.md, ask the user: "Would you like to publish? Run .\publish.ps1 to create a release package."
  3. Validate release package - After publishing, if example scripts were changed, remind user: "Run .\test-nonazure-release-examples.ps1 to validate the release package works correctly." For Azure testing: .\test-azure-release-examples.ps1 -ServerName <server>
  4. Evaluate README.md and BUILD.md - If you changed smoke-test.ps1 or full-test-suite.ps1, check whether:
  • Test counts in README.md need updating
  • Test counts in BUILD.md need updating
  • Test descriptions need updating

Key Dependencies (If X changes, update Y)

If you change...You MUST also update...
Output format/textTests that validate output, sqlsim.md sample outputs
Command-line parametersHelp text in main.cpp, sqlsim.md parameter tables, tests
JSON output fieldsJSON schema docs in sqlsim.md, JSON validation tests, examples/powershell/json-output-examples.ps1
Error messagesTests that expect specific error text
Terminology (e.g., "batches" vs "queries")ALL files - grep to find every occurrence
Examples in -? help texttest-examples.ps1, sqlsim.md, full-test-suite.ps1 example validation tests
Examples in sqlsim.mdtest-examples.ps1, full-test-suite.ps1 example validation tests
Examples folder (add/remove/rename)test-examples.ps1, sqlsim.md "Example Files" section, examples/README.md, release validation scripts
Example scripts in examples/powershell/*.ps1test-nonazure-release-examples.ps1, test-azure-release-examples.ps1
Report generators in examples/reports/*.ps1Encode JSON-derived HTML values and coerce JavaScript numbers; run test-reports.ps1
Test count (add/remove tests)smoke-test.ps1 header, BUILD.md test counts, README.md
Version numbersrc/main.cpp, sqlsim.md, README.md
Verbose vs non-verbose behaviorBoth text and JSON output paths, related tests

Security and Performance Review Threshold

After significant code changes, ask the user whether to run a security and performance review.

What triggers this prompt:

  • 3+ source files modified in a single session (src/.cpp, include/.h)
  • New feature added that involves user input, network, or file I/O
  • Authentication or connection handling changes
  • Memory management changes (allocations, buffers, string handling)
  • Concurrency/threading changes
  • Any change to ODBC calls or SQL execution paths

When threshold is met, ask:

"This session involved significant code changes ([list types: e.g., 'memory handling, threading, user input']). Would you like me to perform a security and performance review before we finalize?"

Security review checks:

  • Buffer overflow risks
  • SQL injection vectors
  • Input validation
  • Memory leaks
  • Credential handling
  • Error message information disclosure

Performance review checks:

  • Unnecessary allocations in hot paths
  • String copying vs. references
  • Connection pooling efficiency
  • Lock contention in multi-threaded code
  • I/O batching opportunities

Do NOT

  • Use cmake/msbuild directly (always use build.ps1)
  • Skip running full-test-suite.ps1 after code changes
  • Say "done" or "ready to publish" without verifying the dependency table above

Useful Grep Patterns

# Find all occurrences of a string across source, tests, and docs
Get-ChildItem -Recurse -Include *.cpp,*.h,*.ps1,*.md | Select-String "pattern"

# Find output format strings
Get-ChildItem -Recurse -Include *.cpp | Select-String "TS_OUT|std::cout"

# Find test expectations
Get-ChildItem -Include *.ps1 | Select-String "ExpectedOutput"

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.