GNU C Coding Practices
Application skill for GNU Coding Standards (archived awesome-guidelines capsules). For generic portable C without GNU layout, load c-coding-practices. Apache httpd: httpd-c-coding-practices. Linux kernel: kernel coding-style, not this skill.
Core Principle
GNU C quality is tool-friendly layout plus explicit documentation and checked system behavior, defun column-1 braces, spaces before (, semantic names, annotated #endif, Autoconf/Gnulib portability.
When to Use / NOT
- GNU packages (coreutils, binutils, emacs, gnulib-using trees), FSF contribution paths.
- Reviewing C before merge to Savannah/FSF-maintained repos.
NOT when:
- Linux kernel C, kernel coding-style (tabs, different rules).
- Apache httpd modules,
httpd-c-coding-practices.
- Non-GNU embedded C with local
AGENTS.md override.
Workflow
- Format, 79 cols, defun braces, GNU indent (
gnu-style-formatting-layout.md).
- Naming, identifiers, flags, files (
gnu-style-naming-files.md).
- Comments, English,
#endif sense (gnu-style-comments-conditionals.md).
- Constructs/portability, types, braces, Gnulib, errors (
gnu-style-constructs-portability.md).
- Verify,
./configure && make && make check; optional GNU indent on touched C.
Red Flags
- Function
{ not in column 1
- Lines >79 without intentional wrap
foo(bar), missing space before (
- CamelCase identifiers (
iCantReadThis)
- CLI flag variable named only for letter, not meaning
- Missing function or static-variable comments
#endif without condition/sense comment (nested blocks)
- Two spaces after period missing in new comment blocks
extern inside function
- Nested
if/else without braces
- Assignment inside
if condition
- Unchecked
malloc/realloc/syscall
- Error message without
strerror + context
- Hand-rolled declaration of system function
- Kernel/httpd indent rules applied to GNU tree without project say-so
Verification
- GNU
indent with standards flags on changed files (optional separate commit)
grep -E '.{80}' on touched lines
./configure && make check (or project test target)
- Capsule probes on new conditionals and error paths
- Cross-check: not mixing httpd 4-space or kernel tab style
References
awesome-guidelines/references/gnu-style-learning-note.md
awesome-guidelines/references/gnu-style-formatting-layout.md
awesome-guidelines/references/gnu-style-naming-files.md
awesome-guidelines/references/gnu-style-comments-conditionals.md
awesome-guidelines/references/gnu-style-constructs-portability.md
Related skills
c-coding-practices, portable C safety baseline
httpd-c-coding-practices, ASF httpd layout profile
shell-scripting-practices, Autotools-adjacent shell glue
1---2name: gnu-c-coding-practices3description: Use when authoring or reviewing GNU package C, 79-col defun braces, GNU indent spacing, lowercase_with_underscores naming, English comments, braced nested if/else, Gnulib/Autoconf, and checked syscalls/malloc.4---56# GNU C Coding Practices78Application skill for GNU Coding Standards (archived `awesome-guidelines` capsules). For generic portable C without GNU layout, load `c-coding-practices`. Apache httpd: `httpd-c-coding-practices`. Linux kernel: kernel coding-style, not this skill.910## Core Principle1112GNU C quality is **tool-friendly layout plus explicit documentation and checked system behavior**, defun column-1 braces, spaces before `(`, semantic names, annotated `#endif`, Autoconf/Gnulib portability.1314## When to Use / NOT1516- GNU packages (coreutils, binutils, emacs, gnulib-using trees), FSF contribution paths.17- Reviewing C before merge to Savannah/FSF-maintained repos.1819**NOT when:**2021- Linux kernel C, kernel coding-style (tabs, different rules).22- Apache httpd modules, `httpd-c-coding-practices`.23- Non-GNU embedded C with local `AGENTS.md` override.2425## Workflow26271. **Format**, 79 cols, defun braces, GNU indent (`gnu-style-formatting-layout.md`).282. **Naming**, identifiers, flags, files (`gnu-style-naming-files.md`).293. **Comments**, English, `#endif` sense (`gnu-style-comments-conditionals.md`).304. **Constructs/portability**, types, braces, Gnulib, errors (`gnu-style-constructs-portability.md`).315. **Verify**, `./configure && make && make check`; optional GNU `indent` on touched C.3233## Red Flags3435- Function `{` not in column 136- Lines >79 without intentional wrap37- `foo(bar)`, missing space before `(`38- CamelCase identifiers (`iCantReadThis`)39- CLI flag variable named only for letter, not meaning40- Missing function or static-variable comments41- `#endif` without condition/sense comment (nested blocks)42- Two spaces after period missing in new comment blocks43- `extern` inside function44- Nested `if`/`else` without braces45- Assignment inside `if` condition46- Unchecked `malloc`/`realloc`/syscall47- Error message without `strerror` + context48- Hand-rolled declaration of system function49- Kernel/httpd indent rules applied to GNU tree without project say-so5051## Verification5253- GNU `indent` with standards flags on changed files (optional separate commit)54- `grep -E '.{80}'` on touched lines55- `./configure && make check` (or project test target)56- Capsule probes on new conditionals and error paths57- Cross-check: not mixing httpd 4-space or kernel tab style585960## References6162- `awesome-guidelines/references/gnu-style-learning-note.md`63- `awesome-guidelines/references/gnu-style-formatting-layout.md`64- `awesome-guidelines/references/gnu-style-naming-files.md`65- `awesome-guidelines/references/gnu-style-comments-conditionals.md`66- `awesome-guidelines/references/gnu-style-constructs-portability.md`6768## Related skills6970- `c-coding-practices`, portable C safety baseline71- `httpd-c-coding-practices`, ASF httpd layout profile72- `shell-scripting-practices`, Autotools-adjacent shell glue