C Code Styleのロゴ

C Code Style

コミュニティ人気
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".

概要

公開者MaJerle
リポジトリc-code-style
スキル名c-code-style
スター
1.4K
フォーク
269
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    MaJerleがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルC Code StyleをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/MaJerle/c-code-style/tree/main/.claude/skills/c-code-style
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MaJerle/c-code-style.git /tmp/c-code-style
mkdir -p .claude/skills
cp -r /tmp/c-code-style/.claude/skills/c-code-style .claude/skills/c-code-style
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでC Code Styleを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にC Code Styleを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、C Code Styleは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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.

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.

よくある質問

AIスキル「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".

TypingMindでC Code Styleを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。C Code Styleはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにC Code Styleをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/MaJerle/c-code-style/tree/main/.claude/skills/c-code-styleを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

C Code Styleを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

C Code Styleは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもC Code Styleを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「C Code Style」は無料ですか?

はい。MaJerleがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇