plugins-world avatar

Pw Embedded C Style

If you're writing C code for 51 microcontrollers or STM32 and want consistent embedded style, this handles the grunt work. It generates project structures, driver templates for peripherals like LCD1602 and DS1302, and reformats code to match patterns extracted from 302 source files in a popular Chinese embedded C textbook. Defaults to snake_case naming but switches to camelCase if you ask. The real value is in the specifics: it knows timer compensation tricks, interrupt flag patterns, and key debouncing with shift registers. Best for educational projects or small bare-metal firmware where you want readable, consistent code without fighting style decisions every time you add a UART driver.

skills.sh installs
239
GitHub stars
22
last updated
Aug 21, 2026

Install

$ npx -y skills add plugins-world/pw-skills --skill pw-embedded-c-style --agent claude-code

Installs into .claude/skills of the current project.

Files

pw-embedded-c-style

嵌入式 C 代码风格助手, 基于《手把手教你学51单片机》302 个 .c 文件和 66 个 .h 文件的代码风格分析。

默认命名风格: 蛇形命名 (snake_case)

使用场景

适用情况

  • 创建新的嵌入式 C 项目 (51 单片机、STM32 等)
  • 优化现有嵌入式代码的命名和结构
  • 生成硬件驱动模块 (定时器、串口、LCD、按键等)
  • 规范化项目文件组织和代码风格
  • 学习嵌入式 C 编程的最佳实践

不适用情况

  • 非嵌入式的通用 C/C++ 项目
  • 需要 RTOS 或复杂架构的项目
  • 纯算法实现 (无硬件交互)

使用方式

默认命名风格: 蛇形命名 (snake_case)

如需使用驼峰命名,请在指令中明确说明 "使用驼峰命名"。

创建项目

# 基础示例 (默认蛇形命名)
/pw-embedded-c-style 创建一个 LED 闪烁的项目

# 带外设的项目
/pw-embedded-c-style 创建一个带 LCD1602 显示和按键输入的项目

# 指定芯片
/pw-embedded-c-style 为 STM32F103 创建一个串口通信项目

# 明确指定使用驼峰命名
/pw-embedded-c-style 使用驼峰命名创建一个定时器项目

优化代码

# 优化代码风格 (默认蛇形命名)
/pw-embedded-c-style 帮我优化这段按键扫描代码

# 重构模块
/pw-embedded-c-style 将这段代码重构为独立的驱动模块

# 添加注释
/pw-embedded-c-style 为这段定时器配置代码添加规范注释

# 使用驼峰命名优化
/pw-embedded-c-style 使用驼峰命名优化这段代码

生成驱动模板

# 生成特定外设驱动
/pw-embedded-c-style 生成 DS1302 实时时钟驱动模板

# 生成通信协议
/pw-embedded-c-style 生成串口通信的收发缓冲区实现

核心规范

命名规范

默认风格: 蛇形命名 (snake_case)

// 函数: 蛇形命名
void config_timer0(unsigned int ms);
void lcd_write_cmd(unsigned char cmd);
void init_ds1302(void);

// 变量: 蛇形命名
unsigned char flag_500ms = 0;
unsigned char cnt_rxd = 0;

Sponsors

Details

Repository
github.com/plugins-world/pw-skills
Category
Code Review & Quality
First seen
Jun 3, 2026

More from plugins-world/pw-skills

All 2
1meleantonio avatarlit-review-assistantmeleantonio/awesome-econ-ai-stuffSearch, summarize, and synthesize economics literature238skills.sh installs
2bencium avatarvanity-engineering-reviewbencium/bencium-claude-code-design-skillvanity engineering review236skills.sh installs
3shipshitdev avatarexpo-architectshipshitdev/libraryexpo architect233skills.sh installs
4shipshitdev avatarbrand-architectshipshitdev/librarybrand architect222skills.sh installs
5existential-birds avataragent-architecture-analysisexistential-birds/beagleUse when auditing an agent codebase against the 12-Factor Agents methodology, reviewing LLM-powered system architecture, or assessing agentic app compliance. Tr217skills.sh installs
6teachingai avatardrawio-architectureteachingai/full-stack-skillsdrawio architecture215skills.sh installs