write-c

A set of rules for writing C code within a specific runtime, including where code belongs and who owns allocated memory.

In plain words
What is it for?
Use it when adding C source files, extending existing translation units, managing allocations, or crossing native module boundaries.
Why use it?
It reduces errors caused by unclear module boundaries, dependency direction, memory ownership, and control flow.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/leifericf/agentic-sdk/write-c
Any agent
npx skills add leifericf/agentic-sdk --skill write-c
Clone the repo
git clone --depth 1 https://github.com/leifericf/agentic-sdk

Made for: Claude Code, Codex.

Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,432 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00033 $0.01432
Opus 5 $0.00016 $0.00716
Sonnet 5 $0.00007 $0.00286
Haiku 4.5 $0.00003 $0.00143

Measured 2d ago against content hash 8574020ba310, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

write-c scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/write-c/SKILL.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

write-c

Write new C for the runtime. The standard is skills/write-c/references/c-style.md (read it first). The architecture it implements is Functional Core / Imperative Shell; the C expression of that split, and the native boundary contract, live in skills/shared/references/architecture.md. Placement comes from the project's module map (the :architecture :modules entry in the descriptor). The why behind the constraints is the ADR log: scan it before designing anything that feels constrained by an unexplained rule.

Procedure

  1. Place it. Find the owning translation unit in the module map; read that TU end to end before adding to it. Start a new TU only when the responsibility is genuinely new, name it after the responsibility, and add it to the map and the build. Respect the dependency direction the map records; a new cross-module include is a cross-module escalation, not a local convenience.
  2. C discipline. The load-bearing rules, in order:
    • Ownership decision up front. Decide ownership of every allocation before writing: runtime-managed (allocated through the runtime's owner, with temporaries pinned across allocation points) or caller-owned (malloc, freed on every error path). Decide before writing, never retrofit. When a helper allocates twice, write the pin or ownership guard for the first before allocating the second. Never free a runtime-managed value through free; never let a caller-owned struct hold the only reference to a runtime-managed value across an allocation point.
    • Pin and free across yield and throw windows. A prim error is a longjmp past local cleanup, and a blocked or yielding call lets a collection run concurrently. Pin every Lisp value live across such a window; free a caller-owned allocation before firing a throw. Blocking IO counts as much as allocation does.
    • Explicit control flow. Validate early, return early. Invalid input and failure cases exit at the top; the normal path runs at low indentation, not nested inside success conditionals. One important action per line: no assignment inside conditionals, no nested ternaries, no multi-effect loop conditions, no short-circuit chains that hide real work. When resources accumulate, use a single cleanup path (one goto cleanup label) that is safe under partial initialization, not mirrored cleanup blocks in every error branch.
    • Deterministic cleanup. Every caller-owned allocation has a free on every path, including the error path. Buffers travel with lengths; bounds checks sit adjacent to the access they protect. Guard size and index arithmetic before allocation and pointer math (a SIZE_MAX overflow check precedes the multiply it protects), so a hostile length degrades as data instead of overflowing before the guard fires.
    • Error classes. Every failure path picks its class consciously: recoverable for anything a caller can catch and handle; a host or limit error for IO and capacity; abort only with a comment naming why recovery is impossible. User input must never reach an abort. Diagnostics name the failing operation and the reason, never a bare error or failed.
  3. Failure model. The core computes a plan and returns it; the caller acts. Untrusted input (a file from disk, bytes that cross the native edge, a length field a payload controls) is expected, not exceptional: validate it, return an error class when it is malformed, let the shell surface the diagnostic. A decision in C is an enum, a small struct, or a filled out-parameter; make the caller's switch explicit rather than burying the choice inside the effectful loop. No strict-aliasing violations, no pointer punning, no reliance on signed overflow.
  4. Verify like the lanes. Build with the project's cheap lanes first (the compile lane with warnings as errors is the floor), then the module's tests, then the full cheap lane set from the descriptor. If you wrote pointer-heavy or ownership-sensitive code, run the sanitizer and leak lanes yourself before the review wave; a use-after-free or a leak found in the wave is one the writer should have caught.

Read the full file on GitHub · 120 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 120 lines · 33 tokens per session scan A 8574020ba310

Subscribe to this mod's changes

write-c is a skill published in the GitHub repository leifericf/agentic-sdk (5 stars, last pushed 13d ago), licensed MIT. It adds 33 tokens to every session and 1,432 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

i18n-localization

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

vudovn/ag-kit · 27 tokens

seedance-vocab-ja

This skill should be used when the user asks for Japanese Seedance 2.0 prompt wording, Japanese cinematic vocabulary, or translation of camera, lighting, action, VFX, audio, and production terms into Japanese.

Emily2040/seedance-2.0 · 50 tokens

asc-subscription-localization

Bulk-localize subscription, subscription-group, and in-app purchase display names across App Store locales using asc, including API 4.4.1 version-scoped v2 resources. Use when filling or updating subscription/IAP names and descriptions without App Store Connect UI work.

rorkai/app-store-connect-cli-skills · 60 tokens

harden

Improve interface resilience through better error handling, i18n support, text overflow handling, and edge case management. Makes interfaces robust and production-ready.

childrentime/reactuse · 32 tokens

wox-plugin-creator

Create, scaffold, implement, and package Wox plugins (nodejs, python, script-nodejs, script-python). Use when cloning official SDK templates, generating script plugin templates, editing plugin.json metadata, defining SettingDefinitions and validators, wiring i18n, implementing plugin APIs, or preparing plugin…

Wox-launcher/Wox · 100 tokens

experience-aura-lwc-migrate

Use this skill to analyze a Salesforce Aura component bundle (.cmp, .app, .evt, .intf, Controller.js, Helper.js, Renderer.js) and produce a framework-agnostic migration blueprint (PRD.yaml / PRD.md / PRD.json) capturing public API, data requirements, slots, events, states, accessibility, styling, localization, and…

forcedotcom/sf-skills · 243 tokens