Skills

C Code Style

Write, edit, or review C (and C-compatible header) code according to C coding style...

Install

npx skills add MaJerle/c-code-style --skill c-code-style -g -a claude-code -y
Repository
MaJerle/c-code-style1.4k
Category
Writing
Updated
11d ago
License
MIT
Context cost
Lightabout 1,213 tokens
Runs scripts
No, instructions only

What it does

Write, edit, or review C (and C-compatible header) code according to C coding style rules, then check and run clang-format to enforce formatting. Trigger on "write C code", "edit a .c/.h file", "review C code style", "format C code", "run clang-format", "check clang-format", "apply the C style guide".

C code style

This skill applies whenever you are writing, editing, or reviewing .c or .h files in a project that adopts this style guide. The full rule set lives in CODING_RULES.md at the repository root, that file is the single source of truth (this repository's README.md is just a symlink to it, so it renders on the GitHub front page). This skill exists to make the rules operational: what to self-apply while writing code, and how to run the formatter afterward.

1. Read the rules first

Before writing or editing C code, read CODING_RULES.md in this repository (or wherever this skill was installed alongside it, if it's not there, the checklist in step 3 below is a self-contained fallback). Do not rely on memory of "typical" C style, several of this guide's rules are deliberately non-default (e.g. (void) on zero-parameter functions, at most 2 return points per function, no stdbool.h).

2. What clang-format fixes for you

Don't hand-format these, write reasonably and let the formatter normalize them in step 4: indentation and spacing, brace placement, pointer-asterisk alignment, function-prototype alignment, trailing commas in struct initializers, blank-line and parenthesis spacing.

3. What clang-format will NOT fix, apply these yourself while writing

These are semantic or naming rules; a formatter cannot infer them. Apply them as you write, not after:

Read the whole SKILL.md on GitHub

More in Writing