🎯

domain-embedded

🎯Skill

from goooice/rust-skills

VibeIndex|
What it does

Configures and optimizes Rust projects for embedded systems development with no-std, real-time, and microcontroller-specific constraints.

πŸ“¦

Part of

goooice/rust-skills(35 items)

domain-embedded

Installation

Add MarketplaceAdd marketplace to Claude Code
/plugin marketplace add ZhangHanDong/rust-skills
Install PluginInstall plugin from marketplace
/plugin install rust-skills@rust-skills
Quick InstallInstall with npx
npx skills add ZhangHanDong/rust-skills
git cloneClone repository
git clone https://github.com/ZhangHanDong/rust-skills.git
πŸ“– Extracted from docs: goooice/rust-skills
4Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

"Use when developing embedded/no_std Rust. Keywords: embedded, no_std, microcontroller, MCU, ARM, RISC-V, bare metal, firmware, HAL, PAC, RTIC, embassy, interrupt, DMA, peripheral, GPIO, SPI, I2C, UART, embedded-hal, cortex-m, esp32, stm32, nrf, 塌ε…₯式, ε•η‰‡ζœΊ, ε›Ίδ»Ά, 裸机"

Project Context (Auto-Injected)

Target configuration:

!cat .cargo/config.toml 2>/dev/null || echo "No .cargo/config.toml found"

---

# Embedded Domain

> Layer 3: Domain Constraints

Domain Constraints β†’ Design Implications

| Domain Rule | Design Constraint | Rust Implication |

|-------------|-------------------|------------------|

| No heap | Stack allocation | heapless, no Box/Vec |

| No std | Core only | #![no_std] |

| Real-time | Predictable timing | No dynamic alloc |

| Resource limited | Minimal memory | Static buffers |

| Hardware safety | Safe peripheral access | HAL + ownership |

| Interrupt safe | No blocking in ISR | Atomic, critical sections |

---

Critical Constraints

No Dynamic Allocation

```

RULE: Cannot use heap (no allocator)

WHY: Deterministic memory, no OOM

RUST: heapless::Vec, arrays

```

Interrupt Safety

```

RULE: Shared state must be interrupt-safe

WHY: ISR can preempt at any time

RUST: Mutex> + critical section

```

Hardware Ownership

```

RULE: Peripherals must have clear ownership

WHY: Prevent conflicting access

RUST: HAL takes ownership, singletons

```

---

Trace Down ↓

From constraints to design (Layer 2):

```

"Need no_std compatible data structures"

↓ m02-resource: heapless collections

↓ Static sizing: heapless::Vec

"Need interrupt-safe state"

↓ m03-mutability: Mutex>>

↓ m07-concurrency: Critical sections

"Need peripheral ownership"

↓ m01-ownership: Singleton pattern

↓ m12-lifecycle: RAII for hardware

```

---

Layer Stack

| Layer | Examples | Purpose |

|-------|----------|---------|

| PAC | stm32f4, esp32c3 | Register access |

| HAL | stm32f4xx-hal | Hardware abstraction |

| Framework | RTIC, Embassy | Concurrency |

| Traits | embedded-hal | Portable drivers |

Framework Comparison

| Framework | Style | Best For |

|-----------|-------|----------|

| RTIC | Priority-based | Interrupt-driven apps |

| Embassy | Async | Complex state machines |

| Bare metal | Manual | Simple apps |

Key Crates

| Purpose | Crate |

|---------|-------|

| Runtime (ARM) | cortex-m-rt |

| Panic handler | panic-halt, panic-probe |

| Collections | heapless |

| HAL traits | embedded-hal |

| Logging | defmt |

| Flash/debug | probe-run |

Design Patterns

| Pattern | Purpose | Implementation |

|---------|---------|----------------|

| no_std setup | Bare metal | #![no_std] + #![no_main] |

| Entry point | Startup | #[entry] or embassy |

| Static state | ISR access | Mutex>> |

| Fixed buffers | No heap | heapless::Vec |

Code Pattern: Static Peripheral

```rust

#![no_std]

#![no_main]

use cortex_m::interrupt::{self, Mutex};

use core::cell::RefCell;

static LED: Mutex>> = Mutex::new(RefCell::new(None));

#[entry]

fn main() -> ! {

let dp = pac::Peripherals::take().unwrap();

let led = Led::new(dp.GPIOA);

interrupt::free(|cs| {

LED.borrow(cs).replace(Some(led));

});

loop {

interrupt::free(|cs| {

if let Some(led) = LED.borrow(cs).borrow_mut().as_mut() {

led.toggle();

}

});

}

}

```

---

Common Mistakes

| Mistake | Domain Violation | Fix |

|---------|-----------------|-----|

| Using Vec | Heap allocation | heapless::Vec |

| No critical section | Race with ISR | Mutex + interrupt::free |

| Blocking in ISR | Missed interrupts | Defer to main loop |

| Unsafe peripheral | Hardware conflict | HAL ownership |

---

Trace to Layer 1

| Constraint | Layer 2 Pattern | Layer 1 Implementation |

|------------|-----------------|------------------------|

| No heap | Static collections | heapless::Vec |

| ISR safety | Critical sections | Mutex> |

| Hardware ownership | Singleton | take().unwrap() |

| no_std | Core-only | #![no_std], #![no_main] |

---

Related Skills

| When | See |

|------|-----|

| Static memory | m02-resource |

| Interior mutability | m03-mutability |

| Interrupt patterns | m07-concurrency |

| Unsafe for hardware | unsafe-checker |

More from this repository10

🎯
m10-performance🎯Skill

Optimizes code performance by identifying bottlenecks, measuring impact, and guiding strategic improvements across algorithm, data structure, and memory efficiency.

🎯
m14-mental-model🎯Skill

Applies the M14 mental model framework to enhance decision-making and strategic thinking through structured cognitive analysis.

🎯
m04-zero-cost🎯Skill

Guides developers in choosing zero-cost abstractions by analyzing type system constraints and performance trade-offs in Rust generics and traits.

🎯
meta-cognition-parallel🎯Skill

Performs parallel three-layer meta-cognitive analysis by forking subagents to simultaneously analyze language mechanics, design choices, and domain constraints, then synthesizing results.

🎯
unsafe-checker🎯Skill

Identifies and reviews unsafe Rust code patterns, FFI risks, and potential memory unsafety in Rust projects.

🎯
rust-skill-creator🎯Skill

Dynamically generates Claude skills for Rust crates, standard library modules, and documentation by extracting and processing technical details from specified URLs.

🎯
coding-guidelines🎯Skill

Provides comprehensive Rust coding guidelines covering naming conventions, best practices, error handling, memory management, concurrency, and code style recommendations.

🎯
rust-refactor-helper🎯Skill

Performs safe Rust refactoring by analyzing symbol references, checking conflicts, and applying changes across project files using LSP.

🎯
m03-mutability🎯Skill

Diagnoses and guides resolution of Rust mutability and borrowing conflicts by analyzing ownership, mutation patterns, and thread-safety requirements.

🎯
m05-type-driven🎯Skill

Explores and demonstrates type-driven development techniques in Rust, showcasing advanced type system features and pattern matching strategies.