bare-metal-patterns

bare-metal-patterns is a skill for Claude Code from HermeticOrmus/LibreEmbed-Claude-Code. It costs 62 tokens per session (2,208 once invoked), scanned A, original, MIT.

A collection of production C programming patterns for ARM Cortex-M microcontrollers, using the arm-none-eabi-gcc compiler and the C11 language standard. Microcontrollers are small computers built into devices.

In plain words
What is it for?
Use it when writing embedded firmware for Cortex-M devices, including register bit operations and GPIO setup for hardware such as LEDs and buttons.
Why use it?
It provides consistent low-level examples for controlling hardware directly without depending on a larger hardware library.

Skill for Claude Code

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

Part of the bare-metal plugin — 1 skill, 1 command, 1 agent shipped together

Good fit Use it when writing embedded firmware for Cortex-M devices, including register bit operations and GPIO setup for hardware such as LEDs and buttons.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hermeticormus/libreembed-claude-code/bare-metal-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 bare-metal-patterns
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreEmbed-Claude-Code

Made for: Claude Code.

Or install bare-metal, 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 bare-metal-patterns

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/hermeticormus/libreembed-claude-code/bare-metal-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreembed-claude-code/bare-metal-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,208 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.00062 $0.02208
Opus 5.5 $0.00025 $0.00883
Sonnet 5.5 $0.00012 $0.00442
Haiku 4.5 $0.00006 $0.00221

Measured 21d ago against content hash 621c67cf4f90, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bare-metal-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 21d 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/bare-metal/skills/bare-metal-patterns/SKILL.md · 240 lines

How it starts

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

bare-metal-patterns

Knowledge Base

Production bare-metal C patterns for ARM Cortex-M. All code uses arm-none-eabi-gcc, C11.


Pattern 1: Register Bit Manipulation Macros

Consistent, readable register access without HAL dependency.

/* Generic bit manipulation — safe for any 32-bit register */
#define REG_SET_BIT(reg, bit)      ((reg) |=  (1U << (bit)))
#define REG_CLR_BIT(reg, bit)      ((reg) &= ~(1U << (bit)))
#define REG_TST_BIT(reg, bit)      (((reg) >> (bit)) & 1U)

/* Set a multi-bit field: mask off old value, OR in new value */
#define REG_SET_FIELD(reg, mask, shift, val) \
    ((reg) = ((reg) & ~(mask)) | (((val) << (shift)) & (mask)))

/* Example: set USART1 baud rate divisor in BRR register */
/* BRR = fCK / baud (oversampling by 16) */
#define USART_BRR_SET(uart, fck, baud) \
    ((uart)->BRR = (uint32_t)((fck) / (baud)))

USART_BRR_SET(USART1, 84000000UL, 115200UL);  /* STM32F4 APB2 @ 84MHz */

Pattern 2: GPIO Configuration (Register Level)

Full GPIO setup for STM32F4 without HAL:

/* PA5 = LED (push-pull output), PA0 = button (input, pull-up) */
void gpio_init(void)
{
    /* 1. Enable GPIOA clock */
    RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
    (void)RCC->AHB1ENR;            /* Bus latency flush: read back after write */

    /* 2. PA5: General purpose output, push-pull, high speed */
    GPIOA->MODER   = (GPIOA->MODER & ~(3U << 10)) | (1U << 10);  /* MODER5 = 01 */
    GPIOA->OTYPER &= ~(1U << 5);                                  /* Push-pull */
    GPIOA->OSPEEDR|=  (3U << 10);                                 /* Very high speed */
    GPIOA->PUPDR   = (GPIOA->PUPDR & ~(3U << 10));                /* No pull */

    /* 3. PA0: Input, pull-up */
    GPIOA->MODER   = (GPIOA->MODER & ~(3U << 0));   /* MODER0 = 00: input */
    GPIOA->PUPDR   = (GPIOA->PUPDR & ~(3U << 0)) | (1U << 0);  /* Pull-up */
}

static inline void led_on(void)  { GPIOA->BSRR = (1U << 5);       }
static inline void led_off(void) { GPIOA->BSRR = (1U << (5+16));  }
static inline void led_toggle(void) { GPIOA->ODR ^= (1U << 5);    }
static inline int  btn_read(void) { return (int)((GPIOA->IDR >> 0) & 1U); }

Read the full file on GitHub · 240 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. 21d ago Changed · +5 lines · +62 tokens per session 621c67cf4f90
  2. 1mo ago First seen · 235 lines · 0 tokens per session scan A 89692ae8788c

Subscribe to this mod's changes

bare-metal-patterns is a skill published in the GitHub repository HermeticOrmus/LibreEmbed-Claude-Code (50 stars, last pushed 12d ago), licensed MIT. It adds 62 tokens to every session and 2,208 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

Other skills, from other repositories

mspm0-skill

Tool-neutral CLI agent rules for TI MSPM0 development with SysConfig, DriverLib, CCS, Keil/uVision, CMake/GCC/OpenOCD, and supported board references. Use when an agent needs to inspect or modify MSPM0 projects, validate SysConfig output, package examples, or work on NUEDC embedded firmware.

Ibook000/mspm0-skill · 76 tokens

doca-argp

Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring docaargpinit → register params → docaargpstart → docaargpdestroy in order; picking a parameter type from the full public enum (DOCAARGPTYPESTRING, INT, BOOLEAN, DEVICE, DEVICEREP…

NVIDIA/skills · 267 tokens

holoscan-module-lifecycle

Develop external Holoscan Modules with the Holoscan CLI and use them in Holoscan applications: scaffold, test, Python bindings, DEB/WHEEL packaging, and clean-consumer proof.

NVIDIA/skills · 47 tokens

embedded-stm32

Best practices for embedded C/C++ development on STM32 microcontrollers using the HAL, covering peripherals, DMA, interrupts, memory constraints, and hardware-focused testing. Use when writing STM32 HAL code, configuring peripherals generated by STM32CubeMX, working with interrupts or DMA, debugging with SWD/JTAG…

Mindrally/skills · 87 tokens

opengis-skills

Use when AI coding assistant needs GIS/CAD/C#/AI/IoT/3D domain expertise. Index of 96 skills across 8 categories: gis (32), cad (21), csharp (9), ai (14), iot (2), 3d (6), demos (4), others (8). Tag-based search and on-demand loading for GDAL, GeoServer, MapServer, Leaflet, PROJ, PostGIS, JTS, CesiumJS, FreeCAD…

znlgis/opengis-skills · 146 tokens

acad-arx-wizard

Agentic ObjectARX project scaffolding for AutoCAD 2027 / Visual Studio 2026. Replaces the broken .vsz VsWizardEngine wizard with a PowerShell script that generates identical C++ project files. Works for new ARX/DBX/CRX projects and add-on class wizards (Jig, Reactors, Custom Object, MFC, .NET Wrapper, COM Wrapper…

autodesk-platform-services/skills · 92 tokens