c-idioms

Guides C code implementation, review, and C23 migration against the project's declared -std= baseline.

Updated Jul 4, 2023
One-click install
npx skills add https://github.com/kohdice/dotfiles --skill c-idioms-kohdice
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: c-idioms
Source: https://github.com/kohdice/dotfiles/tree/main/config/agents/skills/c-idioms
Command: npx skills add https://github.com/kohdice/dotfiles --skill c-idioms-kohdice

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing or reviewing C code without knowing the project's target standard leads to using features the compiler rejects or missing removed constructs that break builds. This Skill resolves the project's -std= baseline first, then gates every recommendation, refactoring, and review finding against the correct ISO C version up to C23. ## Core Features & Use Cases - Baseline-aware code generation: Detects the target standard from Makefiles, CMakeLists.txt, meson.build, and other build files, then emits only conforming code with a mandatory baseline statement and self-check. - Version-tagged review reports: Produces structured findings tiered by severity (removed constructs, obsolescent constructs, modernization options) with file:line references, official WG14 citations, and ripple notes for non-drop-in replacements. - C23 migration guidance: Flags K&R definitions, trigraphs, ATOMIC_VAR_INIT, realloc(ptr, 0), and other removed constructs, while labeling gated replacements like nullptr, constexpr, <stdckdint.h>, and <stdbit.h> with their required C version. - Use Case: When reviewing a legacy C11 codebase, the Skill identifies _Noreturn and DECIMAL_DIG as obsolescent in C23, cites the adopting WG14 proposals, and suggests [[noreturn]] and FLT_DECIMAL_DIG as labeled migration options without breaking the current baseline. ## Quick Start Ask the AI to review or write C code in this project using the c-idioms skill so it resolves the -std= baseline and applies version-correct recommendations.

Frequently Asked Questions about c-idioms

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

FAQPage Schema
How do I migrate legacy C code to C23?▼

First resolve the project's -std= baseline from build files, then replace removed constructs like K&R function definitions, trigraphs, and ATOMIC_VAR_INIT with their C23 equivalents. Verify compiler and library support using GCC and Clang official feature tables before adopting specific C23 features.

How to review C code for standard compliance?▼

Determine the target standard from -std= flags in Makefile, CMakeLists.txt, or meson.build, then check code against version-tagged catalogs of removed and obsolescent constructs. Report findings with severity tiers, file:line references, and the standard version that changed each construct.

What C constructs were removed in C23?▼

C23 removed K&R function definitions, trigraphs, and ATOMIC_VAR_INIT, changed empty parentheses to mean (void), and made realloc(ptr, 0) undefined behavior. Two's complement representation is now mandated, making sign-magnitude fallback code dead.

Does compiler support for -std=c23 guarantee full C23 features?▼

No. Accepting the -std=c23 flag does not guarantee support for every C23 language feature or library facility. Check the official GCC and Clang C status pages for the specific features you plan to use, and state implementation limits in your output.

When should nullptr replace NULL in C code?▼

nullptr (C23) matters most in sentinel and variadic contexts where type safety affects correctness; ordinary null checks do not require it. NULL remains valid and is not obsolescent, so treat the replacement as a labeled modernization option gated on a C23 baseline.