@m-velikov/cpp-quick-start-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +156 -0
  3. package/build/index.d.ts +3 -0
  4. package/build/index.d.ts.map +1 -0
  5. package/build/index.js +146 -0
  6. package/build/index.js.map +1 -0
  7. package/data/best-practices-bazel/SKILL.md +28 -0
  8. package/data/best-practices-cmake/SKILL.md +39 -0
  9. package/data/best-practices-code-review/SKILL.md +34 -0
  10. package/data/best-practices-conan/SKILL.md +28 -0
  11. package/data/best-practices-cpp/SKILL.md +38 -0
  12. package/data/best-practices-gtest/SKILL.md +30 -0
  13. package/data/best-practices-meson/SKILL.md +34 -0
  14. package/data/best-practices-refactoring/SKILL.md +28 -0
  15. package/data/best-practices-vcpkg/SKILL.md +27 -0
  16. package/data/meta-quickstart/SKILL.md +104 -0
  17. package/data/scaffold-agents/SKILL.md +68 -0
  18. package/data/scaffold-base-configs/SKILL.md +71 -0
  19. package/data/scaffold-bazel/SKILL.md +65 -0
  20. package/data/scaffold-clang-tidy/SKILL.md +37 -0
  21. package/data/scaffold-cmake/SKILL.md +50 -0
  22. package/data/scaffold-cmake-presets/SKILL.md +114 -0
  23. package/data/scaffold-code-quality/SKILL.md +58 -0
  24. package/data/scaffold-conan/SKILL.md +46 -0
  25. package/data/scaffold-doctest/SKILL.md +50 -0
  26. package/data/scaffold-github-actions/SKILL.md +29 -0
  27. package/data/scaffold-gitlab-ci/SKILL.md +30 -0
  28. package/data/scaffold-gtest/SKILL.md +53 -0
  29. package/data/scaffold-make/SKILL.md +62 -0
  30. package/data/scaffold-meson/SKILL.md +49 -0
  31. package/data/scaffold-pitchfork-layout/SKILL.md +60 -0
  32. package/data/scaffold-pre-commit/SKILL.md +33 -0
  33. package/data/scaffold-vcpkg/SKILL.md +50 -0
  34. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Momchil Velikov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # C++ Quick Start MCP Server
2
+
3
+ [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289da?logo=discord&logoColor=white)](https://discord.gg/qrhuftYXs4)
4
+
5
+ This is a **Model Context Protocol (MCP)** server that equips any compatible AI assistant (Antigravity, Cursor, Claude Desktop, etc.) with the ability to expertly scaffold cross-platform C++ projects.
6
+
7
+ Instead of writing boilerplate from scratch (and hallucinating build system rules), this MCP server acts as an interactive "Knowledge Base". It guides the AI through a structured interview process and then provides it with exact, proven templates for CMake, Conan, vcpkg, GitHub Actions, and standard directory layouts.
8
+
9
+ ## Features
10
+
11
+ - **The `meta-quickstart` Prompt**: Initiates an interactive interview with the developer to determine the exact C++ stack (Standard, Build System, Package Manager, CI/CD, Coding Style, etc.).
12
+ - **Dynamic Scaffolding Resources**: Provides the AI with deep, instructional markdown resources (`mcp://scaffold/conan`, `mcp://scaffold/github-actions`, etc.) so it knows exactly how to write the requested boilerplate files perfectly.
13
+ - **Agent-Ready Architecture**: When you run the prompt, your C++ project will be automatically configured for modern agentic development. It seeds your project with built-in guidelines and architecture rules so future AI agents know exactly how to collaborate on your codebase safely and predictably.
14
+
15
+ ## Installation
16
+
17
+ Ensure you have Node.js and `npm` installed.
18
+
19
+ ### Install via NPM (Recommended)
20
+
21
+ You can install the server directly from the official npm registry:
22
+
23
+ ```bash
24
+ npm install -g @m-velikov/cpp-quick-start-mcp
25
+ ```
26
+
27
+ ### Install from Source (Local Development)
28
+
29
+ If you are cloning this repository to build it locally:
30
+
31
+ 1. Install dependencies:
32
+ ```bash
33
+ npm install
34
+ ```
35
+ 2. Build the server:
36
+ ```bash
37
+ npm run build
38
+ ```
39
+ 3. Install the package globally from the local directory:
40
+ ```bash
41
+ npm install -g .
42
+ ```
43
+
44
+ Once installed via either method, the `cpp-quick-start-mcp` command will be available system-wide.
45
+
46
+ ### Starting the Server (Optional)
47
+
48
+ If you want to run the server standalone over HTTP/SSE instead of standard I/O:
49
+
50
+ ```bash
51
+ # Start with default options (port 3000, host 0.0.0.0)
52
+ cpp-quick-start-mcp --port 3000
53
+ ```
54
+
55
+ _The server binds to all interfaces (`0.0.0.0`) on port `3000` by default._
56
+
57
+ ## Connecting to an AI Agent
58
+
59
+ This server supports **Dual Transport** (both `stdio` for local clients and `sse` for remote clients).
60
+
61
+ ### 1. Local Connection (stdio) - DEFAULT
62
+
63
+ For local IDE clients, you can connect directly without running an HTTP server. Since you installed the package globally, you can use the `cpp-quick-start-mcp` command directly.
64
+
65
+ _(Note: On Windows, use `cpp-quick-start-mcp.cmd` as the command instead of `cpp-quick-start-mcp` in the JSON configurations below)._
66
+
67
+ #### Antigravity IDE
68
+
69
+ 1. Open the MCP Store by clicking the "..." dropdown at the top of the editor's side panel or agent panel, and select **MCP Servers**.
70
+ 2. Click **Manage MCP Servers**, then select **View raw config** to edit your `mcp_config.json` file.
71
+ 3. Add the following to your configuration:
72
+ ```json
73
+ "mcpServers": {
74
+ "cpp-quick-start": {
75
+ "command": "cpp-quick-start-mcp",
76
+ "args": []
77
+ }
78
+ }
79
+ ```
80
+ Alternatively, simply ask the Antigravity agent: "Add the cpp-quick-start-mcp server to my configuration".
81
+
82
+ #### Codex
83
+
84
+ Codex uses a TOML file for configuration instead of JSON.
85
+
86
+ 1. Open your `~/.codex/config.toml` file (or `.codex/config.toml` in your project folder).
87
+ 2. Add the server entry:
88
+ ```toml
89
+ [mcp.servers.cpp-quick-start]
90
+ command = "cpp-quick-start-mcp"
91
+ args = []
92
+ ```
93
+ Alternatively, use the Codex CLI:
94
+
95
+ ```bash
96
+ codex mcp add cpp-quick-start -- cpp-quick-start-mcp
97
+ ```
98
+
99
+ #### Claude Code
100
+
101
+ 1. You can add the MCP server directly via the Claude Code CLI using the following command:
102
+ ```bash
103
+ claude mcp add-json cpp-quick-start '{"type":"stdio","command":"cpp-quick-start-mcp","args":[]}'
104
+ ```
105
+ 2. Or you can manually edit your `claude.json` configuration file and add the JSON block shown in the Antigravity section.
106
+ 3. Restart Claude Code or verify active servers with `claude mcp list`.
107
+
108
+ #### GitHub Copilot
109
+
110
+ 1. In Visual Studio Code, open the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) and type **MCP: Add Server**.
111
+ 2. Follow the guided flow, using `cpp-quick-start-mcp` as the command.
112
+ 3. Alternatively, manually edit your global `~/.copilot/mcp-config.json` or project-scoped `.mcp/copilot/mcp.json` file and add the JSON configuration block.
113
+ 4. Ensure you are in "Agent mode" in your Copilot chat interface to interact with your added MCP tools.
114
+
115
+ ### 2. Remote Connection (SSE)
116
+
117
+ If you start the server using `--port`, it will automatically switch to HTTP/SSE transport mode. This is extremely useful if you are building a custom MCP client (using the `@modelcontextprotocol/sdk` client library) or deploying the server to the cloud.
118
+
119
+ _Note: Not all IDEs (like Antigravity or Cursor) currently support configuring remote SSE servers via their `mcp.json` files yet. For those IDEs, you must use the Local Connection (`stdio`) method above._
120
+
121
+ Example configuration for a custom web client:
122
+
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "cpp-quick-start": {
127
+ "type": "sse",
128
+ "url": "http://localhost:3000/mcp"
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ ## Usage
135
+
136
+ ### New Projects
137
+
138
+ Once connected, simply open an empty folder in your editor/terminal and tell your AI assistant:
139
+
140
+ > "Run the **meta-quickstart** prompt to help me start a new C++ project."
141
+
142
+ The AI will take over, interview you, and generate your custom C++ boilerplate.
143
+
144
+ ### Existing Projects
145
+
146
+ You can also use this MCP server to configure an existing project for agentic development. Open your existing project folder and tell your AI assistant:
147
+
148
+ > "Use your scaffolding resources to configure this existing C++ project for agentic development (e.g., adding an AGENTS.md, setting up GitHub Actions, or integrating a package manager)."
149
+
150
+ The AI will read the exact blueprints from the MCP server and cleanly integrate them into your existing codebase.
151
+
152
+ ## Community
153
+
154
+ Got questions, ideas, or need help setting up your C++ environment? Come hang out with us on Discord!
155
+
156
+ [Join the Discord Server](https://discord.gg/YOUR_INVITE_LINK)
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/build/index.js ADDED
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env node
2
+ import { serve } from "@hono/node-server";
3
+ import { Hono } from "hono";
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
6
+ import { ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ErrorCode, McpError, } from "@modelcontextprotocol/sdk/types.js";
7
+ import * as fs from "fs/promises";
8
+ import * as path from "path";
9
+ import { fileURLToPath } from "url";
10
+ import crypto from "crypto";
11
+ import { parseArgs } from "node:util";
12
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
13
+ const DATA_DIR = path.join(__dirname, "..", "data");
14
+ const server = new Server({
15
+ name: "cpp-quick-start-mcp",
16
+ version: "1.0.0",
17
+ }, {
18
+ capabilities: {
19
+ prompts: {},
20
+ resources: {},
21
+ },
22
+ });
23
+ // Resources: serve all SKILL.md files inside data/ folders
24
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
25
+ const dirs = await fs.readdir(DATA_DIR);
26
+ const resources = [];
27
+ for (const dir of dirs) {
28
+ if (dir === "meta-quickstart")
29
+ continue; // Expose meta-quickstart as a Prompt, not a Resource
30
+ const skillPath = path.join(DATA_DIR, dir, "SKILL.md");
31
+ try {
32
+ await fs.access(skillPath);
33
+ resources.push({
34
+ uri: `mcp://scaffold/${dir}`,
35
+ name: `C++ Scaffolding Skill: ${dir}`,
36
+ mimeType: "text/markdown",
37
+ description: `Instructions for scaffolding ${dir}`,
38
+ });
39
+ }
40
+ catch (e) {
41
+ // Ignore directories without SKILL.md
42
+ }
43
+ }
44
+ return { resources };
45
+ });
46
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
47
+ const uri = request.params.uri;
48
+ const match = uri.match(/^mcp:\/\/scaffold\/(.+)$/);
49
+ if (!match) {
50
+ throw new McpError(ErrorCode.InvalidRequest, `Invalid URI: ${uri}`);
51
+ }
52
+ const skillName = path.basename(match[1]);
53
+ const skillPath = path.join(DATA_DIR, skillName, "SKILL.md");
54
+ try {
55
+ const content = await fs.readFile(skillPath, "utf-8");
56
+ return {
57
+ contents: [
58
+ {
59
+ uri,
60
+ mimeType: "text/markdown",
61
+ text: content,
62
+ },
63
+ ],
64
+ };
65
+ }
66
+ catch (error) {
67
+ throw new McpError(ErrorCode.InvalidRequest, `Resource not found: ${uri}`);
68
+ }
69
+ });
70
+ // Prompts: expose the meta-quickstart interview
71
+ server.setRequestHandler(ListPromptsRequestSchema, async () => {
72
+ return {
73
+ prompts: [
74
+ {
75
+ name: "meta-quickstart",
76
+ description: "Conducts the C++ quick start interview to determine project stack.",
77
+ arguments: [],
78
+ },
79
+ ],
80
+ };
81
+ });
82
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
83
+ if (request.params.name !== "meta-quickstart") {
84
+ throw new McpError(ErrorCode.InvalidRequest, `Prompt not found: ${request.params.name}`);
85
+ }
86
+ const metaSkillPath = path.join(DATA_DIR, "meta-quickstart", "SKILL.md");
87
+ try {
88
+ const content = await fs.readFile(metaSkillPath, "utf-8");
89
+ return {
90
+ description: "C++ Meta-Scaffold Interview Workflow",
91
+ messages: [
92
+ {
93
+ role: "user",
94
+ content: {
95
+ type: "text",
96
+ text: content,
97
+ },
98
+ },
99
+ ],
100
+ };
101
+ }
102
+ catch (error) {
103
+ throw new McpError(ErrorCode.InternalError, "Failed to load meta-quickstart instructions");
104
+ }
105
+ });
106
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
107
+ async function main() {
108
+ const { values } = parseArgs({
109
+ args: process.argv.slice(2),
110
+ options: {
111
+ port: { type: "string", short: "p" },
112
+ host: { type: "string", short: "h" },
113
+ stdio: { type: "boolean" },
114
+ },
115
+ });
116
+ const PORT = values.port
117
+ ? parseInt(values.port, 10)
118
+ : process.env.PORT
119
+ ? parseInt(process.env.PORT, 10)
120
+ : undefined;
121
+ // If --stdio is passed (or no port is specified), use stdio.
122
+ if (values.stdio || !PORT) {
123
+ console.error("Starting C++ Quick Start MCP Server on stdio...");
124
+ const transport = new StdioServerTransport();
125
+ await server.connect(transport);
126
+ return;
127
+ }
128
+ // Otherwise, use SSE/Hono
129
+ const transport = new WebStandardStreamableHTTPServerTransport({
130
+ sessionIdGenerator: () => crypto.randomUUID(),
131
+ });
132
+ await server.connect(transport);
133
+ const app = new Hono();
134
+ app.all("/mcp", async (c) => {
135
+ return transport.handleRequest(c.req.raw);
136
+ });
137
+ const HOST = values.host ?? process.env.HOST ?? "0.0.0.0";
138
+ console.log(`Starting C++ Quick Start MCP Server on http://${HOST}:${PORT}/mcp ...`);
139
+ serve({
140
+ fetch: app.fetch,
141
+ port: PORT,
142
+ hostname: HOST,
143
+ });
144
+ }
145
+ main().catch(console.error);
146
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AACzH,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,SAAS,EACT,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,EAAE;KACd;CACF,CACF,CAAC;AAEF,2DAA2D;AAC3D,MAAM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,SAAS,GAAG,IAAI,wCAAwC,CAAC;QAC7D,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE;KAC9C,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1B,OAAO,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC;IAE1D,OAAO,CAAC,GAAG,CACT,iDAAiD,IAAI,IAAI,IAAI,UAAU,CACxE,CAAC;IACF,KAAK,CAAC;QACJ,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: best-practices-bazel
3
+ description: Best practices for building C++ projects with Bazel.
4
+ ---
5
+
6
+ # Bazel Best Practices
7
+
8
+ When building C++ components with Bazel, strictly adhere to the following principles:
9
+
10
+ ## 1. Granular Targets
11
+
12
+ - Prefer small, granular `cc_library` targets over monolithic ones. This maximizes caching and parallelization.
13
+ - Ensure that every header file is associated with at least one `cc_library` using the `hdrs` attribute.
14
+
15
+ ## 2. Dependency Management
16
+
17
+ - Declare external dependencies using Bzlmod (`MODULE.bazel`). Avoid the legacy `WORKSPACE` file where possible.
18
+ - Use `bazel dep` commands or manually edit `MODULE.bazel` to specify third-party libraries.
19
+
20
+ ## 3. Visibility
21
+
22
+ - Restrict visibility using `visibility = ["//visibility:private"]` or specific package lists.
23
+ - Expose targets via `//visibility:public` only when they are intended to be consumed by arbitrary external packages.
24
+
25
+ ## 4. Include Paths
26
+
27
+ - Use `strip_include_prefix` or `include_prefix` if you need to manipulate header paths.
28
+ - Avoid using `copts = ["-I..."]` for include paths; rely on the native `includes` attribute or proper dependency propagation.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: best-practices-cmake
3
+ description: Best practices for using Modern CMake in C++ projects.
4
+ ---
5
+
6
+ # CMake Best Practices
7
+
8
+ When working with CMake in this project, adhere to the following modern, target-based CMake practices:
9
+
10
+ ## 1. Target-Based Approach
11
+
12
+ - **Do not use global state.** Avoid functions like `include_directories()`, `link_directories()`, and `add_definitions()`.
13
+ - Use `target_include_directories()`, `target_link_libraries()`, and `target_compile_definitions()` exclusively.
14
+ - Define visibility explicitly: `PRIVATE`, `PUBLIC`, or `INTERFACE`.
15
+
16
+ ## 2. Setting C++ Standards
17
+
18
+ Set the C++ standard strictly on a per-target basis using `target_compile_features`. Do not use global state like `CMAKE_CXX_STANDARD` unless absolutely required by a legacy dependency.
19
+
20
+ ```cmake
21
+ target_compile_features(<target_name> PUBLIC cxx_std_20)
22
+ ```
23
+
24
+ ## 3. Project Structure
25
+
26
+ - Split your build files. Avoid large, monolithic top-level `CMakeLists.txt` files.
27
+ - Use `add_subdirectory()` to include sub-components.
28
+ - Keep `CMakeLists.txt` close to the source files they build.
29
+
30
+ ## 4. Testing
31
+
32
+ - Use `enable_testing()` at the root level.
33
+ - Include testing directories only if tests are enabled (e.g., `if(BUILD_TESTING)`).
34
+ - Register tests using `add_test(NAME <test_name> COMMAND <test_executable>)`.
35
+
36
+ ## 5. CMake Presets
37
+
38
+ - Use `CMakePresets.json` to standardize configure, build, and test commands across environments.
39
+ - This gives AI agents and developers simple, single-line commands (e.g., `cmake --preset dev`, `cmake --build --preset dev`) and avoids command-line hallucination or environment-specific friction.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: best-practices-code-review
3
+ description: Best practices for performing automated code reviews in C++.
4
+ ---
5
+
6
+ # Code Review Best Practices
7
+
8
+ When tasked with reviewing code, the agent MUST follow these guidelines to provide constructive, actionable feedback:
9
+
10
+ ## 1. Style and Formatting
11
+
12
+ - Verify that the code complies with the project's chosen coding style (e.g., Google, LLVM) and naming conventions.
13
+ - Check if the code passes automated formatters like `clang-format`.
14
+
15
+ ## 2. Modern C++ Usage
16
+
17
+ - Look for opportunities to use modern C++ features (e.g., `auto`, range-based for loops, `std::unique_ptr`/`std::shared_ptr` over raw pointers).
18
+ - Ensure resource management uses RAII principles.
19
+
20
+ ## 3. Correctness and Safety
21
+
22
+ - Check for potential memory leaks, dangling references, or uninitialized variables.
23
+ - Verify that error handling is robust (e.g., appropriate use of exceptions or expected types).
24
+ - Look out for thread-safety issues if concurrency is involved.
25
+
26
+ ## 4. Test Coverage
27
+
28
+ - Ensure that any new functionality is accompanied by corresponding unit tests.
29
+ - Verify that bug fixes include a regression test.
30
+
31
+ ## 5. Feedback Format
32
+
33
+ - Be specific and constructive. Provide code snippets to demonstrate suggested improvements.
34
+ - Categorize feedback into "Critical/Blocking" and "Nitpicks/Optional".
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: best-practices-conan
3
+ description: Best practices for using Conan 2.x for dependency management.
4
+ ---
5
+
6
+ # Conan Best Practices
7
+
8
+ Follow these best practices when managing C++ dependencies via Conan:
9
+
10
+ ## 1. Declarative Requirements
11
+
12
+ - Use a `conanfile.py` exclusively to declare requirements, even for simple consuming projects. Do not use `conanfile.txt` as it limits flexibility in Conan 2.x.
13
+ - Specify versions clearly (e.g., `requires = "zlib/1.3.1"`).
14
+
15
+ ## 2. Options and Settings
16
+
17
+ - Define options and settings explicitly in your profiles, rather than passing them continuously on the command line.
18
+ - Always provide a `build_type` (e.g., Debug or Release) to ensure ABI compatibility.
19
+
20
+ ## 3. Generators
21
+
22
+ - Use the modern `CMakeDeps` and `CMakeToolchain` generators to integrate with CMake seamlessly.
23
+ - Avoid legacy generators like `cmake` or `cmake_multi`.
24
+ - Let `CMakeToolchain` generate the `conan_toolchain.cmake` file, and pass it to CMake configure: `-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake`.
25
+
26
+ ## 4. Reproducible Builds
27
+
28
+ - Generate and commit a `conan.lock` lockfile for stable and reproducible builds across developer machines and CI.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: best-practices-cpp
3
+ description: General C++ programming best practices based on the C++ Core Guidelines.
4
+ ---
5
+
6
+ # C++ Best Practices (Core Guidelines)
7
+
8
+ When writing or modifying C++ code in this project, strictly adhere to the philosophies outlined in the official [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md).
9
+
10
+ ## 1. Resource Management (RAII)
11
+
12
+ - Avoid naked `new` and `delete`. Use `std::make_unique` and `std::make_shared` for dynamic allocation.
13
+ - Use smart pointers (`std::unique_ptr`, `std::shared_ptr`) or containers (like `std::vector`) to manage ownership.
14
+ - Never pass a smart pointer unless the function needs to manipulate the ownership itself. Pass by reference (`T&`) or `const` reference (`const T&`) otherwise.
15
+
16
+ ## 2. Interfaces
17
+
18
+ - Make interfaces explicit. Do not hide dependencies or rely on global state.
19
+ - Consistently use `const`. If a function does not modify an argument, pass it as `const T&`. If a member function does not modify state, mark it `const`.
20
+ - Use `std::optional` or `std::expected` for functions that might fail to return a value, rather than out-parameters or ambiguous return codes.
21
+
22
+ ## 3. Modern Language Features
23
+
24
+ - Use `auto` to avoid redundant type names, but keep types explicit when it improves readability.
25
+ - Prefer range-based `for` loops over index-based loops.
26
+ - Prefer using `constexpr` and `consteval` for values and functions that can be evaluated at compile time.
27
+ - Prefer `<ranges>` and range-based algorithms (like `std::ranges::find_if`) over `<algorithm>` and iterator-based algorithms where possible, and prefer both over writing raw loops.
28
+ - Use `std::span` when passing read-only views of contiguous memory instead of passing raw pointers/sizes or `const std::vector&`.
29
+
30
+ ## 4. Safety and Error Handling
31
+
32
+ - Use exceptions for error handling unless the project is explicitly compiled without them.
33
+ - Throw by value, catch by reference.
34
+ - Apply `noexcept` consistently for functions that are guaranteed not to throw exceptions (especially move constructors and destructors).
35
+ - Use `[[nodiscard]]` on functions where ignoring the return value is likely a bug (e.g., error codes).
36
+ - Avoid C-style raw arrays; use `std::array` or `std::vector`. When creating `std::array`s, prefer `std::to_array` to deduce the array length automatically instead of hardcoding it (e.g., `auto arr = std::to_array({1, 2, 3});`).
37
+
38
+ These guidelines ensure the code remains safe, performant, and maintainable across the entire project.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: best-practices-gtest
3
+ description: Best practices for writing C++ tests with Google Test.
4
+ ---
5
+
6
+ # Google Test (GTest) Best Practices
7
+
8
+ Follow these guidelines when writing unit and integration tests using GTest:
9
+
10
+ ## 1. Test Organization
11
+
12
+ - Mirror the source directory structure in the `tests/` directory.
13
+ - Use `TEST(TestSuiteName, TestName)` for simple standalone tests.
14
+ - Use `TEST_F(TestFixtureName, TestName)` when multiple tests share the same setup and teardown logic via a fixture class.
15
+
16
+ ## 2. Assertions
17
+
18
+ - Prefer `EXPECT_*` over `ASSERT_*` when you want the test to continue running after a failure.
19
+ - Use `ASSERT_*` only when a failure means subsequent code in the test will crash or behave completely unpredictably.
20
+ - Provide descriptive failure messages by streaming into the macro: `EXPECT_EQ(a, b) << "Values should match because...";`
21
+
22
+ ## 3. Naming Conventions
23
+
24
+ - Test suite names should describe the component being tested (e.g., `StringUtilsTest`).
25
+ - Test names should describe the specific scenario or behavior being verified (e.g., `HandlesEmptyStrings`).
26
+
27
+ ## 4. Mocking
28
+
29
+ - Use gMock (`MOCK_METHOD`) to mock interfaces when testing components in isolation.
30
+ - Verify expectations explicitly using `EXPECT_CALL` before invoking the code under test.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: best-practices-meson
3
+ description: Best practices for building C++ projects with Meson.
4
+ ---
5
+
6
+ # Meson Best Practices
7
+
8
+ When using Meson for your build system, follow these practices:
9
+
10
+ ## 1. Structured Build Files
11
+
12
+ - Use `meson.build` at the root and include subdirectories using `subdir('dirname')`.
13
+ - Keep the root `meson.build` clean, primarily defining the project, global compiler arguments, and including subdirectories.
14
+
15
+ ## 2. Compiler Flags
16
+
17
+ - Set C++ dialects (e.g., C++20) using `default_options: ['cpp_std=c++20']` within the `project()` definition.
18
+ - Use `add_project_arguments()` to specify project-wide compiler warnings. Avoid hardcoding specific GCC or Clang flags without checking compiler IDs, e.g.:
19
+
20
+ ```meson
21
+ cpp = meson.get_compiler('cpp')
22
+ if cpp.get_id() == 'gcc' or cpp.get_id() == 'clang'
23
+ add_project_arguments('-Wextra', '-Werror', language : 'cpp')
24
+ endif
25
+ ```
26
+
27
+ ## 3. Dependencies
28
+
29
+ - Use `dependency('libname')` to find system libraries via pkg-config or CMake.
30
+ - Use Meson's WrapDB for third-party dependencies by placing `.wrap` files in the `subprojects/` directory. Use `fallback` in `dependency()` to gracefully use a wrap if the system package is not found.
31
+
32
+ ## 4. Testing
33
+
34
+ - Register tests using the `test('test_name', executable_target)` command.
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: best-practices-refactoring
3
+ description: Best practices for safely refactoring C++ code.
4
+ ---
5
+
6
+ # Refactoring Best Practices
7
+
8
+ When an agent is tasked with refactoring code in this project, it MUST adhere to the following protocol:
9
+
10
+ ## 1. Prerequisites
11
+
12
+ - **Ensure a Clean State**: Before making any changes, compile the project and run the entire test suite. Do not begin refactoring if tests are currently failing.
13
+
14
+ ## 2. Atomic Commits
15
+
16
+ - Perform refactoring in small, atomic, and verifiable steps.
17
+ - Avoid changing functionality and refactoring structure at the same time.
18
+
19
+ ## 3. Directory and Layout Compliance
20
+
21
+ - When moving files, strictly adhere to the project's directory layout (e.g., Pitchfork layout).
22
+ - Move header files to the appropriate `include/` directory and source files to `src/`.
23
+
24
+ ## 4. Verification
25
+
26
+ - After moving files or renaming symbols, update all relevant `#include` paths.
27
+ - Re-run the build and the test suite after _each_ atomic step to catch regressions immediately.
28
+ - Use `clang-tidy` or similar linters to ensure the new structure doesn't introduce code quality issues.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: best-practices-vcpkg
3
+ description: Best practices for using vcpkg for dependency management.
4
+ ---
5
+
6
+ # vcpkg Best Practices
7
+
8
+ When integrating vcpkg for dependency management, follow these best practices:
9
+
10
+ ## 1. Use Manifest Mode
11
+
12
+ - Always use `vcpkg.json` (Manifest mode) instead of classic mode to declare dependencies. This ensures that dependencies are version-controlled alongside your code.
13
+ - Avoid running `vcpkg install` manually. Let CMake drive the installation during the configure step via the toolchain file.
14
+
15
+ ## 2. Toolchain Integration
16
+
17
+ - Ensure CMake uses the vcpkg toolchain file by passing `-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake`.
18
+ - For multi-platform setups, consider wrapping the toolchain configuration in an IDE preset (e.g., `CMakePresets.json`).
19
+
20
+ ## 3. Searching and Adding Dependencies
21
+
22
+ - Ensure that you read the port usage notes after installation (vcpkg prints these out). They often contain the exact `find_package` and `target_link_libraries` commands needed.
23
+ - Always use `find_package(<package> CONFIG REQUIRED)` if supported by the package.
24
+
25
+ ## 4. Reproducibility
26
+
27
+ - Create a `vcpkg-configuration.json` to pin baseline versions. This ensures that all developers and CI runners are using the exact same versions of the dependencies.