misra-c-standards

misra-c-standards is a cursor rule for Cursor from j4flmao/agent-skills. It costs 15 tokens per session (353 once invoked), scanned A, original, MIT.

A set of safety rules for writing C, C++, or Rust code for embedded devices and real-time operating systems.

In plain words
What is it for?
Use it when developing firmware or other embedded software that must follow these memory, interrupt, loop, and hardware-access rules.
Why use it?
It prevents practices that can make devices unpredictable or unsafe, such as dynamic memory allocation or blocking inside interrupt handlers.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when developing firmware or other embedded software that must follow these memory, interrupt, loop, and hardware-access rules.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/j4flmao/agent-skills/misra-c-standards
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.

Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Cursor.

Wrote 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.

agentmods badge for misra-c-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/j4flmao/agent-skills/misra-c-standards.svg)](https://agentmods.dev/rules/j4flmao/agent-skills/misra-c-standards)
Your own site
<a href="https://agentmods.dev/rules/j4flmao/agent-skills/misra-c-standards"><img src="https://agentmods.dev/badge/rules/j4flmao/agent-skills/misra-c-standards.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 353 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00015 $0.00353
Opus 5 $0.00008 $0.00177
Sonnet 5 $0.00003 $0.00071
Haiku 4.5 $0.00002 $0.00035

Measured 2d ago against content hash 11a61fd19ff1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

misra-c-standards 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.

.cursor/rules/misra-c-standards.mdc · 26 lines

What it actually says

Embedded & MISRA-C Safety Standards

Cursor/AI MUST follow these rules when writing C/C++ or Rust code for Embedded Systems or RTOS environments.

1. Ban Dynamic Memory Allocation

  • Rule: NEVER use malloc(), calloc(), realloc(), or free() (or the C++ new keyword) in embedded C code.
  • Why: Heap fragmentation will eventually cause malloc() to fail or take non-deterministic time, crashing the device.
  • Action: All memory MUST be statically allocated at compile time (use global arrays, memory pools, or the stack).

2. ISR (Interrupt Service Routine) Restrictions

  • Rule: NEVER call blocking functions inside an ISR.
  • Action: Do not use printf, do not wait for a Mutex, do not use floating-point math inside an ISR. Defer work to a background task using RTOS Queues or Semaphores.

3. Infinite Loop Safety

  • Rule: In bare-metal programming, the main() function MUST NEVER return.
  • Action: Always end main() with an infinite loop while(1) { ... } or put the CPU into a low-power sleep state __WFI();.

4. Volatile Keyword

  • Rule: All pointers mapping to hardware registers MUST be marked as volatile.
  • Action: E.g., volatile uint32_t * const UART_DR = (uint32_t *)0x40013804;
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 · 26 lines · 15 tokens per session scan A 11a61fd19ff1

Subscribe to this mod's changes

misra-c-standards is a cursor rule published in the GitHub repository j4flmao/agent-skills (22 stars, last pushed yesterday), licensed MIT. It adds 15 tokens to every session and 353 once invoked, about $0.0001 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-09-05.