Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Embedded C/C++ Code Reviewer

БесплатноБез исполняемых скриптовНе проверен

嵌入式C/C++代码静态审查工具,28条规则。查真雷:ISR里调HAL_Delay/printf/RTOS阻塞API(FreeRTOS+RT-Thread双RTOS支持)、共享变量缺volatile、数组越界、整数溢出、寄存器硬编码、裸int位域、宏副作用、C++裸new等,每条附MISRA…

liujycodeот liujycode204 установки в других каталогах

Об этом скилле

Embedded C/C++ Code Reviewer

Give embedded C code a "health check" — no compiling, no toolchain needed. Feed code in, get a severity-ranked issue list (critical/major/minor) with location, root cause, fix advice and MISRA C:2012 rule references for every finding.

When to Use It

  • Latent ISR bombs: calling HAL_Delay/printf/vTaskDelay inside an ISR — random HardFaults with zero compiler warnings. Rules 1/7/16/22 catch exactly this.
  • Un reproducible heisenbugs: shared ISR/main-loop variables missing volatile — the main loop never sees updates under optimization. Rule 2 covers =, ++/--, and all compound assignments.
  • MISRA / functional-safety review: every finding carries MISRA C:2012 rule references verified against IAR C-STAT, Klocwork and Parasoft sources (no invented numbers).
  • Taking over an unknown codebase: --dir scans a whole directory; the HTML report shows at a glance where the worst problems live.

30-Second Demo

Feed in a realistic timer ISR:

volatile uint32_t g_adc_raw;
uint8_t g_frame_ready;
void TIM1_IRQHandler(void) {
    HAL_Delay(5);                       // <- wants to wait for ADC
    g_adc_raw = ADC1->DR;
    g_frame_ready++;                    // <- main loop reads this
    uint8_t buf[4];
    buf[5] = 1;                         // <- off-by-one
    int total = g_adc_raw * 4096;
    switch (g_frame_ready) { case 1: break; }
    vTaskDelay(10);
}

Review output (score 66/100, 4 critical, 2 minor):

Rule Sev Location Issue MISRA
R1 CRIT L4 Blocking call HAL_Delay inside ISR MISRA C:2012 14.4 (adapted)
R2 MAJ L6 Shared var written in ISR without adequate protection pattern -
R9 MAJ L8 Array buf[5] out of bounds (size 4) MISRA C:2012 18.1
R10 MIN L9 int total overflow risk: g_adc_raw * 4096 exceeds int16 range math assumptions MISRA C:2012 10.x
R16 MAJ L10 switch without default MISRA C:2012 16.4
R7 CRIT L11 RTOS API vTaskDelay called from ISR context -

How to Run

python reviewer.py code.c              # single file
python reviewer.py --dir ./src         # whole directory
python reviewer.py --html report.html  # shareable HTML report

Exit codes: 0 = clean, 1 = findings, 2 = internal error. CI-gate friendly.

What's Inside

  • 28 rules: ISR blocking calls, volatile, array bounds, integer overflow (incl. return expressions), malloc null-check, float equality, switch default, recursion, RTOS context (FreeRTOS + RT-Thread), large stack arrays, hardcoded register pointers, bitfields, macro side effects and more
  • Every rule maps to MISRA C:2012 / C++:2008 numbers verified across three commercial tools
  • Calibrated against a 170,991-file real-world embedded corpus (400-file sample: 0 errors)
  • 120 test assertions, all green
  • references/ carries the rule details; SKILL.md stays lean for agent context

Hard Rules

  1. Findings only from the actual source text — no speculative issues, no invented line numbers.
  2. MISRA numbers cited only when verified against at least one commercial-tool source; otherwise explicitly marked "no direct mapping".
  3. The tool reviews code; it never rewrites your architecture. Fix advice is a starting point, not a mandate.

Bundle Notes

  • references/ — rule-by-rule details (load on demand)
  • Works standalone; pairs with embedded-code-generator for a generate-then-review loop
Полный SKILL.md на ClawHub

Установить Embedded C/C++ Code Reviewer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Embedded C/C++ Code Reviewer?

嵌入式C/C++代码静态审查工具,28条规则。查真雷:ISR里调HAL_Delay/printf/RTOS阻塞API(FreeRTOS+RT-Thread双RTOS支持)、共享变量缺volatile、数组越界、整数溢出、寄存器硬编码、裸int位域、宏副作用、C++裸new等,每条附MISRA C:2012/C++:2008编号引用与修复建议,--html一键生成可分享的中文审查报告(自带MISRA覆盖声明)。判据经170,991个真实嵌入式文件语料校准(抽样400实测0错误),120项测试断言。当用户需要review嵌入式C代码、检查ISR安全、代码审查、找bug、查代码问题、程序跑飞/HardFault/随机死机排查、偶发疑难bug定位、毕设课程代码自查、接手老工程摸底体检、MISRA检查、CI代码质量门禁、RT-Thread/FreeRTOS用法检查时使用。

Как установить скилл Embedded C/C++ Code Reviewer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Embedded C/C++ Code Reviewer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Embedded C/C++ Code Reviewer с