Install
openclaw skills install misra-automotive-cReview automotive Embedded C code against MISRA C:2012 rules. Flags violations with rule numbers, ASIL classification, and provides a MISRA-compliant replacement for every non-compliant line.
openclaw skills install misra-automotive-c| File | Coverage |
|---|---|
misra-mandatory.md | Mandatory rules — never violate, no deviation allowed |
misra-required.md | Required rules — must comply or raise formal deviation |
types-and-casting.md | Essential types, fixed-width integers, casts, essential type model |
memory-embedded.md | No dynamic alloc, volatile, ISR constraints, stack discipline |
control-flow.md | goto, loops, switch, if-else chains, single exit |
preprocessor.md | Macros, include guards, #undef, ## operator |
iso26262-mapping.md | ASIL A–D relevance for key MISRA C:2012 rules |
Activate this skill when the user:
misra-mandatory.md)Mandatory rules have zero tolerance — flag every violation immediately. Priority mandatory checks:
goto<stdarg.h> featuresmalloc, calloc, realloc, freemisra-required.md, types-and-casting.md, control-flow.md, preprocessor.md)Required rules must be complied with unless a formal deviation exists. Check:
default clause (Rule 16.4)if-else if chains end with else (Rule 15.7)memory-embedded.md)volatile used on all hardware-mapped registers and shared ISR variablesiso26262-mapping.md)Output the report in EXACTLY this format for every violation found:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
VIOLATION #<N>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Rule : MISRA C:2012 Rule <X.Y>
Category : Mandatory | Required | Advisory
ASIL : A | B | C | D | Not mapped
Severity : CRITICAL | HIGH | MEDIUM | LOW
Location : Line <N> — <brief description of what the line does>
Non-Compliant Code:
<exact offending line(s)>
Why it violates Rule <X.Y>:
<1–3 sentence plain-English explanation of the rule and why this code breaks it>
MISRA-Compliant Replacement:
<corrected code, complete and ready to use>
Explanation of fix:
<1–2 sentences explaining what changed and why it is now compliant>
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
After all individual violations, output a summary table:
REVIEW SUMMARY
──────────────────────────────────────────────────
Total violations : <N>
Mandatory : <N> ← must fix before any safety certification
Required : <N> ← must fix or raise formal deviation
Advisory : <N> ← recommended to fix
ASIL breakdown:
ASIL D : <N> ← safety critical, fix immediately
ASIL C : <N>
ASIL B : <N>
ASIL A : <N>
Not mapped : <N>
Overall compliance status: FAIL | CONDITIONAL | PASS
──────────────────────────────────────────────────
When asked to generate new automotive/embedded C code (not review existing code):
Always apply these rules unconditionally — no exceptions:
Types:
uint8_t, uint16_t, uint32_t, uint64_t, int8_t, int16_t, int32_t, int64_t — never int, unsigned int, long, char for numeric databool (from <stdbool.h>) for boolean values — never integer flagsMemory:
malloc, calloc, realloc, or freevolatileControl flow:
gotoif / else if chains end with elseswitch statements have a defaultreturn at the end when possibleFunctions:
Macros:
static inline functions over function-like macros#ifndef FILENAME_H / #define FILENAME_H / ... / #endif)ISR, _IRQ, _Handler, _isr, or has a __attribute__((interrupt)) annotation), apply memory-embedded.md ISR rules with heightened strictness.