Skip to content

Commit 3718002

Browse files
committed
Replace .cusor/rules/sqlitecpp-skills-routing.mdc by AGENTS.md
It's much more generic and should be loaded by most AI agents out there, but not by Github Copilot extensions in VS and Rider Mention AGENTS.md and skills in the README.md
1 parent 8c995bb commit 3718002

3 files changed

Lines changed: 109 additions & 38 deletions

File tree

.cursor/rules/sqlitecpp-skills-routing.mdc

Lines changed: 0 additions & 23 deletions
This file was deleted.

AGENTS.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# SQLiteCpp AI Agents Custom Instructions
2+
3+
## Project Overview
4+
- SQLiteCpp is a C++11 RAII wrapper around SQLite3 C APIs
5+
- Minimal dependencies: C++11 STL + SQLite3
6+
- Cross-platform: Windows, Linux, macOS
7+
- Thread-safe at SQLite multi-thread level
8+
9+
## Maintaining This Documentation
10+
11+
**IMPORTANT:** When the user explains how to do something, corrects your behavior, or points out errors:
12+
1. **Update AGENTS.md** for universal SQLiteCpp constraints and best practices, or to correct guidance in this file.
13+
2. **Update skills** for task-specific guidance (build, testing, documentation, etc.), or to correct and extend
14+
skill content.
15+
16+
**Goal:** Keep this documentation accurate and comprehensive so future sessions benefit from corrections and
17+
clarifications.
18+
19+
## Core Non-Negotiables (MUST Follow)
20+
21+
1. **RAII only**: Acquire resources in constructors, release in destructors
22+
2. **Never throw in destructors**: Use `SQLITECPP_ASSERT()` instead
23+
3. **C++11 core library**: C++14 only in VariadicBind.h and ExecuteMany.h
24+
4. **Public API isolation**: Headers must NOT include sqlite3.h
25+
5. **Export macros**: Public API must use `SQLITECPP_API` from SQLiteCppExport.h
26+
6. **Threading constraint**: One Database/Statement/Column per thread
27+
7. **Tests required**: New functionality must have tests in tests/
28+
8. **Portability**: Code must work on Windows, Linux, and macOS
29+
9. **Const correctness**: Use `const` for methods that don't modify object state, `const&` for read-only parameters
30+
31+
## Error Handling
32+
- Throw `SQLite::Exception` for errors in throwing APIs
33+
- Use `tryExec()`, `tryExecuteStep()`, `tryReset()` for error codes
34+
- In destructors: use `SQLITECPP_ASSERT()` never throw
35+
36+
## Code Style
37+
- 4 spaces (no tabs)
38+
- Allman braces style
39+
- LF line endings (Unix style)
40+
- Final newline at end of file
41+
- `#pragma once` in headers
42+
43+
## Naming Conventions
44+
45+
| Element | Convention | Example |
46+
|---------|------------|---------|
47+
| Types | PascalCase | `Database`, `Statement`, `TransactionBehavior` |
48+
| Functions/vars | camelCase | `executeStep()`, `getColumn()`, `getErrorCode()` |
49+
| Member variables | `m` prefix | `mDatabase`, `mQuery`, `mStmt` |
50+
| Function arguments | `a` prefix | `aDatabase`, `aQuery`, `aFilename` |
51+
| Boolean variables | `b`/`mb` prefix | `bExists`, `mbDone`, `mbReadOnly` |
52+
| Pointer variables | `p`/`mp` prefix | `pValue`, `mpSQLite`, `mpStmt` |
53+
| Constants | ALL_CAPS | `OPEN_READONLY`, `SQLITE_OK` |
54+
55+
## Documentation Requirements
56+
- Doxygen required for all public API
57+
- ASCII only in code and comments
58+
- Max 120 characters per line
59+
60+
## Repository Structure
61+
```
62+
include/SQLiteCpp/ # Public headers
63+
src/ # Implementation files
64+
tests/ # Unit tests (*_test.cpp)
65+
sqlite3/ # Bundled SQLite3 source
66+
examples/ # Example applications
67+
```
68+
69+
## Key Classes
70+
- `Database`: Connection management and database operations
71+
- `Statement`: Prepared statement execution
72+
- `Column`: Result column access
73+
- `Exception`: Error handling
74+
75+
## Use skills for task guidance
76+
Skills live under `.claude/skills/`. Load the relevant skill(s) based on the task:
77+
- `sqlitecpp-coding-standards`: core library edits, public API rules, style and naming.
78+
- `sqlitecpp-workflow`: add methods/classes, tests, build file updates, changelog.
79+
- `sqlitecpp-git-branching`: branch creation and naming rules.
80+
- `sqlitecpp-build-cmake`: CMake builds, options, tests.
81+
- `sqlitecpp-build-meson`: Meson builds, options, tests.
82+
- `sqlitecpp-ci-workflows`: CI config updates and build matrices.
83+
- `sqlitecpp-doxygen-guide`: Doxygen standards and public API documentation.
84+
- `sqlitecpp-testing-practices`: GoogleTest patterns and test structure.
85+
- `sqlitecpp-troubleshooting`: compiler/linker/build issues.
86+
- `sqlitecpp-sqlite-flags`: SQLite/SQLiteCpp feature flags.

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The "CMakeLists.txt" file defining the static library is provided in the root di
9999
so you simply have to add_subdirectory(SQLiteCpp) to you main CMakeLists.txt
100100
and link to the "SQLiteCpp" wrapper library.
101101

102-
Example for Linux:
102+
Example for Linux:
103103
```cmake
104104
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/thirdparty/SQLiteCpp)
105105
@@ -110,7 +110,7 @@ target_link_libraries(main
110110
pthread
111111
dl
112112
)
113-
```
113+
```
114114
Thus this SQLiteCpp repository can be directly used as a Git submodule.
115115
See the [SQLiteCpp_Example](https://github.com/SRombauts/SQLiteCpp_Example) side repository for a standalone "from scratch" example.
116116

@@ -144,7 +144,7 @@ The SQLiteCpp port in vcpkg is kept up to date by Microsoft team members and com
144144

145145
#### Using SQLiteCpp on a system-wide installation
146146

147-
If you installed this package to your system, a `SQLiteCppConfig.cmake` file will be generated & installed to your system.
147+
If you installed this package to your system, a `SQLiteCppConfig.cmake` file will be generated & installed to your system.
148148
This file lets you link against the SQLiteCpp library for use in your Cmake project.
149149

150150
Here's an example of using this in your CMakeLists.txt
@@ -205,7 +205,7 @@ Arch Linux:
205205
sudo pacman -Syu clang ninja
206206
# install python and pip (required for meson)
207207
sudo pacman -Syu python python-pip
208-
# install meson
208+
# install meson
209209
pip install meson
210210
```
211211

@@ -224,7 +224,7 @@ for example you can build the library using the default options with:
224224

225225
```sh
226226
# setup the build directory
227-
meson setup builddir
227+
meson setup builddir
228228
# build sqlitecpp
229229
meson compile -C builddir
230230
```
@@ -276,6 +276,14 @@ You can:
276276
- or turn off the `option(SQLITE_ENABLE_COLUMN_METADATA "Enable Column::getColumnOriginName(). Require support from sqlite3 library." ON)` in [CMakeFiles.txt](CMakeFiles.txt) (or other build system scripts)
277277
- or turn on the `option(SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON)` in [CMakeFiles.txt](CMakeFiles.txt)
278278

279+
### AI Coding Assistance
280+
281+
SQLiteCpp includes instructions for AI coding assistants:
282+
- [`AGENTS.md`](AGENTS.md): base custom instructions for all tasks
283+
- [`.claude/skills/`](.claude/skills/): specialized skills for focused topics and workflows
284+
285+
These files help AI assistants understand SQLiteCpp's coding standards, architecture, and best practices.
286+
279287
### Continuous Integration
280288

281289
This project is continuously tested under Ubuntu Linux with the gcc and clang compilers
@@ -315,28 +323,28 @@ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose b
315323
or uncoment the line at the end of [build.sh](build.sh)
316324

317325
## Examples
318-
### The first sample demonstrates how to query a database and get results:
326+
### The first sample demonstrates how to query a database and get results:
319327

320328
```C++
321329
try
322330
{
323331
// Open a database file
324332
SQLite::Database db("example.db3");
325-
333+
326334
// Compile a SQL query, containing one parameter (index 1)
327335
SQLite::Statement query(db, "SELECT * FROM test WHERE size > ?");
328-
336+
329337
// Bind the integer value 6 to the first parameter of the SQL query
330338
query.bind(1, 6);
331-
339+
332340
// Loop to execute the query step by step, to get rows of result
333341
while (query.executeStep())
334342
{
335343
// Demonstrate how to get some typed column value
336344
int id = query.getColumn(0);
337345
const char* value = query.getColumn(1);
338346
int size = query.getColumn(2);
339-
347+
340348
std::cout << "row: " << id << ", " << value << ", " << size << std::endl;
341349
}
342350
}
@@ -375,8 +383,8 @@ catch (std::exception& e)
375383
### The third sample shows how to manage a prepared statement with a transaction:
376384

377385
```C++
378-
try
379-
{
386+
try
387+
{
380388
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
381389

382390
db.exec("DROP TABLE IF EXISTS test");
@@ -454,8 +462,8 @@ See bellow a short comparison of other wrappers done at the time of writing:
454462
- [sqdbcpp](http://code.google.com/p/sqdbcpp/): RAII design, simple, no dependencies, UTF-8/UTF-16, new BSD license
455463
- [sqlite3cc](http://ed.am/dev/sqlite3cc): uses boost, modern design, LPGPL
456464
- [sqlite3pp](https://github.com/iwongu/sqlite3pp): modern design inspired by boost, MIT License
457-
- [SQLite++](http://sqlitepp.berlios.de/): uses boost build system, Boost License 1.0
458-
- [CppSQLite](http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/): famous Code Project but old design, BSD License
459-
- [easySQLite](http://code.google.com/p/easysqlite/): manages table as structured objects, complex
465+
- [SQLite++](http://sqlitepp.berlios.de/): uses boost build system, Boost License 1.0
466+
- [CppSQLite](http://www.codeproject.com/Articles/6343/CppSQLite-C-Wrapper-for-SQLite/): famous Code Project but old design, BSD License
467+
- [easySQLite](http://code.google.com/p/easysqlite/): manages table as structured objects, complex
460468
- [sqlite_modern_cpp](https://github.com/keramer/sqlite_modern_cpp): modern C++11, all in one file, MIT license
461469
- [sqlite_orm](https://github.com/fnc12/sqlite_orm): modern C++14, header only all in one file, no raw string queries, BSD-3 license

0 commit comments

Comments
 (0)