Guide · Agent skill
How to use the C++ Testing Workflow agent skill (cpp-testing)
Updated · written with AI from the project's own documentation and checked against our catalogue data
The cpp-testing skill is a set of written instructions that an AI agent loads when you ask it to work on C++ tests. It tells the agent to follow a fixed testing workflow built on GoogleTest/GoogleMock, CMake and CTest, instead of improvising. This guide covers what the skill does, how to install it, how to trigger it, and what it needs, so you can use it on a C++ project in one sitting.
Quick start
- 1Download the ZIP. Get the cpp-testing skill ZIP from this page. It contains SKILL.md.
- 2Unzip into a skills folder. Extract it into ~/.claude/skills/ for personal use or into your project's .claude/skills/ folder.
- 3Or upload in the Claude apps. Go to Settings → Capabilities → Skills and upload the ZIP.
- 4Check your toolchain. Confirm you have GCC or Clang and CMake 3.20 or newer.
- 5Ask for a testing task. Describe the test, build or debugging task in plain language, naming the component and project.
- 6Run the build and tests. Configure with cmake, build, then run ctest --test-dir build --output-on-failure.
- 7Add coverage or sanitizers if needed. Ask for a coverage or sanitizer build and review the report or diagnostics it produces.
What the cpp-testing skill makes the agent do
The skill gives an AI agent a structured playbook for C++ testing aimed at modern C++ (C++17/20). It covers writing tests first using a red, green, refactor loop, building unit tests and mocks with GoogleTest/GoogleMock, wiring up CMake and CTest, and diagnosing failing or flaky tests.
It also covers adding code coverage reports and enabling sanitizers, which are tools that catch memory and threading bugs. Once installed, the agent follows these conventions and fills in examples and commands for your project.
- TDD loop: write a failing test, make the smallest change to pass, then clean up with tests still green.
- Test layout suggestion: tests/unit, tests/integration and tests/testdata.
- Use gtest_discover_tests() for stable test discovery in CTest.
- Coverage through target-level CMake settings for GCC (gcov + lcov) or Clang (llvm-cov).
- Sanitizer options for AddressSanitizer, UndefinedBehaviorSanitizer and ThreadSanitizer.
- Guardrails against flaky tests: no sleep for synchronization, unique temp directories, no real time or network in unit tests, deterministic seeds.
Install the cpp-testing skill
Download the skill ZIP from this page. The skill is a single file, SKILL.md, packaged in the ZIP. Unzip it so that the folder containing SKILL.md sits inside a skills directory. For a personal install, use ~/.claude/skills/. For a single project, use the .claude/skills/ folder inside that project.
You can also upload the ZIP in the Claude apps. Open Settings, go to Capabilities, then Skills, and upload it there.
- Personal install: place the unzipped skill in ~/.claude/skills/.
- Project install: place it in your project's .claude/skills/ folder.
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP.
Check that your environment meets the requirements
The skill guides the agent but does not install compilers or libraries for you. You need a C++ compiler (GCC or Clang) and CMake 3.20 or newer. GoogleTest and GoogleMock are fetched by CMake using FetchContent from GitHub, so the first configure step needs network access on your machine.
Coverage and sanitizers are optional. Coverage reports use lcov/genhtml with GCC or llvm-cov/llvm-profdata with Clang. Sanitizers need a compiler that supports ASan, UBSan or TSan.
- Required: C++ compiler (GCC or Clang), CMake 3.20 or newer.
- Fetched automatically: GoogleTest/GoogleMock via CMake FetchContent from GitHub.
- Optional: lcov and genhtml, or llvm-cov and llvm-profdata, for coverage.
- Optional: a sanitizer-capable compiler for ASan, UBSan and TSan.
Trigger the skill with natural requests
You do not need a special command. Describe the C++ testing task in plain language and mention the kind of work involved. The skill's description says it applies when you are writing, updating or fixing C++ tests, configuring GoogleTest or CTest, diagnosing failing or flaky tests, or adding coverage or sanitizers.
Be specific about the project. Name the component under test, the test framework if it is not GoogleTest, and whether you want a new test, a repair or a build change.
- "Write GoogleTest unit tests for the retry logic in src/queue.cpp."
- "Set up CMake and CTest for this C++ project with gtest_discover_tests."
- "This UserStoreTest keeps failing only in CI. Find out why and fix it."
- "Add a coverage build with lcov and produce an HTML report."
- "Turn on AddressSanitizer for the test build and tell me what it finds."
Run the tests the skill sets up
The skill uses standard CMake and CTest commands. A typical configure, build and test cycle looks like this. The agent will adapt the names and paths to your project.
To run a subset, use CTest's -R flag with a test name pattern, or pass a gtest filter directly to the test binary. The skill's debugging steps start with re-running a single failing test.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j
ctest --test-dir build --output-on-failure
ctest --test-dir build -R "UserStoreTest.*" --output-on-failure
./build/example_tests --gtest_filter=UserStoreTest.FindsExistingUserSafety notes: scripts and network
The skill does not run scripts and does not use the network by itself. The source lists both as no. The commands it shows are normal build and test commands that you and the agent run in your project.
Be aware that the CMake setup fetches GoogleTest from GitHub during configuration, as shown in the quickstart. Review the FetchContent block and pin the version your project policy requires. The skill says to use a pinned version and to adjust it to project policy.
- Runs scripts: no.
- Uses network: no (the CMake FetchContent step downloads GoogleTest from GitHub when you configure).
- Review the commands the agent runs before approving them, especially cmake and lcov commands that write files.
What people use it for
- Writing a first GoogleTest suite for an existing C++ class with fixtures.
- Creating a GoogleMock mock for an interface so a service can be tested in isolation.
- Setting up CMake and CTest with gtest_discover_tests for a new project.
- Producing an lcov HTML coverage report from a GCC build.
- Diagnosing a test that fails only sometimes, using the skill's guardrails against sleeps and shared temp paths.
Frequently asked questions
Is the cpp-testing skill free?
The skill is published under the MIT licence, as listed on this page. Check the licence file in the source repository for the full terms before reuse.
How do I install a cpp-testing skill?
Download the ZIP, unzip it into ~/.claude/skills/ for personal use or into your project's .claude/skills/ folder. You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills.
Does the cpp-testing skill work for non-C++ projects?
No. The skill is specific to C++ and GoogleTest, and its own description says it is not for non-C++ projects. Use a testing skill or workflow written for your language instead.
What do I need installed before using it?
You need a C++ compiler (GCC or Clang) and CMake 3.20 or newer. GoogleTest and GoogleMock are fetched by CMake from GitHub. Coverage and sanitizers need lcov/genhtml or llvm-cov, and a sanitizer-capable compiler.
Does the skill run scripts or use the network?
According to the listing, it runs no scripts and uses no network. The CMake FetchContent step does download GoogleTest from GitHub when you configure a project, so keep that in mind for offline or locked-down machines.
Can the agent fix flaky C++ tests with this skill?
Yes, the skill includes a flaky-test checklist and a debugging sequence. It advises re-running the single failing test, adding scoped logging, re-running with sanitizers, and then running the full suite. It also warns against sleep-based synchronization and fixed temp paths.
Is this skill a replacement for learning GoogleTest?
No. It gives the agent conventions to follow, but you still need to review the tests it writes and understand what they check.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you work on C++ with GoogleTest and want an AI agent to write, repair or wire up tests in a consistent way, including CMake/CTest, coverage and sanitizers. Skip it for non-C++ projects, for feature work that does not touch tests, or for performance tuning, which the skill tells the agent to avoid.
Download the skill