# Cpp testing

> Cpp testing is an open-source agent skill for developer tools. Guides an agent through writing, fixing and debugging C++ tests with GoogleTest and CTest. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/cpp-testing
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 66
- **License:** MIT
- **Skill name:** cpp-testing
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill gives an agent a test-first workflow for C++17 and C++20 projects built on GoogleTest and GoogleMock, driven by CMake and CTest. It covers writing new unit tests and fixtures, mocking interfaces, and organizing tests into unit and integration layers.

Beyond writing tests, it lays out how to configure test discovery with gtest_discover_tests, run a subset before the full suite, and narrow down a failing or flaky test with gtest filters and sanitizers. It also includes CMake options for GCC gcov/lcov and Clang llvm-cov coverage, plus ASan, UBSan and TSan toggles, along with guardrails against common flakiness sources such as sleeps, real clocks and shared temp paths.

The skill is instruction-only with no bundled scripts. It expects a C++ project with a CMake build and GoogleTest available, and it notes Catch2 and doctest as alternatives. Fuzzing with libFuzzer or RapidCheck is covered as an optional appendix for projects that already use them.

## When your agent uses it

> Use only when writing/updating/fixing C++ tests, configuring GoogleTest/CTest, diagnosing failing or flaky tests, or adding coverage/sanitizers.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/cpp-testing)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/cpp-testing)

## Features

- **Red-green-refactor workflow:** Steps the agent through writing a failing test, a minimal fix, and cleanup.
- **GoogleTest and GMock patterns:** Examples of fixtures, TEST_F cases and mock methods for interface-based code.
- **CMake and CTest setup:** A FetchContent-based CMake quickstart with test discovery and CTest commands.
- **Coverage configuration:** CMake options and commands for gcov/lcov with GCC and llvm-cov with Clang.
- **Sanitizer builds:** CMake toggles for AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer.
- **Flaky test guardrails:** Rules against sleep-based synchronization, real time and shared temp paths in tests.

## Good for

- Write unit tests for a new C++ class using GoogleTest
- Fix a failing or intermittent C++ test in a CMake project
- Set up CTest discovery and a test run command for a C++ repo
- Add gcov or llvm-cov coverage reporting to a C++ build
- Enable AddressSanitizer or ThreadSanitizer to chase a memory or race bug
- Mock an interface with GMock to isolate a service under test

## Install

### Claude Code

This skill ships in the `rea-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath
```

Or copy only this skill to `~/.claude/skills/cpp-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/cpp-testing &&
cp -R "$tmp/.agents/skills/cpp-testing" ~/.claude/skills/cpp-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/cpp-testing` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/cpp-testing` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/cpp-testing &&
cp -R "$tmp/.agents/skills/cpp-testing" ~/.agents/skills/cpp-testing &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/cpp-testing` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/cpp-testing` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/cpp-testing &&
cp -R "$tmp/.agents/skills/cpp-testing" ~/.cursor/skills/cpp-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/cpp-testing` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/cpp-testing
```

Or copy the folder to `~/.gemini/skills/cpp-testing` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/cpp-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/cpp-testing &&
cp -R "$tmp/.agents/skills/cpp-testing" ~/.copilot/skills/cpp-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/cpp-testing` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git
```

Then copy `REA_Skill/.agents/skills/cpp-testing` into your agent's skills folder as `cpp-testing`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Cpp testing apply?

It is meant for writing, updating or fixing C++ tests, configuring GoogleTest or CTest, diagnosing failing or flaky tests, and adding coverage or sanitizers. It says not to use it for feature work without test changes or for non-C++ projects.

### Does Cpp testing need any scripts or extra tools installed?

It bundles no scripts. The examples assume CMake, CTest and GoogleTest, with coverage steps needing gcov/lcov or llvm-cov depending on the compiler.

### Which C++ standards does Cpp testing target?

The workflow is described for modern C++, specifically C++17 and C++20, and the CMake example sets C++20.

### Are there alternatives to GoogleTest covered?

Yes, the skill briefly lists Catch2 and doctest as alternatives.

### How do I install Cpp testing in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/cpp-testing to use it in all your projects, or to .claude/skills/cpp-testing in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

### Does Cpp testing run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Cpp testing?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Cpp testing?

The closest alternatives to Cpp testing are TDD, Csharp testing, Java junit, Unittest skill and Mstest skill.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [TDD](https://ai-powered.com/skills/tdd): TDD is an open-source agent skill for developer tools.
- [Csharp testing](https://ai-powered.com/skills/csharp-testing): Csharp testing is an open-source agent skill for developer tools.
- [Java junit](https://ai-powered.com/skills/java-junit): Java junit is an open-source agent skill for developer tools.
- [Unittest skill](https://ai-powered.com/skills/unittest-skill): Unittest skill is an open-source agent skill for developer tools.
- [Mstest skill](https://ai-powered.com/skills/mstest-skill): Mstest skill is an open-source agent skill for developer tools.
- [Testunit skill](https://ai-powered.com/skills/testunit-skill): Testunit skill is an open-source agent skill for developer tools.
- [Pytest skill](https://ai-powered.com/skills/pytest-skill): Pytest skill is an open-source agent skill for developer tools.
- [Cpp](https://ai-powered.com/skills/cpp): Cpp is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/cpp-testing
