| name | esp32-arch-review |
| description | Review ESP32 FastLED firmware architecture for RTOS safety, DMA correctness, LED driver patterns, memory management, and peripheral safety. Use before merging significant driver changes, new platform ports, or when auditing existing ESP32 FastLED code. |
| argument-hint | <file, directory, or component to review> |
| context | fork |
| agent | esp32-arch-review-agent |
Perform a structured architecture review of ESP32 firmware code, with emphasis on FastLED driver patterns, DMA safety, RTOS correctness, and LED-specific constraints.
$ARGUMENTS
What This Skill Reviews
1. FastLED Driver Architecture
Review LED driver implementations under src/platforms/esp/:
2. DMA Safety
3. FreeRTOS Safety
4. RMT-Specific Checks (WS2812/SK6812/APA106)
5. I2S/SPI-Specific Checks (APA102/SK9822/HD107)
6. PARLIO-Specific Checks (ESP32-S3 Parallel Output)
7. Memory Management
8. Peripheral Pin Safety
9. Error Handling
10. Code Quality & Maintainability
Output Format
# ESP32 Architecture Review Report
## Scope
- **Files reviewed**: [list]
- **Driver type**: [RMT / I2S / SPI / PARLIO / Other]
- **Target chip**: [ESP32 / ESP32-S2 / ESP32-S3 / ESP32-C3 / ESP32-C6 / ESP32-H2]
## Overall Assessment
[PASS / PASS WITH NOTES / FAIL]
## Critical Issues (must fix before merge)
- [ ] [Issue description + file:line reference]
## Warnings (should fix)
- [ ] [Issue description]
## Recommendations (consider for future)
- [ ] [Suggestion]
## Checklist Results
[Filled checklist from sections above — mark each PASS / FAIL / N/A]
Common FastLED ESP32 Architecture Anti-Patterns
| Anti-Pattern | Problem | Fix |
|---|
show() in ISR | Blocks ISR with long DMA wait | Move to task, use semaphore from ISR |
| Stack-allocated encode buffer | Stack overflow on high LED counts | Use heap or static allocation |
| Polling DMA completion | Wastes CPU, may block IDLE | Use DMA completion callback/semaphore |
| Shared RMT channel for multiple strips | Data corruption | One channel per strip |
malloc() without MALLOC_CAP_DMA | DMA transfer fails silently | Always use heap_caps_malloc for DMA buffers |
| Timing constants without datasheet reference | Hard to audit or adapt | Add comments citing datasheet section |
| Runtime color order switch | Branch overhead per LED | Use compile-time template parameter |