misra-c-standards

misra-c-standards is a cursor rule for Cursor from j4flmao/agent-skills. It costs 15 tokens per session (643 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/github.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/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.

agentmods 80×15 button for misra-c-standards

Your own site · 80×15
<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="Reviewed on agentmods" width="80" 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 643 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.00643
Opus 5.5 $0.00006 $0.00257
Sonnet 5.5 $0.00003 $0.00129
Haiku 4.5 $0.00002 $0.00064

Measured 10d ago against content hash e1f276f87463, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-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 10d 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 · 34 lines

How it starts

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

Embedded & MISRA-C Safety Standards

Cursor/AI MUST follow these rules when writing C/C++ or Rust code for Embedded Systems or RTOS environments. Reference standard: MISRA C:2012 (with amendments) / MISRA C:2023.

1. No Dynamic Memory Allocation at Runtime

  • Rule: Do not use malloc(), calloc(), realloc(), or free() (MISRA C:2012 Rule 21.3), or C++ new/delete, after initialization.
  • Why: Heap fragmentation and non-deterministic allocation time eventually cause allocation failures or missed deadlines in long-running devices.
  • Action: Allocate statically (global/static arrays, fixed-size memory pools, stack). If an RTOS heap is unavoidable, allocate only during startup and never free (e.g. FreeRTOS heap_1 or static creation APIs like xTaskCreateStatic). In Rust, use #![no_std] with heapless collections.

2. ISR (Interrupt Service Routine) Restrictions

  • Rule: NEVER block inside an ISR. Do not call printf, take a mutex, or wait on a queue.
  • Action: Keep ISRs short. Clear the interrupt source, capture data, and defer the work to a task using ISR-safe APIs (FreeRTOS xQueueSendFromISR, xTaskNotifyFromISR, then portYIELD_FROM_ISR).
  • Floating point: Avoid it in ISRs unless the FPU context is saved. On Cortex-M4F/M7, lazy stacking makes it correct but adds latency; on cores without an FPU it is slow soft-float.

3. main() Never Returns

  • Rule: In bare-metal programs, main() MUST NOT return; there is nothing to return to.
  • Action: End main() with a superloop for (;;) { ... } that sleeps with __WFI() when idle, or start the RTOS scheduler (which does not return).

4. volatile and Shared Data

  • Rule: Access memory-mapped registers through volatile pointers, preferably via the vendor/CMSIS device header rather than hand-written addresses.
    /* Example only (STM32F1 USART1->DR); take addresses from the device header */
    volatile uint32_t * const UART_DR = (volatile uint32_t *)0x40013804u;
    
  • Rule: Mark variables shared between an ISR and the main context volatile. volatile does not make access atomic: protect multi-word or read-modify-write access with a critical section or atomic operations.

Read the full file on GitHub · 34 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. 10d ago Changed · +8 lines e1f276f87463
  2. 2mo 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 (39 stars, last pushed 4d ago), licensed MIT. It adds 15 tokens to every session and 643 once invoked, about $0.0001 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-09-05.

Related

misra-c-standards compared with cursor rules from other repositories

misra-c-standards next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
misra-c-standardsj4flmao/agent-skillsCursor rule394d agoMITA15Cursor
embedded-stm32-halPatrickJS/awesome-cursorrulesCursor rule41k5mo agoCC0-1.0A0Cursor
rossanjeed5/awesome-cursor-rules-mdcCursor rule3.6k5mo agoCC0-1.0A2,129Cursor
move-copy-semanticsxLLM-AI/xllmCursor rule1.6ktodayApache-2.0A410Cursor
vios-error-securityNVIDIA-AI-Blueprints/video-search-and-summarizationCursor rule2.0ktodayApache-2.0A0Cursor
cppClickHouse/ai-sdk-cppCursor rule1902mo agoApache-2.0A312Cursor
cliDataZooDE/flapiCursor rule757d agononeA109Cursor