Skip to content

Add AI coding guidelines for GitHub Copilot and Cursor#529

Merged
SRombauts merged 2 commits intomasterfrom
add-copilot-instructions
Jan 24, 2026
Merged

Add AI coding guidelines for GitHub Copilot and Cursor#529
SRombauts merged 2 commits intomasterfrom
add-copilot-instructions

Conversation

@SRombauts
Copy link
Owner

  • Add .github/copilot-instructions.md with project-specific coding guidelines for AI assistants (GitHub Copilot, Cursor, etc.)
  • Add Cursor rule (.cursor/rules/load-github-copilot-instructions.mdc) to ensure the guidelines are loaded before any coding task
  • Update .editorconfig charset to latin1 for compatibility with existing source files

Add comprehensive documentation for AI coding assistants covering project overview, architecture, coding conventions, build systems, testing patterns, and Git workflow.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds AI coding guidelines documentation to help GitHub Copilot, Cursor, and similar AI assistants follow project-specific conventions. The PR creates a comprehensive coding guide in .github/copilot-instructions.md with non-negotiables, workflows, build instructions, naming conventions, and code examples. It also adds a Cursor rule to ensure the guidelines are loaded before any coding task, and changes the .editorconfig charset setting from utf-8 to latin1.

Changes:

  • Added comprehensive AI coding guidelines document with RAII principles, exception handling rules, C++ version constraints, naming conventions, build commands, and code examples
  • Added Cursor rule to automatically load the guidelines before any coding task
  • Changed .editorconfig charset from utf-8 to latin1

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/copilot-instructions.md New comprehensive coding guidelines for AI assistants covering non-negotiables, workflows, build instructions, naming conventions, file templates, and API examples
.cursor/rules/load-github-copilot-instructions.mdc New Cursor rule configuration to ensure copilot-instructions.md is read before any coding task
.editorconfig Changed charset from utf-8 to latin1 for compatibility with source files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Public API must have Doxygen: `@brief`, `@param`, `@return`, `@throw`.
- Tests required for new functionality in `tests/`.
- Portability: Windows, Linux, macOS.
- Style: ASCII only, 4 spaces, Allman braces, max 120 chars, LF line endings, final newline, `#pragma once`.
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guideline states "Allman braces" but the actual codebase consistently uses K&R style braces (opening brace on the same line). For example, see src/Database.cpp:72-75, src/Statement.cpp:58-62, src/Column.cpp:32-36, and src/Transaction.cpp:50-63. All of these show opening braces on the same line as the function declaration or control statement, not on a new line. This guideline should be corrected to reflect the actual convention used throughout the codebase.

Copilot uses AI. Check for mistakes.
.editorconfig Outdated
# 4 space indentation
[*]
charset = latin1
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing charset from utf-8 to latin1 is problematic and conflicts with both the guideline in copilot-instructions.md (which states "ASCII only") and the actual codebase. The README.md file contains UTF-8 characters (e.g., "Sébastien" on line 25), and source files contain standard ASCII-compatible UTF-8. The guideline should either be "utf-8" (which is the modern standard and what was previously configured) or if truly ASCII-only is desired, the existing non-ASCII characters in the codebase should be addressed first. Latin1 is a legacy encoding that doesn't match modern development practices or the stated "ASCII only" goal.

Suggested change
charset = latin1
charset = utf-8

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,34 @@
---
description: MANDATORY - Read .github/copilot-instructions.md before ANY coding task in this SQLiteCpp project.
globs:
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The front matter syntax appears to be incorrect. The "globs:" field on line 3 is missing a value. According to Cursor rules file format, this field should either have a list of glob patterns or be omitted entirely if using "alwaysApply: true". Since this rule should apply to all files (as indicated by "alwaysApply: true"), the "globs:" line should either be removed or should have an empty list value like "globs: []".

Suggested change
globs:
globs: []

Copilot uses AI. Check for mistakes.
- RAII only. Acquire in constructors, release in destructors.
- NEVER throw in destructors. Use `SQLITECPP_ASSERT()` instead.
- Errors: use `SQLite::Exception` for throwing APIs; `tryExec()`, `tryExecuteStep()`, `tryReset()` return SQLite codes.
- C++11 only in core library. C++14 only in `VariadicBind.h` and `ExecuteMany.h`.
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guideline states "C++14 only in VariadicBind.h" but this is misleading. VariadicBind.h contains both C++11 code (the basic variadic bind function, see lines 47-54 in include/SQLiteCpp/VariadicBind.h) and C++14 code (the tuple-based functions, see lines 56-96). Only the tuple-based functionality requires C++14. Consider clarifying this as "C++14 only in ExecuteMany.h; VariadicBind.h has both C++11 (variadic bind) and C++14 (tuple bind) features" or similar.

Suggested change
- C++11 only in core library. C++14 only in `VariadicBind.h` and `ExecuteMany.h`.
- C++11 only in core library. C++14 only in `ExecuteMany.h`; `VariadicBind.h` has both C++11 (variadic bind) and C++14 (tuple bind) features.

Copilot uses AI. Check for mistakes.
Ensures Cursor AI reads the coding guidelines file before any coding task, since the @files directive doesn't reliably inject file content.
@SRombauts SRombauts force-pushed the add-copilot-instructions branch from 85eb2b0 to a9d117e Compare January 24, 2026 21:31
@SRombauts SRombauts merged commit b6fcb54 into master Jan 24, 2026
32 of 34 checks passed
@SRombauts SRombauts deleted the add-copilot-instructions branch January 24, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant