본문으로 건너뛰기
cccskills
무료GitHub에 공개

cpp-modules

Use when a C++ project adopts C++20 modules: named modules, partitions, header units, the global module fragment, CMake CXX_MODULES, or a BMI lookup error. Not for flag basics: use clang.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md5.7 KB
  • agents/openai.yaml220 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

C++20 modules

Contract

FieldBound contract
TriggerThe user writes or builds export module code, asks how named modules differ from header units, needs the CMake wiring for module interface units, or gets a module-not-found, redefinition, or stale-BMI error.
AuthorityRead-only. The skill emits module source shapes, compiler invocations, and CMake snippets to chat; the user applies them. Rollback is not needed. No remote mutation.
Side effectChat output. Any scratch build to confirm a flag runs on scratch files.
DoneThe module layout, the per-compiler build commands, and the CMake wiring are reported for the user's compiler and CMake version, and every error in the request maps to a cause and fix.

Inputs

  • Compiler and version: required. Clang 23.1.0 and GCC 16.2 are current stable; both accept the commands below.
  • CMake version when CMake is in use: required. Current stable is 4.4.3; the stable CXX_MODULES file set needs 3.28 or later.
  • Generator: required with CMake. Ninja 1.11 or later, Ninja Multi-Config, or Visual Studio; Makefile generators do not support modules.
  • Module layout the user has or wants: required. Primary interface, partitions, implementation units, and any legacy headers with macros.

Procedure

  1. Classify each translation unit. Primary interface unit: export module m; in a .cppm (or .ixx) file. Partition interface: export module m:part;, re-exported from the primary with export import :part;. Implementation unit: module m; with no exports. Header unit: import <vector>; or import "local.h";, a bridge for legacy headers. Prefer named modules; use header units only to bridge. Done when: every file has one classification.

  2. Handle macros. Macros do not cross import. Code that needs a header's macros puts #include in the global module fragment: a file that opens with module;, then the includes, then export module m;. Wrap a C library the same way and re-export with export using ::name;. Done when: every macro dependency is in a global module fragment.

  3. Build with Clang. Precompile the interface: clang++ -std=c++20 --precompile math.cppm -o math.pcm. Compile users against it: clang++ -std=c++20 -fmodule-file=math=math.pcm -c main.cpp -o main.o. Link the interface's object as well: clang++ -std=c++20 -fmodule-file=math=math.pcm math.pcm main.o -o prog. Done when: the three commands are given in dependency order.

  4. Build with GCC. g++ -std=c++20 -fmodules-ts -c math.cppm -o math.o writes math.gcm under gcm.cache/ in the working directory, and g++ -std=c++20 -fmodules-ts main.cpp math.o -o prog finds it there. GCC 16 also accepts -fmodules; both spellings compile on the installed 16 line. Done when: the interface is compiled before its importers and the cache directory is named.

  5. Wire CMake 3.28 or later:

    cmake_minimum_required(VERSION 3.28)
    project(myproject LANGUAGES CXX)
    set(CMAKE_CXX_STANDARD 20)
    add_library(math)
    target_sources(math
        PUBLIC FILE_SET CXX_MODULES FILES src/math.cppm src/math-core.cppm
        PRIVATE src/math-impl.cpp)
    add_executable(myapp main.cpp)
    target_link_libraries(myapp PRIVATE math)
    

    Configure with cmake -S . -B build -G Ninja and build with cmake --build build. Install the interfaces with install(TARGETS math FILE_SET CXX_MODULES DESTINATION include/math). Done when: interface units are in the CXX_MODULES file set and the generator supports dynamic dependencies.

  6. Map errors from the table; reproduce on scratch files when the message is not listed. Done when: each error has a cause and fix.

    ErrorCauseFix
    module m not foundBMI absent or not on the lookup pathCompile the interface first; pass -fmodule-file=m=<path> (Clang) or run in the directory holding gcm.cache/ (GCC)
    #include inside the module purview rejectedInclude placed after export moduleMove it to the global module fragment or import a header unit
    redefinition of module mTwo files declare the same primary interfaceOne primary interface per module; make the second a partition
    macro undefined after importMacros do not cross module boundariesGlobal module fragment with #include
    ODR violation across partitionsOne name exported from two partitionsExport each name from exactly one partition
    stale results after an editBMI not rebuiltRebuild the interface; with CMake, use a generator that tracks module dependencies
  7. Confirm the commands on the installed compiler with a two-file scratch module before reporting. Done when: the scratch build links and runs.

Failure and recovery

Failure classBehavior
CMake older than 3.28Report that stable module support starts at 3.28; the experimental 3.25 API is not recommended.
Makefile generator selectedSwitch to Ninja; report that Make lacks the dynamic dependency support modules need.
import std; requestedReport it as toolchain-dependent and confirm on the user's standard library before promising it.
Compiler older than the current lineConfirm each flag with a scratch build; module support in earlier lines is uneven.
Precompiled headers as an alternativePCH and build caching: use build-acceleration.

Output

A chat report with the classified module layout, the ordered build commands for the user's compiler, the CMake snippet when CMake is in use, and the error table entries that apply.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

Use when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

af-xdp

무료

Use when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

Use when a completed session needs an agent-environment retrospective. Not for an engineering retrospective from telemetry: use engineering-retrospective.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

Use when a redacted, trimmed agent transcript must be appended to a GitHub PR or issue body, with human approval and preview. Not for automated or model-initiated insertion.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

agents-md

무료

Use when a repo needs agent setup, AGENTS.md added or made lean, CLAUDE.md audited, or agent instructions scored or pruned. Not for remote, credential, publish, deploy, or irreversible changes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

OutlineDriven의 스킬 모두 보기

이 스킬의 문제 신고