cpp-modules

Guide authoring, building, and debugging C++20 modules across compilers and CMake.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill cpp-modules-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-modules
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/cpp-modules
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill cpp-modules-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill reduces the complexity of authoring, building, and diagnosing C++20 module systems across compilers and build systems, helping teams migrate legacy header-based code to modern module-based workflows without breaking builds.

Core Features & Use Cases

  • Module concepts & patterns: Explains named module interface units, implementation units, partitions, header units, and the global module fragment.
  • Compiler-specific guidance: Provides Clang, GCC, and MSVC compilation patterns, flags, and BMI/PCM handling tips.
  • CMake integration: Describes use of FILE_SET CXX_MODULES, generator requirements, and experimental settings for older CMake versions.
  • Debugging & migration: Diagnoses common errors such as missing BMIs, stale module caches, redefinition conflicts, and macro visibility issues while offering migration strategies for legacy headers.
  • Use Case: Turn a small header-based library into a modular layout with a primary interface, partitions, and a CMake target that exports module interface units.

Quick Start

Ask the skill to generate a minimal C++20 module interface, a consuming main, and a CMake FILE_SET example for a library named "math".

Frequently Asked Questions about cpp-modules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure CMake FILE_SET for C++20 modules?

To configure CMake FILE_SET for C++20 modules, define CXX_MODULES in your target and specify module interface files. The skill provides build recipes and generator requirements to help you export and compile module interfaces across Clang, GCC, and MSVC.

Why does my C++20 module build fail with missing BMI or stale module cache errors?

C++20 module builds fail with missing BMI or stale module cache errors due to compiler-specific BMI/PCM handling issues. This skill diagnoses these common errors and provides guidance to clear caches and resolve redefinition conflicts.

What is the difference between C++20 named modules, module partitions, and header units?

C++20 named modules define the primary interface, partitions split interfaces logically, and header units wrap legacy headers. This skill explains these concepts and provides examples for structuring your project using the global module fragment.

Are C++20 modules supported across Clang, GCC, and MSVC toolchains?

Yes, C++20 modules are supported across Clang, GCC, and MSVC toolchains. This skill provides compiler-specific compilation patterns, flags, and BMI/PCM handling tips to ensure your module-based workflows build correctly on each.

How do I migrate legacy header-based C++ code to C++20 modules?

To migrate legacy header-based C++ code to C++20 modules, use header units and the global module fragment to wrap existing headers. This skill offers migration strategies and patterns to transition without breaking current builds.