Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skillsnpx agentmods add skills/mohitmishra786/low-level-dev-skills/memory-safe-c-cppWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/memory-safe-c-cpp)<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/memory-safe-c-cpp"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/memory-safe-c-cpp/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/memory-safe-c-cpp"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/memory-safe-c-cpp.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00147 | $0.02850 |
| Opus 5.5 | $0.00059 | $0.01140 |
| Sonnet 5.5 | $0.00029 | $0.00570 |
| Haiku 4.5 | $0.00015 | $0.00285 |
Grade A, and why
memory-safe-c-cpp 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 14d 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.
How it starts
The opening of the file, as written. The whole thing — 220 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Memory-Safe C and C++
Purpose
Guide agents through making existing C and C++ safer (checked with GCC 16.2, Clang 23.1 and Fil-C 0.687): what each mitigation actually catches, how to enable it, and when a rewrite is the better answer.
Triggers
- "How do I harden a C codebase without rewriting it?"
- "What does
-fhardenedturn on?" - "Does FORTIFY catch heap overflows?"
- "How do I use Arm MTE or a hardened allocator?"
- "What is Fil-C and should I use it?"
- "Harden, sanitize, or rewrite in Rust?"
Workflow
1. What catches what
Measured on one program with a heap overflow (writing 17 bytes into malloc(16)), a
use-after-free read and a strcpy into char small[8]:
| Build | Heap OOB write | UAF read | strcpy stack overflow |
|---|---|---|---|
gcc -O2 |
not caught | not caught | not caught |
gcc -O2 -fhardened |
not caught | not caught | caught (*** buffer overflow detected ***) |
Scudo allocator (clang -fsanitize=scudo) |
not caught (slack in chunk) | not caught | n/a; double free caught |
| Fil-C | caught (filc safety error) |
caught | caught when it leaves the allocation |
| ASan (testing only) | caught | caught | caught |
Mitigations that run in production reduce exploitability; they do not find all bugs. Use sanitizers and fuzzing in CI, and a safe language or Fil-C where you need guarantees.
Goal?
├── Cheap, ship today → -fhardened + library hardening + -ftrivial-auto-var-init (sections 2-3)
├── Catch bounds bugs on flexible arrays → counted_by + -fsanitize=bounds (section 4)
├── Probabilistic detection in production on Arm → MTE (section 5)
├── Heap metadata attacks → hardened allocator (section 6)
├── Full memory safety, accept slowdown → Fil-C (section 7) or CHERI hardware (section 8)
└── New component → write it in Rust (skills/rust/rust-ffi for the boundary)
2. -fhardened and friends (GCC 14+)
gcc -O2 -fhardened app.c -o app
On GCC 16.2 (aarch64) -fhardened defines _FORTIFY_SOURCE=3, _GLIBCXX_ASSERTIONS,
enables -fstack-protector-strong (__SSP_STRONG__), PIE, and links with
-pie -z now -z relro. On x86 it also enables -fcf-protection=full (__CET__ = 3). Without optimization FORTIFY is
skipped: '_FORTIFY_SOURCE' is not enabled by '-fhardened' because optimizations are turned off.
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.
- 14d ago First seen · 220 lines · 147 tokens per session scan A e89e4e966110
memory-safe-c-cpp is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (310 stars, last pushed 14d ago), licensed MIT. It adds 147 tokens to every session and 2,850 once invoked, about $0.0006 per session on Opus 5.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-11-21.
memory-safe-c-cpp compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| memory-safe-c-cppmohitmishra786/low-level-dev-skills | Skill | 310 | 14d ago | MIT | A | 147 | Claude Code, Codex |
| ecommerce-marketing-strategy-buildernexscope-ai/eCommerce-Skills | Skill | 1.6k | today | MIT | A | 112 | Claude Code, Codex |
| product-description-generatornexscope-ai/eCommerce-Skills | Skill | 1.6k | today | MIT | A | 126 | Claude Code, Codex |
| shopify-marketingnexscope-ai/eCommerce-Skills | Skill | 1.6k | today | MIT | A | 60 | Claude Code, Codex |
| tiktok-shop-cross-bordernexscope-ai/eCommerce-Skills | Skill | 1.6k | today | MIT | A | 55 | Claude Code, Codex |
| ecommerce-landing-pagenexscope-ai/eCommerce-Skills | Skill | 1.6k | today | MIT | A | 45 | Claude Code, Codex |
| market-gap-analysisnexscope-ai/eCommerce-Skills | Skill | 1.6k | today | MIT | A | 38 | Claude Code, Codex |