non-blocking-patterns

non-blocking-patterns is a skill for Claude Code from wedsamuel1230/arduino-skills. It costs 49 tokens per session (610 once invoked), scanned A, original, MIT.

A set of C++ timing patterns for keeping Arduino and embedded programs responsive without long blocking pauses. It covers elapsed-time checks, state machines, input debouncing, bounded waits, watchdogs, and timing measurements.

In plain words
What is it for?
Use it to replace delays, debounce buttons, schedule periodic work, handle sensor or network waits, limit serial parsing and retries, and measure loop latency and timing variation.
Why use it?
Long delay() calls and blocking operations can make buttons feel slow, network or sensor work miss deadlines, and watchdogs reset the device. These patterns make periodic and multi-step work easier to control and test.

Skill for Claude Code

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

Part of the arduino-skills plugin — 33 skills shipped together

Good fit Use it to replace delays, debounce buttons, schedule periodic work, handle sensor or network waits, limit serial parsing and retries, and measure loop latency and timing variation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wedsamuel1230/arduino-skills/non-blocking-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 wedsamuel1230/arduino-skills --skill non-blocking-patterns
Clone the repo
git clone --depth 1 https://github.com/wedsamuel1230/arduino-skills

Made for: Claude Code.

Or install arduino-skills, the plugin that ships this one along with the rest of its 33 skills.

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 non-blocking-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/wedsamuel1230/arduino-skills/non-blocking-patterns/github.svg)](https://agentmods.dev/skills/wedsamuel1230/arduino-skills/non-blocking-patterns)
Your own site
<a href="https://agentmods.dev/skills/wedsamuel1230/arduino-skills/non-blocking-patterns"><img src="https://agentmods.dev/badge/skills/wedsamuel1230/arduino-skills/non-blocking-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 non-blocking-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/wedsamuel1230/arduino-skills/non-blocking-patterns"><img src="https://agentmods.dev/badge/skills/wedsamuel1230/arduino-skills/non-blocking-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 610 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.00049 $0.00610
Opus 5 $0.00024 $0.00305
Sonnet 5 $0.00010 $0.00122
Haiku 4.5 $0.00005 $0.00061

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

Security

Grade A, and why

non-blocking-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 12d 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/non-blocking-patterns/SKILL.md · 60 lines

How it starts

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

Non-Blocking Patterns

Keep the main loop responsive and make timing behavior testable. Prefer C/C++ patterns that can be compiled for the exact board; use Python only for relevant test or log analysis tooling.

Intake

Record board/core version, task periods, deadlines, maximum work duration, input bounce, serial/network behavior, watchdog policy, interrupt constraints, and the safety response for missed deadlines.

Process

  1. List each periodic or event-driven task with period, deadline, and worst-case work. Identify any blocking library call.
  2. Replace long delay() calls with unsigned wrap-safe elapsed checks such as if (static_cast<unsigned long>(now - last) >= period). Use hardware timers or RTOS tasks only when board and framework support is confirmed.
  3. Model multi-step work as an explicit state machine with bounded transitions; do not hide waits inside a helper.
  4. Debounce inputs using a stable-state timer or event filter, not a blocking pause. Bound serial parsing, network retries, and sensor conversion waits.
  5. Define watchdog feeding, output inhibit, timeout, and recovery behavior.
  6. Measure loop latency and task jitter under representative logging, radio, storage, and actuator load.

Anti-rationalization

Shortcut Response
"A shorter delay is fine." It is still blocking; show the deadline and replace it.
"The loop is fast on USB." Measure with the actual radio, storage, and actuator load.
"The enum makes it a state machine." Require timed transitions, explicit entry/exit, and timeout behavior.
"The watchdog can be fed everywhere." Define ownership and fail-safe behavior; do not mask a stuck task.
"millis() never wraps." Use unsigned subtraction and test the wrap boundary.

Verification

  • No unbounded blocking call remains in the time-critical path without a documented reason and timeout.
  • Debounce, wraparound, timeout, and missed-deadline cases have tests.
  • Exact-target compile proof and timing/serial evidence are separate.
  • Outputs enter a safe state when a task, sensor, or communication path times out.

Read the full file on GitHub · 60 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. 12d ago First seen · 60 lines · 49 tokens per session scan A ab8eb995c86b

Subscribe to this mod's changes

non-blocking-patterns is a skill published in the GitHub repository wedsamuel1230/arduino-skills (21 stars, last pushed 22d ago), licensed MIT. It adds 49 tokens to every session and 610 once invoked, about $0.0002 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

gke-ai-troubleshooting-tpu-dynamic-slices-monitoring

Monitors, troubleshoots, and manages GKE TPU Dynamic Slices custom resources. Use when checking TPU slice lifecycle states, troubleshooting slice provisioning failures, validating single-slice or multi-slice (JobSet) workload manifests, or safely patching stuck finalizers and disabling the slice controller. Don't use…

google/skills · 107 tokens

gke-ai-troubleshooting-tpu-vbar-oom

Diagnoses and prevents vbarcontrolagent segfaults, out-of-memory (OOM) errors, and TPU device initialization failures on TPU v6e nodes in GKE caused by race conditions during TPU device resets or high-frequency metrics polling. Use when troubleshooting vbarcontrolagent crashes, memory cgroup OOMs in serial console…

google/skills · 125 tokens

analyze-kernel-bottleneck

Systematically identify whether a GPU kernel is compute-bound, memory-bound, or latency-bound using roofline analysis, occupancy calculations, compute/load ratio per tile, and SASS instruction inspection. Produces a decision matrix for optimization strategy selection (cp.async, warp interleaving, tiling…

pjt222/agent-almanac · 77 tokens

mcubuddy

Use when debugging MCU firmware or boards with McuBuddy, including probe, boot, HardFault, peripheral, register, memory, ELF/SVD, RTOS, RTT/UART, Keil, GDB, pyOCD, J-Link, ST-Link, or CMSIS-DAP work.

cunjun/McuBuddy · 64 tokens

cleverence-mslx

A guide for editing Cleverence Mobile SMARTS configuration files used by handheld warehouse and shop terminals. Each .mslx file describes a workflow as a sequence of actions connected like a directed graph.

Desko77/cursor-1c-skills · 7 tokens

fpga-hardware-design-and-review-guide

Comprehensive FPGA hardware design guide based on real-world project experience. Covers pipeline architecture, timing optimization, SystemVerilog coding patterns, CDC handling, and practical debugging techniques. Use this skill when: (1) designing FPGA modules with timing constraints, (2) implementing video processing…

cobbpeng/fpga-hardware-design-and-review-guide · 99 tokens