
non-blocking-patterns
Use when Arduino or embedded C++ code uses delay(), needs button debouncing, periodic work, cooperative scheduling, watchdog-safe timing, state machines, or latency/jitter control under sensor, network, or motor load.
- Installs
- 62
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/wedsamuel1230/embedded-engineering-skills --skill non-blocking-patterns- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads non-blocking-patterns automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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
- List each periodic or event-driven task with period, deadline, and worst-case work. Identify any blocking library call.
- Replace long
delay()calls with unsigned wrap-safe elapsed checks such asif (static_cast<unsigned long>(now - last) >= period). Use hardware timers or RTOS tasks only when board and framework support is confirmed. - Model multi-step work as an explicit state machine with bounded transitions; do not hide waits inside a helper.
- Debounce inputs using a stable-state timer or event filter, not a blocking pause. Bound serial parsing, network retries, and sensor conversion waits.
- Define watchdog feeding, output inhibit, timeout, and recovery behavior.
- 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.
Shared output contract
Use the shared Arduino skill contract: state assumptions, required tools and versions, implementation steps, tests/evidence by proof stage, known limitations, and recovery/security notes.
FAQ
What does the non-blocking-patterns skill do?
Use when Arduino or embedded C++ code uses delay(), needs button debouncing, periodic work, cooperative scheduling, watchdog-safe timing, state machines, or latency/jitter control under sensor, network, or motor load.
How do I install non-blocking-patterns?
Run npx skills add https://github.com/wedsamuel1230/embedded-engineering-skills --skill non-blocking-patterns in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/non-blocking-patterns/ (personal) or .claude/skills/non-blocking-patterns/ (project).
Which AI agents can use non-blocking-patterns?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is non-blocking-patterns safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains non-blocking-patterns?
It is published by wedsamuel1230 in wedsamuel1230/embedded-engineering-skills. It has 62 recorded installs.
More from wedsamuel1230/embedded-engineering-skills
arduino-project-builder
wedsamuel1230/embedded-engineering-skills
Build complete Arduino and embedded projects across Arduino IDE, Arduino CLI, PlatformIO, and vendor-specific toolchains. Use when users request an application combining firmware, sensors, actuators, networking, power, or deployment rather than a code snippet. The bundled scaffold targets UNO, ESP32, and Raspberry Pi Pico; use the board profile and document limitations for other targets.
arduino-code-generator
wedsamuel1230/embedded-engineering-skills
Open the skill to read its SKILL.md instructions.
circuit-debugger
wedsamuel1230/embedded-engineering-skills
Open the skill to read its SKILL.md instructions.
arduino-serial-monitor
wedsamuel1230/embedded-engineering-skills
Open the skill to read its SKILL.md instructions.
error-message-explainer
wedsamuel1230/embedded-engineering-skills
Open the skill to read its SKILL.md instructions.
enclosure-designer
wedsamuel1230/embedded-engineering-skills
Open the skill to read its SKILL.md instructions.
Popular other skills
hyperframes-cli
heygen-com/hyperframes
The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.
triage
mattpocock/skills
Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.
ask-matt
mattpocock/skills
Ask which skill or flow fits your situation. A router over the skills in this repo.
to-questionnaire
mattpocock/skills
Turn a decision you can't fully answer into a questionnaire for someone else to fill in.
loop-me
mattpocock/skills
Grill me about specs for the workflows I want to build, within this workspace.