MCPInstall

static-analysis

当需要对嵌入式 C/C++ 代码运行 cppcheck、clang-tidy 或 GCC analyzer 静态分析,或进行 MISRA-C 合规检查时使用。

Installs
560
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/leokemp223/embed-ai-tool --skill static-analysis
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads static-analysis automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

静态分析

适用场景

  • 提交前需要对代码进行静态分析,发现潜在缺陷。
  • 汽车、医疗等行业需要 MISRA-C 2012 合规检查。
  • 需要使用 cppcheck、clang-tidy 或 GCC -fanalyzer 进行代码质量审查。
  • 需要对静态分析结果按严重级别分组查看摘要。

必要输入

  • 源码目录路径。
  • 至少一个可用的静态分析工具(cppcheck、clang-tidy 或 GCC 12+)。
  • 可选的 compile_commands.json 路径(提升 clang-tidy 准确性)。
  • 可选的严重级别过滤和 MISRA 检查开关。

自动探测

  • --detect 模式检测 cppcheck、clang-tidy 和 arm-none-eabi-gcc 的可用性和版本。
  • GCC -fanalyzer 需要 GCC 12+,脚本会检查版本号。
  • 自动搜索工作区中的 compile_commands.json。

执行步骤

  1. 先阅读 references/usage.md,确认本次使用哪个分析工具。
  2. 若不确定工具是否可用,先运行 scripts/static_analyzer.py 的 --detect 模式。
  3. 使用 --cppcheck --source <dir> 运行 cppcheck 分析。
  4. 使用 --clang-tidy --source <dir> 运行 clang-tidy 分析。
  5. 使用 --gcc-analyzer --source <files> 运行 GCC analyzer 分析。
  6. 需要 MISRA 合规时,添加 --misra 参数启用 cppcheck MISRA addon。
  7. 阅读 references/misra-quick-ref.md 了解常见 MISRA 违规。

失败分流

  • 当所有分析工具都不可用时,返回 environment-missing。
  • 当指定的源码目录不存在时,返回 artifact-missing。
  • 当 compile_commands.json 指定但无效时,返回 project-config-error。
  • 当分析工具运行异常退出时,返回 target-response-abnormal。

平台说明

  • cppcheck 和 clang-tidy 在三大平台均可用,通过包管理器安装。
  • GCC -fanalyzer 需要 GCC 12+,嵌入式交叉编译器版本可能较低。
  • 自带脚本使用 Python 标准库和 subprocess,跨平台兼容。

输出约定

  • 按严重级别(error、warning、style、information)分组输出发现。
  • 每条发现包含文件路径、行号、规则 ID 和描述。
  • --summary 模式只输出统计数字。
  • MISRA 模式额外输出违反的规则编号。

交接关系

  • 当发现严重缺陷需要修复后重新构建时,交给对应的 build-* skill。
  • 当需要了解代码内存影响时,交给 memory-analysis。

FAQ

What does the static-analysis skill do?

当需要对嵌入式 C/C++ 代码运行 cppcheck、clang-tidy 或 GCC analyzer 静态分析,或进行 MISRA-C 合规检查时使用。

How do I install static-analysis?

Run npx skills add https://github.com/leokemp223/embed-ai-tool --skill static-analysis in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/static-analysis/ (personal) or .claude/skills/static-analysis/ (project).

Which AI agents can use static-analysis?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is static-analysis safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains static-analysis?

It is published by leokemp223 in leokemp223/embed-ai-tool. It has 560 recorded installs.

More from leokemp223/embed-ai-tool

View all →

serial-monitor

leokemp223/embed-ai-tool

当需要识别正确串口、调用自带脚本抓取日志,并分析嵌入式固件运行状态时使用。

585 installs

build-keil

leokemp223/embed-ai-tool

当需要通过 Keil MDK 命令行编译嵌入式工程,调用自带脚本解析工程文件、执行构建并定位固件产物时使用。

572 installs

build-platformio

leokemp223/embed-ai-tool

当需要通过 PlatformIO 命令行编译嵌入式工程,调用自带脚本解析环境配置、执行构建并定位固件产物时使用。

568 installs

workflow

leokemp223/embed-ai-tool

当需要串联多个 skill 完成编译+烧录+监控或编译+烧录+调试等流水线任务时使用。

flash-keil

leokemp223/embed-ai-tool

当需要通过 Keil MDK 内置调试器烧录固件到目标板时使用,利用工程中已配置的调试器和 Flash 算法执行下载。

566 installs

build-cmake

leokemp223/embed-ai-tool

当需要配置或构建基于 CMake 的嵌入式固件工程,调用自带脚本执行构建并定位固件产物时使用。

564 installs

Popular other skills

View category →

hyperframes-cli

heygen-com/hyperframes

The HyperFrames CLI by job - scaffold, check, look at frames, edit the timeline, preview, render locally or in the cloud, publish, project history - plus reading its JSON and recovering from build or render failures.

1.3M installs

triage

mattpocock/skills

Move issues and external PRs through a state machine of triage roles, categorise, verify, grill if needed, and write agent-ready briefs.

1M installs

ask-matt

mattpocock/skills

Ask which skill or flow fits your situation. A router over the skills in this repo.

778.4K installs

to-questionnaire

mattpocock/skills

Turn a decision you can't fully answer into a questionnaire for someone else to fill in.

508.9K installs

wait-what

mattpocock/skills

Stop. That last message did not land: re-pitch it.

459.7K installs

loop-me

mattpocock/skills

Grill me about specs for the workflows I want to build, within this workspace.

447.9K installs