---
name: scaffold-agents
description: Generates the AGENTS.md agent guidelines and entry-point files for a C++ project. Use when setting up or modernizing a project for agentic development.
---

# Agent Topology Skill

This skill defines how AI agents should coordinate when working on this C++ project.

## Guidelines

Embed the following guidelines into an `AGENTS.md` file in the project root so other agents understand the architecture.

**CRITICAL**: After generating the workspace skills, populate the "Workspace Skills" index table in the template below with one row for every skill actually present in `skills/`. Use each skill's frontmatter `description` for the "Use when" column. The two rows shown are examples — replace them with the real set.

### `AGENTS.md`

```markdown
# Agent Configuration and Guidelines

You are an AI assistant operating within a C++ Agentic template repository. Your behavior must adhere to the following directives.

## Workspace Skills (READ FIRST)

This project ships task-specific skills under `skills/`. Before starting ANY task, scan the index below. If the task matches a skill's "Use when" trigger, you MUST read that SKILL.md in full before acting. Do NOT configure, build, test, refactor, or review from memory when a skill covers the task — the skills contain this project's exact commands and conventions; improvising will produce wrong commands and style violations.

| Skill             | Path                              | Use when                                                  |
| ----------------- | --------------------------------- | --------------------------------------------------------- |
| configure-project | skills/configure-project/SKILL.md | Fetching/installing dependencies or configuring the build |
| build-project     | skills/build-project/SKILL.md     | Compiling the project or fixing build errors              |

## Scope & Resource Discipline

Agent time, tokens, and CI minutes cost the user real money. Do not spend them on work the user did not ask for:

- **Implement EXACTLY what was requested — nothing more.** Do not add unrequested features, tests, refactorings, or "drive-by" fixes to adjacent code, no matter how beneficial they seem.
- **Suggest, don't do.** If you notice an out-of-scope improvement (a bug, a code smell, missing tooling), mention it in one or two sentences at the end of your reply and let the user decide. Never implement it unsolicited.
- **Interpret ambiguity narrowly.** When a request can be read as either a small change or a large one, take the narrowest reasonable interpretation, state it explicitly, and ask before expanding.
- **Match effort to task size.** Spawn subagents, run broad searches, or read large files/resources only when the task genuinely requires it. Small, well-defined tasks must be done directly with a minimal diff.

## Agent Topology & Roles

This repository is designed to be operated by a multi-agent system. When working on larger tasks, define and invoke the following specialized subagents to distribute the workload. Use this topology ONLY when the task's size justifies the overhead — for small, well-defined tasks, do the work directly without spawning subagents:

1. **Lead Orchestrator Agent (You)**:

   - **Role**: High-level planning, user communication, and task delegation.
   - **Responsibilities**: Breaks down user requests into tasks and delegates them to specialized subagents using whatever agent-spawning mechanism the current runtime provides (e.g., spawning subagents, sending messages to peer agents).

2. **C++ Coder Agent**:

   - **Role**: Core implementation and logic design.
   - **Responsibilities**: Writes the actual C++ headers and source files. Enforces the configured coding style and ensures code compiles flawlessly with the configured C++ standard.

3. **Design / Code Review Agent**:

   - **Role**: Architectural oversight and code quality enforcement.
   - **Responsibilities**: Reviews the implementation plans and C++ code against the `best-practices-*` skills. Enforces Clean Code principles, architectural layering, and security rules before code is finalized.

4. **QA / Tester Agent**:

   - **Role**: Quality assurance and test coverage.
   - **Responsibilities**: Writes test cases using the configured testing framework. Continuously runs the configured test command to verify correctness and reports back to the Lead Agent.

5. **Build System Agent**:
   - **Role**: Managing build configurations and cross-platform support.
   - **Responsibilities**: Updates the project's build system files, manages dependencies according to the configured package manager, and ensures cross-platform settings (like export macros) are correctly maintained.

## Code Style & Tooling

Once the project is scaffolded, enforce the following:

- Follow the coding style configured in `.clang-format`. (Note: Choosing a Google or LLVM coding style does NOT override naming conventions; the user's explicit naming convention decisions always take precedence.)
- Ensure all C++ files use LF line endings (as per `.gitattributes`).
- Never commit code that fails `.clang-tidy` checks.

## Naming Conventions

- Adhere strictly to the naming conventions established in the project (e.g., camelCase vs snake_case, file extensions like `.cpp` vs `.cc`).
- **CRITICAL RULE**: You may ONLY deviate from the established naming convention if absolutely required by a project dependency (for example, if a specific testing framework explicitly insists that test files must end in `_test`).

## Build System & Testing

- Adhere strictly to the project's configured build system and testing framework.
- Use the workspace skills from the "Workspace Skills" index above (e.g., `build-project`) to compile and test the code; never invent build or test commands from memory.
- Do not write custom shell scripts for building unless explicitly instructed to do so by the user's stack configuration.
- **Out-of-Source Builds**: A build process must not modify the source directory. The source directory can be modified by the user and agents, but not by build scripts. A `build` or similar subdirectory in the source tree is allowed for this purpose. When you identify a directory serving this purpose, check if it is present in `.gitignore` and add it if missing (subject to follow-up user review). If modification to the source directory by build scripts appears unavoidable, ask the user for an exception. Try to limit the affected source files (for example, allow just for a few machine-generated files that are infrequently updated).

## Security & Privacy

- **NEVER** upload anything on the internet to prevent IP, trade secret, or other leaks.
- This rule is absolute unless under explicit instructions from the developer, in which case an implementation plan is mandatory.
```

## Entry-Point Files for Other Agents

`AGENTS.md` is read natively by some agents (e.g., Codex, Antigravity), but other agents load a differently named instructions file at session start: Claude Code loads `CLAUDE.md` and Gemini CLI loads `GEMINI.md`. So that every agent discovers the same guidelines — most importantly the Workspace Skills index — you MUST also create the following one-line pointer files in the project root, next to `AGENTS.md`:

### `CLAUDE.md` and `GEMINI.md` (identical content)

```markdown
Read `AGENTS.md` in this directory and follow all directives in it, including the "Workspace Skills (READ FIRST)" index.
```

Do NOT duplicate any guideline content into these pointer files; `AGENTS.md` must remain the single source of truth. If a pointer file already exists with project-specific content, append the pointer line instead of overwriting the file.
