cpp-testing

cpp-testing is a skill for Claude Code, Codex from nklofy/code-agent-skills. It costs 34 tokens per session (2,293 once invoked), scanned A, a copy of cpp-testing, Apache-2.0.

A testing workflow for C++ projects using GoogleTest, GoogleMock, CMake, and CTest. TDD means writing a failing test, making the smallest fix, and then cleaning up the code.

In plain words
What is it for?
Use it when writing or repairing C++ tests, organizing unit and integration tests, configuring CTest, adding coverage or continuous-integration checks, diagnosing flaky tests, or enabling sanitizers.
Why use it?
It gives a consistent way to add tests, investigate failures, find memory or race problems, and protect existing behavior from regressions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or repairing C++ tests, organizing unit and integration tests, configuring CTest, adding coverage or continuous-integration checks, diagnosing flaky tests, or enabling sanitizers.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nklofy/code-agent-skills/cpp-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nklofy/code-agent-skills --skill cpp-testing
Clone the repo
git clone --depth 1 https://github.com/nklofy/code-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cpp-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/nklofy/code-agent-skills/cpp-testing/github.svg)](https://agentmods.dev/skills/nklofy/code-agent-skills/cpp-testing)
Your own site
<a href="https://agentmods.dev/skills/nklofy/code-agent-skills/cpp-testing"><img src="https://agentmods.dev/badge/skills/nklofy/code-agent-skills/cpp-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cpp-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/nklofy/code-agent-skills/cpp-testing"><img src="https://agentmods.dev/badge/skills/nklofy/code-agent-skills/cpp-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,293 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.02293
Opus 5.5 $0.00014 $0.00917
Sonnet 5.5 $0.00007 $0.00459
Haiku 4.5 $0.00003 $0.00229

Measured 3mo ago against content hash a92fb5da9b7e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cpp-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to cpp-testing — 5 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

affaan-m-ECC/cpp-testing/SKILL.md · 326 lines

How it starts

The opening of the file, as written. The whole thing — 326 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C++ Testing (Agent Skill)

Agent-focused testing workflow for modern C++ (C++17/20) using GoogleTest/GoogleMock with CMake/CTest.

When to Use

  • Writing new C++ tests or fixing existing tests
  • Designing unit/integration test coverage for C++ components
  • Adding test coverage, CI gating, or regression protection
  • Configuring CMake/CTest workflows for consistent execution
  • Investigating test failures or flaky behavior
  • Enabling sanitizers for memory/race diagnostics

When NOT to Use

  • Implementing new product features without test changes
  • Large-scale refactors unrelated to test coverage or failures
  • Performance tuning without test regressions to validate
  • Non-C++ projects or non-test tasks

Core Concepts

  • TDD loop: red → green → refactor (tests first, minimal fix, then cleanups).
  • Isolation: prefer dependency injection and fakes over global state.
  • Test layout: tests/unit, tests/integration, tests/testdata.
  • Mocks vs fakes: mock for interactions, fake for stateful behavior.
  • CTest discovery: use gtest_discover_tests() for stable test discovery.
  • CI signal: run subset first, then full suite with --output-on-failure.

TDD Workflow

Follow the RED → GREEN → REFACTOR loop:

  1. RED: write a failing test that captures the new behavior
  2. GREEN: implement the smallest change to pass
  3. REFACTOR: clean up while tests stay green
// tests/add_test.cpp
#include <gtest/gtest.h>

int Add(int a, int b); // Provided by production code.

TEST(AddTest, AddsTwoNumbers) { // RED
  EXPECT_EQ(Add(2, 3), 5);
}

// src/add.cpp
int Add(int a, int b) { // GREEN
  return a + b;
}

// REFACTOR: simplify/rename once tests pass

Code Examples

Basic Unit Test (gtest)

// tests/calculator_test.cpp
#include <gtest/gtest.h>

int Add(int a, int b); // Provided by production code.

TEST(CalculatorTest, AddsTwoNumbers) {
    EXPECT_EQ(Add(2, 3), 5);
}

Fixture (gtest)

// tests/user_store_test.cpp
// Pseudocode stub: replace UserStore/User with project types.
#include <gtest/gtest.h>
#include <memory>
#include <optional>
#include <string>

struct User { std::string name; };
class UserStore {
public:
    explicit UserStore(std::string /*path*/) {}
    void Seed(std::initializer_list<User> /*users*/) {}
    std::optional<User> Find(const std::string &/*name*/) { return User{"alice"}; }
};

class UserStoreTest : public ::testing::Test {
protected:
    void SetUp() override {
        store = std::make_unique<UserStore>(":memory:");
        store->Seed({{"alice"}, {"bob"}});
    }

    std::unique_ptr<UserStore> store;
};

TEST_F(UserStoreTest, FindsExistingUser) {
    auto user = store->Find("alice");
    ASSERT_TRUE(user.has_value());
    EXPECT_EQ(user->name, "alice");
}

Read the full file on GitHub · 326 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 326 lines · 34 tokens per session scan A a92fb5da9b7e

Subscribe to this mod's changes

cpp-testing is a skill published in the GitHub repository nklofy/code-agent-skills (18 stars, last pushed 3d ago), licensed Apache-2.0. It adds 34 tokens to every session and 2,293 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to cpp-testing, differing in 5 lines, and is treated as a copy.

Related

cpp-testing compared with skills from other repositories

cpp-testing next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cpp-testingnklofy/code-agent-skillsSkill183d agoApache-2.0A34Claude Code, Codex
blink-gc-pluginchromium/chromiumSkill25ktodayBSD-3-ClauseC79Claude Code, Codex
loom-ccosmix/loomSkill66todayMITA25Claude Code, Codex
create-cpp-testsHLND2T/CS2_VibeSignaturesSkill673d agoMITA72Claude Code, Codex
hashiiiii-zighashiiiii/rules-for-aiSkill109d agoMITA25Claude Code
cpp-testingAeonDave/malskillSkill466d agononeA51Claude Code, Codex
cpp-developmentjxoesneon/CielSkill11mo agoApache-2.0A24Claude Code, Codex