embedded-architecture
Skill9 starsChanged 6 months agoMITView on GitHub
Use 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.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- dtsong/agentic-counciltheir own version, first seen Jun 10, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- dtsong/agentic-council★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- embedded-cstyleSkill
- embedded-documentationSkill
- embedded-driver-designSkill
- embedded-isr-designSkill
- embedded-rtos-designSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 112
Must never contain business logic.
- Distinctive: line 118
Should remain isolated from application logic.
- Very specific: line 144
All MCU vendor files must reside inside platform/<target>/:
- Distinctive: line 153
Never place generated vendor code directly in project root.
- Distinctive: line 159
Every hardware service must expose an interface.
- Distinctive: line 196
Before accepting generated code, verify:
- Distinctive: line 211
If violations are found:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Embedded Architecture
Purpose
Define the mandatory architecture rules for embedded firmware projects.
The goal is to generate maintainable, portable, testable, and hardware-independent firmware suitable for STM32, GD32, ESP32, RP2040, NXP, Nordic, and similar MCU platforms.
This skill focuses on:
- project structure
- dependency management
- module boundaries
- platform abstraction
- code ownership
- architecture validation
Architecture Principles
Generated firmware must follow:
- Single responsibility
- Low coupling
- High cohesion
- Explicit interfaces
- Hardware abstraction
- Platform portability
- Testability
- Deterministic behavior
The application layer must never depend directly on MCU vendor libraries.
Business logic must remain independent from STM32 HAL, CMSIS, FreeRTOS internals, or peripheral registers.
Required Project Structure
Firmware projects must use the following layout:
project/
├── app/
├── module/
├── interface/
├── bsp/
├── platform/
├── middleware/
├── docs/
├── tools/
└── tests/app/ — Application Entry Points
Contains:
- state machines
- application orchestration
- system startup sequence
- task creation
Must not contain:
- register access
- HAL calls
- peripheral drivers
module/ — Business Logic
Examples: motor/, imu/, control/, telemetry/, navigation/, power/
Modules may depend only on interface/.
Modules must not access directly: HAL, CMSIS, GPIO registers, UART registers, SPI registers.
interface/ — Hardware Abstraction Contracts
Examples: gpio_if.h, uart_if.h, spi_if.h, pwm_if.h, timer_if.h
Defines contracts only. Must not contain implementation.
bsp/ — Board-Specific Implementation
Examples: led, button, buzzer, oled, imu_board
Responsible for mapping interfaces to hardware. May use platform layer.
platform/ — Vendor-Specific Code
platform/
└── stm32f407/
├── core/
├── hal/
├── cmsis/
├── startup/
└── linker/Contains: CubeMX generated code, HAL drivers, CMSIS, startup files, linker scripts.
Must never contain business logic.
middleware/ — Third-Party Middleware
Examples: freertos/, lwip/, fatfs/, usb/
Should remain isolated from application logic.
Dependency Rules
Allowed direction (top-down only):
APP → MODULE → INTERFACE → BSP → PLATFORMForbidden:
APP → HALAPP → STM32_GPIO / STM32_UARTMODULE → HALMODULE → Register AccessMODULE → CMSISMODULE → FreeRTOS Internal APIsPLATFORM → MODULEPLATFORM → APPBSP → APP
Dependencies must always point downward. Circular dependencies are forbidden.
Platform Isolation Rules
All MCU vendor files must reside inside platform/<target>/:
platform/stm32f407/
platform/stm32h743/
platform/gd32f450/
platform/esp32s3/Never place generated vendor code directly in project root.
Forbidden at repository root: /Core, /Drivers — move them into the platform directory.
Interface Rules
Every hardware service must expose an interface.
Example:
typedef struct {
int32_t (*write)(const uint8_t *data, uint32_t len);
int32_t (*read)(uint8_t *data, uint32_t len);
} uart_if_t;Modules interact only with interfaces. Modules must not know: UART instance, GPIO port, DMA channel, MCU family.
Module Rules
Each module should own one responsibility.
Good: motor, imu, control, telemetry, storage
Bad: system_manager, all_in_one, utility, misc
Avoid god-modules.
RTOS Separation
RTOS task creation belongs to app/. Business logic belongs to module/.
Bad — task function contains sensor reading, control algorithm, logging, and communication all mixed together.
Good — task calls module API, which calls interface, which calls driver:
TASK → MODULE API → INTERFACE → DRIVERArchitecture Validation Checklist
Before accepting generated code, verify:
- Project follows required directory layout
- No HAL usage in
app/ - No HAL usage in
module/ - No register access outside
platform/ - No CubeMX code outside
platform/ - All peripherals abstracted through interfaces
- No circular dependencies
- No business logic inside BSP
- No business logic inside platform
- Modules have single responsibility
- Interfaces contain declarations only
- Dependency direction is correct
If violations are found:
- Report the violation
- Explain why it is harmful
- Suggest the corrected architecture
- Refactor generated code accordingly
Architecture correctness takes precedence over implementation convenience.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

