Agent skill

C Code Style

by MaJerle in MaJerle/c-code-style

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.

MITAuto-check passedWriting & Content

Install C Code Style

skills CLI
$ npx skills add MaJerle/c-code-style --skill c-code-style -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install MaJerle/c-code-style c-code-style --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/MaJerle/c-code-style.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/c-code-style .claude/skills/c-code-style && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
c-code-style
GitHub stars
1.4k
Token cost
~1.3k tokens
SKILL.md length
675 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

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.

  • Works in 5 steps: Read the rules first → What clang-format fixes for you → What clang-format will NOT fix — apply… → …
  • Edit a .c/.h file
  • SKILL.md covers 1. Read the rules first, 2. What clang-format fixes for…, 3. What clang-format will NOT… and 4. Format the code, plus 1 more section
  • Calls brew

What it does

C Code Style is an agent skill from MaJerle/c-code-style. 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".

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Writing & Content, covering Plain language and style rules. The repository describes itself as: Recommended C code style and coding rules for standard C99 or later. Comes with AI agent skill to write, edit and format the code. The licence is MIT.

When your agent uses it

  • Edit a .c/.h file
  • Review C code style
  • Run clang-format
  • Check clang-format

Example prompts

  • “write C code”
  • “edit a .c/.h file”
  • “review C code style”
  • “/c-code-style”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Read the rules first
  2. What clang-format fixes for you
  3. What clang-format will NOT fix — apply these yourself while writing
  4. Format the code
  5. Verified behavior

What it can do on your machine

Read from SKILL.md and the folder at commit 746a501. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • brew

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

C Code Style loads about 1.3k tokens when it runs. Until then it costs about 79 tokens; SKILL.md has 675 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~79
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from MaJerle/c-code-style at commit 746a501, republished under its MIT licence (© MaJerle). 675 words, ~1,299 tokens.

Download SKILL.mdSave it as .claude/skills/c-code-style/SKILL.md (or your agent's skills folder).
name
c-code-style
description
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:

  • Names (variables, parameters, struct/enum members) are lowercase with underscores and at least 3 characters. Never a bare __/_ prefix. static module-private functions use a prv_ prefix.
  • Use stdint.h types (uint8_t, int32_t, ...) except char/float/double. Avoid stdbool.h; use 1/0.
  • Don't rely on static initializers for global/static variables that need a real startup value in embedded contexts — give the module an init() function instead.
  • Declare all locals at the top of a block, grouped by type, in order: custom structs/enums (and their pointers) → integers (widest unsigned first) → floating point.
  • const-correct pointers and parameters; generic pointers are void*, cast internally, never cast a void* return value.
  • Every function with zero parameters uses (void), never empty ().
  • A function has at most 2 return points: one early return for parameter/argument validation, one at the end. No return in the middle — use a return-value variable to accumulate the result instead.
  • Check a pointer against NULL before dereferencing it (unless the surrounding code guarantees it can't be NULL). After free(ptr), immediately set ptr = NULL.
  • Boolean-treated variables are compared with if (x) / if (!x), never == 1 / == 0; counter/value variables use > 0 / == 0, never bare if (x).
  • Doxygen: every function (including static ones) gets a \brief, a \param[in]/\param[out] per parameter, and a \return if it returns non-void. The doc block goes at the function's definition (where the body is, typically the .c file) — never duplicated at the declaration in the header. Pad tags so description text starts at column 22 (see template.c/template.h for the exact alignment). Wrap identifiers, constants, and literals referenced in prose in backticks.
Show full SKILL.md (202 more words)Show less

4. Format the code

After writing or editing any .c/.h file, run the formatter using this repository's .clang-format (it's found automatically by walking up from the file's directory — no path needed):

sh
scripts/check-format.sh <changed-file.c> [<changed-file.h> ...]

This script:

  1. Checks clang-format is on PATH and is version 20 or newer (this repo's minimum — see CODING_RULES.md, General rules).
  2. If missing or too old, prints the install command for the current OS (brew install llvm on macOS, distro package or LLVM apt repo on Linux, the LLVM installer on Windows) and exits non-zero — install it, then re-run.
  3. Otherwise runs clang-format -i on the given files.

To verify compliance without writing changes (e.g. before reporting a task done), use --check instead:

sh
scripts/check-format.sh --check <file.c> [<file.h> ...]

Exits 0 if already compliant, non-zero (with the specific violations) if not.

5. Verified behavior

This flow was tested directly in this repository: check-format.sh correctly refuses to run when clang-format is absent (prints the right install command per OS and exits 1), and — once clang-format is installed — correctly detects a deliberately mis-formatted file with --check, fixes it with the default (in-place) mode, and re-verifies clean afterward. template.c and template.h in this repository both pass --check as-is — use them as a reference for exact formatting and doxygen alignment.

© MaJerle, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/c-code-style of MaJerle/c-code-style.

Open the folder on GitHubat commit 746a501

Compare with similar skills

C Code Style next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

C Code Style compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
C Code Style this skillMaJerle/c-code-style1.4k—~1.3kAutomated safety check: PassMIT
Asd Ste100danyuchn/asd-ste100-skill3.9k—~4.1kAutomated safety check: PassMIT
Natural Japanese Business Writingcoji/natural-japanese1.9k—~2.1kAutomated safety check: PassMIT
Technical Writing Standardcursor/plugins10k10 repos~2.4kAutomated safety check: PassNone
PgjevrealZachi/pg-jev1k—~2.9kAutomated safety check: PassCustom licence
Defensive Writing Editorlennney/stop-that-shit2.5k1 repos~902Automated safety check: PassMIT

Similar skills

  • Asd Ste100

    danyuchn/asd-ste100-skill

    A skill your agent uses when English text must be parsed without a human to resolve ambiguity — tool descriptions, error messages, inter-agent instructions, system prompts, status reports — and…

    3.9k GitHub stars~4.1k tokensUpdated 3 days ago
    Writing & ContentAuto-check passed
  • Writes and edits Japanese business documents so they read clearly and naturally, removes AI-sounding phrasing and can score how AI-like a text reads.

    1.9k GitHub stars~2.1k tokensUpdated 1 mo ago
    Writing & ContentAuto-check passed
  • Official

    Applies four layers of technical-writing rules to docs, RFCs, readmes, PR descriptions and commit messages so a tired engineer follows them on the first read.

    10k GitHub starsUsed in 10 repos~2.4k tokens
    Writing & ContentAuto-check passed
  • Pgjev

    realZachi/pg-jev

    Install, configure, query and explain pgjev (the jev PostgreSQL extension that filters, ranks and classifies rows with plain-language conditions via TypeSafe's Jev model).

    1k GitHub stars~2.9k tokensUpdated yesterday
    Writing & ContentAuto-check passed
  • Defensive Writing Editor

    lennney/stop-that-shit

    Cuts defensive disclaimers, stacked hedging and self-protective narration from proposals and summaries, keeping only limits that affect the reader's decision.

    2.5k GitHub starsUsed in 1 repo~902 tokens
    Writing & ContentAuto-check passed
  • JavaScript Concept Page Writer

    leonardomso/33-js-concepts

    Writes or reviews documentation pages for the 33 JavaScript Concepts project, following its structure, a beginner-friendly voice and rules against AI-sounding language.

    67k GitHub stars~14k tokensUpdated 26 days ago
    Writing & ContentAuto-check passed

Questions about C Code Style

What does C Code Style do?

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. C Code Style is an agent skill from MaJerle/c-code-style. 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.

When should I use C Code Style?

C Code Style fits situations like: edit a .c/.h file; review C code style; run clang-format; check clang-format.

How do I install C Code Style in Claude Code?

Run `npx skills add MaJerle/c-code-style --skill c-code-style -a claude-code`. Or copy the skill folder (.claude/skills/c-code-style in MaJerle/c-code-style) into .claude/skills/c-code-style in your project. Claude Code loads it when a task matches its description.

How do I install C Code Style in Codex?

Run `npx skills add MaJerle/c-code-style --skill c-code-style -a codex`. Or copy the skill folder (.claude/skills/c-code-style in MaJerle/c-code-style) into .agents/skills/c-code-style in your project. Codex loads it when a task matches its description.

Can I use C Code Style in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add MaJerle/c-code-style --skill c-code-style -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/c-code-style, .gemini/skills/c-code-style, .github/skills/c-code-style and .opencode/skills/c-code-style in your project.

What does C Code Style need to run?

Going by SKILL.md and its folder, C Code Style needs the command-line tools its instructions call (brew).

Does C Code Style access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is C Code Style safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does C Code Style use?

C Code Style is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does C Code Style use?

About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to C Code Style?

Skills that share tags, products or a category with C Code Style: Asd Ste100 (danyuchn/asd-ste100-skill, 3.9k stars), Natural Japanese Business Writing (coji/natural-japanese, 1.9k stars), Technical Writing Standard (cursor/plugins, 10k stars) and Pgjev (realZachi/pg-jev, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains C Code Style?

MaJerle (a GitHub user) maintains it in MaJerle/c-code-style, which has 1,351 GitHub stars. The repository was last updated on September 9, 2026.

Source: MaJerle/c-code-style on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.