🧪
QualityJavaScript

C++ Testing

by xu-xiang

C++ Testing is a Quality skill for Claude Code, published by xu-xiang in everything-claude-code-zh.

1.9K stars307 forkson xu-xiang/everything-claude-code-zhAdded 2026/08/18+1% in starsRepository updated 2026/03/05
ai-agentsanthropicclaudeclaude-codedeveloper-toolseverything-claude-codellmmcponeskillproductivity
Install in seconds
Install C++ Testing
Copy C++ Testing into your Claude Code skills folder. Run the command in your terminal, or review the source on GitHub before installing.
terminal
npx degit https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/cpp-testing ~/.claude/skills/cpp-testing

Requires Node.js. Downloads this skill only — not the rest of the repository — into your Claude Code skills folder.

Without Node.js

git clone https://github.com/xu-xiang/everything-claude-code-zh.git

Clones the whole repository, then copy the skill’s own directory into your skills folder yourself.

In this catalog

Source file
skills/cpp-testing/SKILL.md in xu-xiang/everything-claude-code-zh
Installs to
~/.claude/skills/cpp-testing
Collection
One of 25 skills cataloged from this repository
Category
Quality1354 skills

What C++ Testing does

C++ Testing guides writing and debugging C++17/20 tests with GoogleTest/Mock, CMake/CTest, coverage, and sanitizers. Use it when creating or fixing C++ tests, configuring CI test gates, or diagnosing flaky failures.

C++ Testing is cataloged under Quality on DirSkills. C++ Testing comes from a repository tagged ai-agents, anthropic, claude, claude-code and developer-tools.

Documentation

README

C++ 测试(智能体技能)

针对现代 C++ (C++17/20) 的智能体测试工作流,使用 GoogleTest/GoogleMock 配合 CMake/CTest。

适用场景

  • 编写新的 C++ 测试或修复现有测试
  • 为 C++ 组件设计单元/集成测试覆盖
  • 添加测试覆盖、CI 门禁或回归防护
  • 配置 CMake/CTest 工作流以实现一致性执行
  • 调查测试失败或不稳定(Flaky)行为
  • 启用检测器(Sanitizers)进行内存/竞态诊断

不适用场景

  • 实施不涉及测试更改的新产品功能
  • 与测试覆盖或失败无关的大规模重构
  • 在没有测试回归验证的情况下进行性能调优
  • 非 C++ 项目或非测试任务

核心概念

  • TDD 循环:红(Red)→ 绿(Green)→ 重构(Refactor)(测试先行,最小化修复,然后清理)。
  • 隔离性:优先选择依赖注入和伪造对象(Fakes),而非全局状态。
  • 测试布局tests/unittests/integrationtests/testdata
  • Mocks vs Fakes:Mock 用于交互验证,Fake 用于有状态的行为模拟。
  • CTest 发现:使用 gtest_discover_tests() 进行稳定的测试发现。
  • CI 信号:先运行子集,然后使用 --output-on-failure 运行完整套件。

TDD 工作流

遵循 红 → 绿 → 重构 循环:

  1. 红(RED):编写一个捕获新行为的失败测试。
  2. 绿(GREEN):实施最小化的更改以使测试通过。
  3. 重构(REFACTOR):在保持测试为绿色的前提下进行清理。

This is the opening of the README. Read the full README on GitHub.

Frequently asked about C++ Testing

  • What else does xu-xiang publish alongside C++ Testing?

    C++ Testing is one of 25 skills that DirSkills catalogs from xu-xiang/everything-claude-code-zh, the repository it ships in. Its siblings there include API Design Patterns, Article Writing and Autonomous Loops. Each one is a separate skill with its own page in this directory, installs the same way C++ Testing does, and is maintained by xu-xiang in that same repository. The rest of the collection is listed on the xu-xiang/everything-claude-code-zh page.

  • How does C++ Testing compare to other Quality skills?

    C++ Testing ranks #586 by stars among the 1354 Quality skills in this catalog. The most-starred ones next to it are Benchmark, Benchmark Optimization Loop and API Design Patterns. DirSkills ranks by the star count of the repository each skill ships in, so that order reflects how popular those repositories are rather than any review of C++ Testing against them. Open each page to compare what they document and how they install.

More from xu-xiang/everything-claude-code-zh

C++ Testing is one of 25 skills cataloged on DirSkills from xu-xiang/everything-claude-code-zh.

See all 25 skills
📐
2w ago

API Design Patterns

API Design Patterns provides conventions and best practices for designing consistent, developer-friendly REST APIs, including resource naming, HTTP status codes, pagination, filtering, error responses, versioning, and rate limiting.
DevOps
1.9K307
✍️
2w ago

Article Writing

Article Writing drafts long-form content such as articles, guides, tutorials, and newsletters in a specific voice captured from examples or brand guidelines. Use it when you need polished copy longer than a paragraph with consistent tone, structure, and credibility.
Writing
1.9K307
🔁
2w ago

Autonomous Loops

Autonomous Loops provides patterns and architectures for running Claude Code without human intervention, from simple claude -p pipelines to RFC-driven multi-agent DAG orchestration. Use it to set up autonomous development workflows, CI/CD pipelines, parallel agents, and quality gates.
Automation
1.9K307
⚙️
2w ago

Backend Patterns

Backend Patterns provides architectural patterns and best practices for building scalable server-side applications, covering REST API design, repository/service layers, database optimization, caching, and error handling. Use it when implementing Node.js, Express, or Next.js API routes.
DevOps
1.9K307
🛠️
2w ago

C++ Coding Standards

C++ Coding Standards provides a set of rules and best practices based on the C++ Core Guidelines for writing modern, safe, and idiomatic C++ code. Use it when writing, reviewing, or refactoring C++ code to enforce type safety, resource safety, immutability, and clarity.
Quality
1.9K307
📊
2w ago

ClickHouse Analytics Patterns

ClickHouse Analytics Patterns provides ClickHouse-specific patterns for high-performance analytics and data engineering, covering table design, query optimization, materialized views, and bulk data ingestion. Use it when designing MergeTree schemas, writing analytical queries, or migrating analytics workloads from PostgreSQL/MySQL to ClickHouse.
Data
1.9K307