Skip to content

docs: add AI assistant configuration guidelines#44

Merged
wambitz merged 3 commits intomainfrom
feature/40/ai-assistant-guidelines
Mar 12, 2026
Merged

docs: add AI assistant configuration guidelines#44
wambitz merged 3 commits intomainfrom
feature/40/ai-assistant-guidelines

Conversation

@wambitz
Copy link
Owner

@wambitz wambitz commented Mar 12, 2026

Summary

This pull request introduces comprehensive documentation for configuring AI code assistants in the project. It adds onboarding guides for both Claude Code and GitHub Copilot, detailing how to set up conventions, build workflows, and code style to ensure generated code matches project standards.

AI assistant configuration documentation:

  • Added docs/ai-assistant-guide.md, explaining how Claude Code and GitHub Copilot are configured for the project, including file purposes, command workflows, and customization tips.

Copilot instructions and code conventions:

  • Added .github/copilot-instructions.md, specifying code style, naming conventions, architectural patterns, build/test workflows, and CMake usage guidelines for Copilot-generated code.

Commits

Add onboarding documentation for AI pair programmers:

  • .github/copilot-instructions.md for GitHub Copilot context
  • docs/ai-assistant-guide.md explaining all AI config files

Closes #40

Add onboarding documentation for AI pair programmers:
- .github/copilot-instructions.md for GitHub Copilot context
- docs/ai-assistant-guide.md explaining all AI config files

Closes #40
@wambitz wambitz self-assigned this Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 01:05
@wambitz wambitz added the documentation Improvements or additions to documentation label Mar 12, 2026
Copy link
Contributor

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 PR adds onboarding documentation intended to help AI coding assistants (Claude Code and GitHub Copilot) generate code consistent with this C++/CMake template’s conventions.

Changes:

  • Added docs/ai-assistant-guide.md describing AI-related configuration files and customization guidance.
  • Added .github/copilot-instructions.md to provide repository-specific Copilot generation instructions (style, architecture, workflows).

Reviewed changes

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

File Description
docs/ai-assistant-guide.md New guide explaining intended Claude Code/Copilot configuration and how to customize it.
.github/copilot-instructions.md New Copilot repository instructions covering style, project structure, and build/test workflows.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +3 to +16
This project includes configuration for **Claude Code** and **GitHub Copilot**
so AI tools generate code that matches the project's conventions out of the box.

Think of these files as onboarding documentation for AI pair programmers.

## What's Configured

### Claude Code

| File | Purpose |
|------|---------|
| `CLAUDE.md` | Project context: build commands, structure, conventions, anti-patterns |
| `.claude/settings.json` | Pre-approved commands and auto-format hook |
| `.claude/commands/*.md` | Custom slash commands (`/build`, `/test`, `/check`, `/add-library`) |
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The guide states that Claude Code is configured via .claude/settings.json and .claude/commands/*.md, but the repository currently has no .claude/ directory. Either add these files as part of the configuration, or update this doc to describe them as optional/recommended (so “What’s Configured” matches what’s actually in the repo).

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +52
```json
{
"permissions": {
"allow": [
"Bash(./scripts/build.sh*)",
"Bash(cmake *)",
"Bash(ctest *)",
...
]
}
}
```
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The fenced json example isn’t valid JSON because it contains .... If this is intentionally abbreviated, consider changing the fence to a non-JSON language (or jsonc) and/or moving the ellipsis outside the code block so readers can copy/paste a valid settings.json snippet.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +75
| `.claude/settings.json` | Pre-approved commands and auto-format hook |
| `.claude/commands/*.md` | Custom slash commands (`/build`, `/test`, `/check`, `/add-library`) |

### GitHub Copilot

| File | Purpose |
|------|---------|
| `.github/copilot-instructions.md` | Code style, architecture patterns, naming conventions |

## Claude Code Features Explained

### CLAUDE.md (repository root)

Automatically loaded into every Claude Code conversation. Contains build
commands, project structure, code conventions, and anti-patterns. Claude uses
this to generate code that matches `.clang-format` and `.clang-tidy` rules
without needing to run the formatters.

Supports hierarchical placement — a `CLAUDE.md` in a subdirectory adds context
for that subtree (e.g., `tests/CLAUDE.md` could add test-specific instructions).

### .claude/settings.json — Pre-approved Commands

Without this file, Claude asks permission every time it runs `cmake`, `ctest`,
or `./scripts/build.sh`. The settings file pre-approves safe commands:

```json
{
"permissions": {
"allow": [
"Bash(./scripts/build.sh*)",
"Bash(cmake *)",
"Bash(ctest *)",
...
]
}
}
```

This eliminates repetitive permission prompts and makes Claude significantly
faster to work with. Dangerous commands (`rm -rf /`, `sudo`) are explicitly denied.

Personal overrides go in `.claude/settings.local.json` (gitignored).

### .claude/settings.json — Auto-Format Hook

The `PostToolUse` hook automatically runs `clang-format` on any `.cpp`, `.hpp`,
or `.h` file that Claude writes or edits. This means Claude's output always
matches the project's formatting rules — even if Claude's generation doesn't
perfectly follow `.clang-format`.

### .claude/commands/ — Custom Slash Commands

These are reusable workflows invoked with `/project:command-name`:

| Command | What it does |
|---------|-------------|
| `/project:build [config]` | Build the project (default: Debug), run tests |
| `/project:test [filter]` | Run test suite, optionally filter by name |
| `/project:check` | Run full CI pipeline locally (format + build + lint + test) |
| `/project:add-library <name>` | Scaffold a new library target with CMake, source, header, and tests |
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The doc mixes two different slash-command names: it says commands are /build//test//check//add-library above, but later describes them as /project:build, /project:test, etc. Please make these consistent so users know the exact invocation syntax.

Copilot uses AI. Check for mistakes.
- Use `#pragma once` for header guards
- New libraries: create `src/<name>/CMakeLists.txt`, add via `add_subdirectory()` in root CMakeLists.txt
- New tests: create `tests/test_<name>.cpp`, register in `tests/CMakeLists.txt` with `gtest_discover_tests()`
- Plugin implementations must export `create_plugin()` as `extern "C"`
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The plugin factory function name here doesn’t match the template code: src/example_plugin_loader/plugin_loader.cpp looks up register_plugin via dlsym, and src/example_plugin_impl/plugin_impl.cpp exports extern "C" void register_plugin(). Update this instruction to avoid Copilot generating plugins that won’t load (e.g., refer to register_plugin() rather than create_plugin()).

Suggested change
- Plugin implementations must export `create_plugin()` as `extern "C"`
- Plugin implementations must export `register_plugin()` as `extern "C"`

Copilot uses AI. Check for mistakes.
- Fix plugin factory function name: create_plugin → register_plugin
  (matches actual code in plugin_impl.cpp and plugin_api.hpp)
- Mark .claude/settings.json and .claude/commands/ as recommended
  additions since they don't exist in the repo yet
- Fix invalid JSON snippet: use jsonc fence with comment instead of ...
- Clarify slash command invocation uses /project: prefix consistently
Copy link
Contributor

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

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


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

You can also share your feedback on Copilot code review. Take the survey.

This eliminates repetitive permission prompts and makes Claude significantly
faster to work with. Dangerous commands (`rm -rf /`, `sudo`) are explicitly denied.

Personal overrides go in `.claude/settings.local.json` (gitignored).
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The guide says .claude/settings.local.json is gitignored, but the current .gitignore doesn’t include this path. Either add an ignore entry for .claude/settings.local.json (and possibly .claude/settings.local.*) or adjust the wording to avoid implying it’s already ignored in this repo.

Suggested change
Personal overrides go in `.claude/settings.local.json` (gitignored).
Personal overrides should go in `.claude/settings.local.json`; add this path to your `.gitignore` so local settings aren't committed.

Copilot uses AI. Check for mistakes.
- Tests go in `tests/test_<target_name>.cpp` using GoogleTest (GTest)
- Use `target_include_directories` and `target_link_libraries` with correct CMake visibility keywords (PUBLIC, PRIVATE, INTERFACE)
- Shared libraries use RPATH (`$ORIGIN/../lib`) for portable deployment
- Plugins use a C-compatible API with `extern "C"` exported factory functions
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This line describes plugins as exporting "factory functions", but the documented/implemented entrypoint is a single register_plugin() symbol (void, no factory/instance semantics). Consider rewording to "exported entrypoint" (or similar) to match the actual plugin ABI and avoid confusion.

Suggested change
- Plugins use a C-compatible API with `extern "C"` exported factory functions
- Plugins use a C-compatible API with `extern "C"` exported entrypoints

Copilot uses AI. Check for mistakes.

## Build & Test

- Build: `./scripts/build.sh` or `mkdir -p build && cd build && cmake .. && make`
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The suggested manual build command (cmake .. && make) doesn’t specify CMAKE_BUILD_TYPE or the install prefix, while ./scripts/build.sh configures Debug and sets CMAKE_INSTALL_PREFIX to install/. To keep onboarding consistent and avoid accidental non-Debug builds, consider updating the command to mirror the script (or reference only ./scripts/build.sh).

Suggested change
- Build: `./scripts/build.sh` or `mkdir -p build && cd build && cmake .. && make`
- Build: `./scripts/build.sh`

Copilot uses AI. Check for mistakes.
- Fix settings.local.json: clarify it's not gitignored yet, advise
  adding to .gitignore
- Fix plugin terminology: "factory functions" → "entrypoints" to match
  actual register_plugin() ABI
- Remove manual cmake build command from copilot instructions to avoid
  inconsistency with build.sh defaults
Copy link
Contributor

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

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


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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +12 to +15
| File | Purpose |
|------|---------|
| `CLAUDE.md` | Project context: build commands, structure, conventions, anti-patterns |

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The markdown table syntax here starts each row with || (double pipe), which creates an extra empty column and renders incorrectly. Use single leading/trailing pipes (e.g., | File | Purpose |) to make this a valid 2-column table.

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +22
| File | Purpose |
|------|---------|
| `.claude/settings.json` | Pre-approved commands and auto-format hook |
| `.claude/commands/*.md` | Custom slash commands (e.g., `/project:build`, `/project:test`) |

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This table also uses || at the start of rows, which renders as an extra blank column in Markdown. Switch to the standard | ... | table format so the file/purpose columns display correctly.

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +28
| File | Purpose |
|------|---------|
| `.github/copilot-instructions.md` | Code style, architecture patterns, naming conventions |

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The GitHub Copilot table uses || prefixes as well; Markdown will interpret this as an extra empty column. Use a single | per column boundary so the table renders as intended.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +82
| Command | What it does |
|---------|-------------|
| `/project:build [config]` | Build the project (default: Debug), run tests |
| `/project:test [filter]` | Run test suite, optionally filter by name |
| `/project:check` | Run full CI pipeline locally (format + build + lint + test) |
| `/project:add-library <name>` | Scaffold a new library target with CMake, source, header, and tests |

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The commands table uses || row prefixes, which will render with an unintended blank first column. Convert this to standard Markdown table syntax (| Command | What it does |, etc.) so the command list displays properly.

Copilot uses AI. Check for mistakes.
@wambitz wambitz merged commit 3ff3f8d into main Mar 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add AI assistant configuration guidelines (Claude Code & Copilot)

2 participants