safety-critical-patterns

safety-critical-patterns is a skill for Claude Code from HermeticOrmus/LibreEmbed-Claude-Code. It costs 58 tokens per session (1,511 once invoked), scanned A, original, MIT.

A reference guide for writing C programs used in safety-critical devices, such as vehicles or medical equipment, according to MISRA C rules. These rules make code more predictable and easier to check.

In plain words
What is it for?
Choosing explicit data types, writing functions with one exit point, handling constants correctly, and applying MISRA C and safety-focused firmware patterns.
Why use it?
It helps avoid common coding patterns that can cause failures or make safety reviews harder. It also gives concrete examples of compliant and non-compliant C code.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the safety-critical plugin — 1 skill, 1 command, 1 agent shipped together

Good fit Choosing explicit data types, writing functions with one exit point, handling constants correctly, and applying MISRA C and safety-focused firmware patterns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hermeticormus/libreembed-claude-code/safety-critical-patterns
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.

Any agent
npx skills add HermeticOrmus/LibreEmbed-Claude-Code --skill safety-critical-patterns
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code

Made for: Claude Code.

Or install safety-critical, the plugin that ships this one along with the rest of its 1 skill, 1 command, 1 agent.

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 safety-critical-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/safety-critical-patterns/github.svg)](https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/safety-critical-patterns)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/safety-critical-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/safety-critical-patterns/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 safety-critical-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/safety-critical-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/safety-critical-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,511 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.00058 $0.01511
Opus 5.5 $0.00023 $0.00604
Sonnet 5.5 $0.00012 $0.00302
Haiku 4.5 $0.00006 $0.00151

Measured 2mo ago against content hash c383a56a0b93, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

safety-critical-patterns 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 2mo 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.

plugins/safety-critical/skills/safety-critical-patterns/SKILL.md · 202 lines

How it starts

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

safety-critical-patterns

Knowledge Base

MISRA C compliance and safety-critical firmware patterns.


Pattern 1: MISRA C Compliant Type Annotations

MISRA mandates explicit types. Use <stdint.h> types throughout.

/* Non-compliant (implicit types): */
int i;
unsigned char flags;

/* MISRA compliant: */
#include <stdint.h>
#include <stdbool.h>

int32_t  i;
uint8_t  flags;
bool     enable;

/* Rule 7.1: Octal constants */
/* VIOLATION: */
uint8_t val = 010;   /* Octal 8, not decimal 10 */
/* COMPLIANT: */
uint8_t val = 0x08U;

/* Rule 7.2: Unsigned constants must have U suffix */
/* VIOLATION: */
uint32_t x = 100;
/* COMPLIANT: */
uint32_t x = 100U;

Pattern 2: Single-Exit Function Pattern (Rule 15.5)

MISRA 15.5: a function shall have a single point of exit.

/* NON-COMPLIANT: multiple returns */
int32_t process(uint8_t *buf, uint32_t len)
{
    if (buf == NULL) { return -1; }
    if (len == 0U)   { return -2; }
    /* process */
    return 0;
}

/* COMPLIANT: single exit */
int32_t process(uint8_t *buf, uint32_t len)
{
    int32_t result = 0;

    if (buf == NULL) {
        result = -1;
    } else if (len == 0U) {
        result = -2;
    } else {
        /* process */
        result = 0;
    }

    return result;
}

This is advisory in MISRA 2012 (was required in MISRA 2004), but required for DO-178C DAL-A.


Pattern 3: MISRA Suppression Comments

When a violation is justified, document it with a suppression comment and deviation record.

/* MISRA C:2012 Rule 11.5 Deviation:
   Reason: CMSIS HAL requires void* for peripheral handle cast.
   Risk: Low — type verified by HAL layer.
   Reviewed by: J.Smith, 2024-03-15, ref: DEV-2024-011 */
/*lint -e9087 */  /* PC-lint suppression */
void *handle = (void *)&hspi1;   /* PRQA S 0306 */   /* Polyspace suppression */
/*lint +e9087 */

Deviation records must be maintained in a deviation log linked to each suppression.


Pattern 4: RAM Test (March-C Algorithm)

March-C tests SRAM integrity at startup (required for IEC 61508 SIL 2+).

Read the full file on GitHub · 202 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. 2mo ago Changed · +5 lines · +58 tokens per session c383a56a0b93
  2. 3mo ago First seen · 197 lines · 0 tokens per session scan A 1d024ad6c418

Subscribe to this mod's changes

safety-critical-patterns is a skill published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (50 stars, last pushed 1mo ago), licensed MIT. It adds 58 tokens to every session and 1,511 once invoked, about $0.0002 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-08-30.

Related

safety-critical-patterns compared with skills from other repositories

safety-critical-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
safety-critical-patternsHermeticOrmus/LibreEmbed-Claude-CodeSkill501mo agoMITA58Claude Code
volt-otatonone-ai/tononeSkill842d agoMITA70Claude Code
volt-firmwaretonone-ai/tononeSkill842d agoMITA76Claude Code
volt-powertonone-ai/tononeSkill842d agoMITA65Claude Code
volt-drivertonone-ai/tononeSkill842d agoMITA63Claude Code
volt-recontonone-ai/tononeSkill842d agoMITA52Claude Code
iot-expertpersonamanagmentlayer/pclSkill461mo agoApache-2.0A59Claude Code