/embedded-skills:embedded-documentationfrom embedded-skills
Generates and validates documentation for embedded firmware projects (STM32, FreeRTOS, drone, robotics). Covers README, architecture, module design, interface specs, RTOS tasks, ISRs, state machines, pin mapping, and data flow diagrams. Activates on new projects, modules, RTOS tasks, ISRs, or undocumented components.
Ships in embedded-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill defines documentation standards for embedded firmware projects. The goal is to ensure every generated project is accompanied by documentation sufficient for another engineer to understand, build, modify, and maintain the system.
Goals:
The most valuable embedded documentation is not Doxygen API comments — it is architecture overviews, RTOS task design, and hardware resource mapping that let a new engineer understand the whole system in minutes.
Documentation must evolve together with code. Never leave public modules undocumented.
| Level | Content | When Generated |
|---|---|---|
| L1 — Project | README, Architecture, Build, Hardware, Directory Structure | New project |
| L2 — Module | Per-module design docs | New module created |
| L3 — Interface | Interface contract docs | New interface created |
| L4 — RTOS/ISR | TaskDesign, ISRDesign, EventFlow | osThreadNew or IRQHandler detected |
| L5 — Control | ControlLoop, StateMachine, Estimator | State machine enum or control structures detected |
When creating a new embedded project, generate:
README.md
docs/
├── Architecture.md
├── Build.md
├── Hardware.md
└── DirectoryStructure.md
Every project README must contain:
# Project Overview
What this firmware does and which hardware it targets.
# Features
Key capabilities and supported peripherals.
# Hardware Platform
MCU family, board revision, key pin assignments.
# Build Instructions
Toolchain, build commands, optional features.
# Flash Instructions
Debugger, probe, or bootloader method.
# Project Structure
Overview of the directory layout.
# Software Architecture
Layer diagram and dependency direction.
# Dependencies
Middleware, SDKs, toolchains required.
# License
Must describe the layer model — a ASCII dependency diagram:
app/
↓
module/
↓
interface/
↓
bsp/
↓
platform/
Explain the role of each layer and the dependency direction constraint.
Auto-generate from the actual project tree:
project/
├── app/ — Application entry, tasks, state machines
├── module/ — Business logic modules
├── interface/ — Hardware abstraction contracts
├── bsp/ — Board-specific driver implementations
├── platform/ — Vendor SDK, HAL, CMSIS, linker scripts
├── middleware/ — Third-party (FreeRTOS, lwIP, FatFS)
├── docs/ — Documentation
├── tools/ — Build and debug scripts
└── tests/ — Unit and integration tests
When the project references GPIO, UART, SPI, I2C, CAN, PWM, or ADC, generate docs/Hardware.md
with a resource table:
| Peripheral | Interface | Target | Purpose |
|------------|-----------|--------------|------------------|
| USART1 | uart_if | Telemetry | 115200 baud |
| SPI1 | spi_if | ICM-42688 | IMU data @ 1MHz |
| TIM3 | pwm_if | Motor driver | 50Hz PWM |
| ADC1 | | Battery | Voltage monitor |
| PB0 | gpio_if | LED | Status indicator |
When a new module is created (e.g., module/motor/), generate docs/modules/motor.md:
# Motor Module
## Purpose
Control motor output — converts speed commands into PWM signals and monitors fault status.
## Responsibilities
- speed control loop execution
- PWM generation via pwm_if
- fault detection and safe stop
- current limiting
## Public API
error_t motor_init(void)
error_t motor_set_speed(int32_t rpm)
void motor_stop(void)
bool motor_is_faulted(void)
## Dependencies
- pwm_if
- timer_if
- gpio_if
## Data Flow
control_module → motor_module → pwm_if → platform_pwm
## State Machine
STOPPED → STARTING → RUNNING → FAULT → STOPPED
Every interface in interface/ must document:
# UART Interface
## Purpose
Provide hardware-independent UART access for modules.
## Public API
int32_t uart_init(uart_config_t *cfg)
int32_t uart_write(const uint8_t *data, uint32_t len)
int32_t uart_read(uint8_t *data, uint32_t len)
## Ownership
Implemented by BSP layer. Consumed by module/ layer.
## Thread Safety
Not thread-safe. Caller must protect with mutex or critical section.
When the code contains osThreadNew() or xTaskCreate(), generate docs/TaskDesign.md:
# Task Design
| Task | Period | Priority | Stack | Responsibility |
|-----------------|--------|----------|--------|-------------------------|
| imu_task | 1 ms | High | 512 | Sensor acquisition |
| control_task | 1 ms | High | 1024 | PID control loop |
| telemetry_task | 20 ms | Low | 256 | UART telemetry output |
| usb_cdc_task | event | Medium | 512 | USB serial handling |
Also document synchronization primitives:
### Synchronization
| Resource | Type | Purpose |
|------------------|--------------|--------------------------|
| imu_data_queue | MessageQueue | IMU → Control |
| control_mutex | Mutex | Shared setpoint access |
| telemetry_event | EventFlags | Telemetry trigger |
When the code contains IRQHandler functions, generate docs/ISRDesign.md:
# ISR Design
| Interrupt | Source | Priority | Execution Time | Shared Variables |
|----------------|----------|----------|----------------|-------------------------|
| USART1_IRQn | RX | 5 | < 5 µs | rx_buffer, rx_index |
| TIM3_IRQn | Update | 4 | < 2 µs | pwm_duty |
### Deferred Processing
| ISR | Deferred Mechanism | Consumer |
|----------------|------------------------|---------------|
| USART1_IRQn | osMessageQueuePut | usb_cdc_task |
| TIM3_IRQn | Direct (in-isr update) | — |
When the code contains a state enum or switch(state), generate docs/StateMachine.md:
INIT
↓
IDLE
↓
RUNNING
↓
FAULT → IDLE
Include transition conditions:
| Transition | From | To | Condition |
|------------|----------|----------|-------------------------|
| start | IDLE | RUNNING | system_ready == true |
| fault | RUNNING | FAULT | motor_fault_detected |
| reset | FAULT | IDLE | fault_ack received |
| error | INIT | IDLE | init complete |
When producing documentation, prefer ASCII diagrams for architecture and data flow so they render inline in any Markdown viewer without external tools.
app/
↕
module/
↕
interface/
↕
bsp/
↕
platform/
imu_sensor
↓ (SPI)
imu_module
↓ (queue)
estimator
↓ (shared data)
controller
↓ (pwm_if)
motor_driver
imu_task ──queue──→ control_task ──queue──→ telemetry_task
After generating code, verify:
When documentation is missing:
Documentation should evolve together with code. Never leave public modules undocumented.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
embedded-firmware, documentation-standards, rtos, stm32, freertos
npx claudepluginhub rovinax/embedded-skills --plugin embedded-skills6 skills in this plugin
/embedded-architectureUse when creating a new embedded firmware project, adding a module, refactoring firmware, reviewing architecture, or generating project structure. Enforces mandatory architecture rules for maintainable, portable, testable, hardware-independent firmware targeting STM32, GD32, ESP32, RP2040, NXP, Nordic, and similar MCU platforms. Covers project structure, dependency management, module boundaries, platform abstraction, and architecture validation.
/embedded-cstyleUse when generating, modifying, reviewing, or refactoring C code for embedded firmware projects (STM32, GD32, ESP32, FreeRTOS, bare-metal, driver development, robotics). Enforces engineering coding standards — naming, types, functions, variables, macros, headers, memory, concurrency, error handling, and documentation. Catches AI-common mistakes: global variables, magic numbers, missing static/const, volatile abuse, ignored return values, unchecked null pointers, and HAL calls leaking into business logic.
/embedded-driver-designUse when developing or reviewing peripheral drivers for embedded firmware (STM32, GD32, ESP32, FreeRTOS, drone flight controllers, robotics). Enforces layered driver architecture with bus abstraction, device context objects, register encapsulation, and strict separation between bus drivers, device drivers, BSP, and business modules. Prevents HAL/register leakage into device drivers and keeps control algorithms (PID, Kalman, attitude estimation) out of driver code.
/embedded-isr-designUse when generating or reviewing interrupt service routines (ISRs) for embedded firmware (STM32, GD32, ESP32, FreeRTOS, bare-metal, drone flight controllers, robotics). Enforces the "Fast In, Fast Out" principle — ISRs capture events and defer processing to task context. Prevents common AI mistakes: protocol parsing in ISR, control algorithms in ISR, printf/malloc in ISR, blocking calls, forgotten flag clearing, and missing FromISR API usage for RTOS integration.
/embedded-rtos-designUse when designing, generating, or reviewing RTOS-based embedded firmware (FreeRTOS, CMSIS-RTOS2, RT-Thread, Zephyr, ThreadX) for STM32, GD32, ESP32, drone flight controllers, and robotics projects. Enforces real-time system architecture — task decomposition, scheduling, priority assignment, inter-task communication, ISR cooperation, resource ownership, and watchdog monitoring. Prevents the common AI anti-pattern of creating monolithic super-tasks with mixed responsibilities and jitter-prone control loops coupled to communication timing.
Other plugins' skills for the same job