interrupts-and-exceptions-baremetal

interrupts-and-exceptions-baremetal is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 63 tokens per session (1,108 once invoked), scanned A, original, MIT.

Guidance for handling interrupts and exceptions on ARM Cortex-M microcontrollers. An interrupt pauses normal code to respond to an event, while an exception handles events such as serious faults.

In plain words
What is it for?
Use it to configure NVIC interrupt priorities, write interrupt handlers, handle faults, share data between handlers and main code, and measure interrupt latency.
Why use it?
It helps avoid slow or unsafe interrupt handlers and diagnose problems such as HardFault crashes, incorrect priorities, and excessive interrupt delay.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to configure NVIC interrupt priorities, write interrupt handlers, handle faults, share data between handlers and main code, and measure interrupt latency.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal
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 mohitmishra786/low-level-dev-skills --skill interrupts-and-exceptions-baremetal
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

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 interrupts-and-exceptions-baremetal

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal/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 interrupts-and-exceptions-baremetal

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,108 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00063 $0.01108
Opus 5 $0.00032 $0.00554
Sonnet 5 $0.00013 $0.00222
Haiku 4.5 $0.00006 $0.00111

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

Security

Grade A, and why

interrupts-and-exceptions-baremetal 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 11d 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.

skills/baremetal/interrupts-and-exceptions-baremetal/SKILL.md · 140 lines

How it starts

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

Interrupts and Exceptions (Bare-Metal)

Purpose

Guide agents through bare-metal interrupt handling on ARM Cortex-M: NVIC configuration, ISR writing rules, exception handlers (HardFault, BusFault), priority grouping, nesting, tail-chaining, and latency considerations.

When to Use

  • Configuring peripheral IRQ priorities
  • Writing ISRs that must not block
  • Debugging HardFault after enabling interrupts
  • Sharing data between ISR and main loop
  • Optimizing interrupt latency

Workflow

1. NVIC overview (Cortex-M)

Exception / IRQ flow
├── NVIC receives IRQ (priority compare with BASEPRI/PRIMask)
├── Stacking: automatic save r0-r3, r12, lr, pc, psr
├── Branch to handler from vector table
├── Handler runs (should be short)
└── Unstack and return — tail-chain if another IRQ pending

2. Enable and prioritize an IRQ

#include "stm32f4xx.h"  /* CMSIS device header */

void uart_irq_init(void) {
    NVIC_SetPriority(USART2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 2, 0));
    NVIC_EnableIRQ(USART2_IRQn);
}

Priority: lower numeric value = higher urgency (on most Cortex-M implementations). Check vendor docs for grouping bits.

3. ISR template

void USART2_IRQHandler(void) {
    if (USART2->SR & USART_SR_RXNE) {
        uint8_t b = (uint8_t)USART2->DR;  /* read clears RXNE */
        ringbuf_push(b);
    }
    if (USART2->SR & USART_SR_ORE) {
        (void)USART2->DR;  /* clear overrun */
    }
}

ISR rules:

  • No blocking calls (printf, malloc, long loops)
  • Minimize work — defer to main via flag/ring buffer
  • Clear interrupt flags per datasheet (read-to-clear vs write-1-clear)

4. Critical sections

uint32_t primask = __get_PRIMASK();
__disable_irq();
/* atomic section */
__set_PRIMASK(primask);

Or raise BASEPRI to mask lower-priority IRQs only.

5. HardFault handler

void HardFault_Handler(void) {
    __asm volatile(
        "tst lr, #4\n"
        "ite eq\n"
        "mrseq r0, msp\n"
        "mrsne r0, psp\n"
        "b hard_fault_c\n"
    );
}

void hard_fault_c(uint32_t *stack) {
    uint32_t r0  = stack[0];
    uint32_t pc  = stack[6];
    uint32_t psr = stack[7];
    /* log pc — GDB: info registers, bt */
    while (1);
}

Read the full file on GitHub · 140 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. 11d ago First seen · 140 lines · 63 tokens per session scan A 82c3c5dbc162

Subscribe to this mod's changes

interrupts-and-exceptions-baremetal is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (202 stars, last pushed 2mo ago), licensed MIT. It adds 63 tokens to every session and 1,108 once invoked, about $0.0003 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-08-30.

Related

Other skills, from other repositories

fusion-360

Comprehensive operational skill specification for Anthropic Claude to automate, script, troubleshoot, and optimize Autodesk Fusion (Fusion 360), Python API (adsk.fusion), Parametric Timeline, and CAM toolpaths.

alivirgo/Major-AI-Skills · 46 tokens

altium-designer

Automate Altium Designer PCB workflows with DXP scripts, design-rule checks, OutJob fabrication outputs, and routing configuration.

alivirgo/Major-AI-Skills · 30 tokens

eartrumpet

Inspect and route per-application audio with EarTrumpet, WASAPI, and pycaw; troubleshoot audio sessions and output devices.

alivirgo/Major-AI-Skills · 32 tokens

codesys

Develop CODESYS Structured Text and Python ScriptEngine workflows; troubleshoot fieldbus and OPC UA integration in a test environment.

alivirgo/Major-AI-Skills · 27 tokens

pcbway

PCBWay PCB fabrication and assembly — turnkey/consigned assembly, design rules, ordering workflow. Alternative to JLCPCB for manufacturing. Use with KiCad. Use this skill when the user mentions PCBWay, needs turnkey assembly (PCBWay sources parts by MPN), has parts not available on LCSC, needs assembled boards with…

aklofas/kicad-happy · 119 tokens

unifi-protect

How to manage UniFi Protect cameras and NVR — view cameras, smart detections, Find Anything detection search, recordings, snapshots, lights, sensors, Known Faces, license plates, and the Alarm Manager. Use this skill when the user mentions UniFi cameras, security cameras, NVR, recordings, motion detection, person…

sirkirby/unifi-mcp · 112 tokens