Skip to content

Commit 350955a

Browse files
committed
Add sub agents
1 parent 5265f61 commit 350955a

4 files changed

Lines changed: 50 additions & 3 deletions

File tree

.claude/agents/build.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: build
3+
description: Compile the project using cmake and ninja. Use when code changes need to be built or when checking for compilation errors.
4+
tools: Bash
5+
---
6+
7+
Build the project from the project root.
8+
9+
If the build directory doesn't exist yet, run:
10+
mkdir -p build && cmake -GNinja -S . -B build
11+
12+
Then always run:
13+
ninja -C build
14+
15+
Report only errors and warnings. If the build succeeds, say so briefly.

.claude/agents/quality.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: quality
3+
description: Run pre-commit quality checks (clang-format, clang-tidy, clazy) on source files. Use after making code changes before finishing a task.
4+
tools: Bash
5+
---
6+
7+
Run quality checks from the project root.
8+
9+
For a specific file (faster):
10+
clang-format -i <file>
11+
./scripts/run_clang_tidy.sh <file>
12+
./scripts/run_clazy.sh <file>
13+
14+
For all files (slow):
15+
./scripts/run_precommit.sh
16+
17+
Report only violations with file, line, and error message. If all checks pass, say so briefly.

.claude/agents/test-runner.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: test-runner
3+
description: Run the test suite with ctest. Use after making code changes to verify correctness. The project must be built first.
4+
tools: Bash
5+
---
6+
7+
Run the test suite from the project root:
8+
ctest --test-dir build --output-on-failure
9+
10+
Report only failing tests with their error messages. If all tests pass, say so briefly with the count.

CLAUDE.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ clang-format -i src/path/to/file.cpp
4040

4141
```text
4242
src/
43-
├── communication/ Modbus protocol layer (ModbusPoll, ModbusMaster, ModbusConnection)
43+
├── communication/ Communication (using external adapters)
4444
├── models/ Data models (SettingsModel, GraphDataModel, DiagnosticModel, Device, Connection)
4545
├── datahandling/ Expression parsing, graph data processing
4646
├── importexport/ CSV export, MBS project files, MBC device config import
@@ -82,5 +82,10 @@ Enforced by `.clang-format` (Mozilla-based, C++20):
8282

8383
## Development
8484

85-
- Use a subagent to run the test suite and report only the failing tests with their error messages.
86-
- Use a subagent to run the quality checks (clang, clazy) and report only the violations with their error messages.
85+
Three sub-agents are defined in `.claude/agents/` to keep build/test/lint output out of the main context:
86+
87+
- **`@agent-build`** — runs cmake + ninja; reports only errors and warnings.
88+
- **`@agent-test-runner`** — runs ctest; reports only failing tests with their error messages.
89+
- **`@agent-quality`** — runs clang-format, clang-tidy, and clazy; reports only violations.
90+
91+
Always use these agents rather than running the commands directly. After making source file changes: build, then run tests, then run quality checks — all must pass before the work is done.

0 commit comments

Comments
 (0)