Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
zhinkgit avatar

Keil

  • 568 installs
  • 534 repo stars
  • Updated June 29, 2026
  • zhinkgit/embeddedskills

Keil is an agent skill that drives Keil MDK (UV4) to scan projects, compile firmware, and return flash and debug artifact paths for J-Link or OpenOCD.

About

Keil is an agent skill for solo and indie embedded builders who ship on ARM Cortex MCUs with Keil MDK instead of only desktop software. It wraps UV4.exe so your coding agent can discover Keil projects in a tree, list Targets, run incremental or full rebuilds, clean, and optionally trigger Keil’s flash path while surfacing paths to hex/axf-style outputs for J-Link or OpenOCD. Configuration splits environment defaults in skill config.json (uv4_exe path, operation_mode) from per-repo settings under .embeddedskills/config.json for default project, target, and log_dir. Python uses only the standard library. Use it when you want repeatable, scriptable builds from Claude Code or Cursor on Windows-heavy embedded workflows without manually clicking through µVision for every iteration.

  • Scans workspace for .uvprojx and .uvmpw Keil projects and enumerates Targets
  • Incremental build, full rebuild, clean, and compatible flash-download entry via UV4.exe
  • Returns structured flash_file and debug_file paths for jlink/openocd follow-on
  • Parses build logs into structured errors and warnings
  • Five-tier parameter resolution: CLI → skill config.json → .embeddedskills/config.json → state.json → search/ask

Keil by the numbers

  • 568 all-time installs (skills.sh)
  • +26 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #112 of 550 CLI & Terminal skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/zhinkgit/embeddedskills --skill keil

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs568
repo stars534
Security audit3 / 3 scanners passed
Last updatedJune 29, 2026
Repositoryzhinkgit/embeddedskills

What it does

Drive Keil MDK from your agent to scan.uvprojx projects, build firmware, and hand flash/debug artifact paths to J-Link or OpenOCD.

Who is it for?

Best when you're on Windows with Keil MDK and want agent-driven rebuilds and a clean handoff to jlink/openocd skills in the same embeddedskills repo.

Skip if: Skip if you're on PlatformIO-only, CMake+GCC-only, or Linux-only firmware pipelines without UV4 installed.

When should I use this skill?

You need Keil project scan, Target selection, UV4 build/clean/rebuild, or artifact paths before J-Link/OpenOCD.

What you get

After a run you get a structured build result with log output, errors/warnings, and flash_file/debug_file paths ready for the next embedded flash or debug skill.

  • Structured build log with errors and warnings
  • flash_file and debug_file paths for downstream flash/debug skills

By the numbers

  • 5-tier parameter resolution order from CLI through state.json
  • 3 operation_mode values for execute, risk summary, or confirm

Files

SKILL.mdMarkdownGitHub ↗

Keil MDK 工程构建

本 skill 提供 Keil MDK 工程的发现、Target 枚举、构建、重建、清理能力,并返回可供 jlink/openocd 继续使用的固件产物路径。flash 仅作为兼容入口保留。

配置

环境级配置(skill/config.json)

skill 目录下的 config.json 包含环境级配置,首次使用前确认 uv4_exe 路径正确:

{
  "uv4_exe": "C:\\Keil_v5\\UV4\\UV4.exe",
  "operation_mode": 1
}
  • uv4_exe:UV4.exe 完整路径(必填)
  • operation_mode1 直接执行 / 2 输出风险摘要但不阻塞 / 3 执行前确认

工程级配置(workspace/.embeddedskills/config.json)

工程级共享配置统一保存在工作区的 .embeddedskills/config.json 中:

{
  "keil": {
    "project": "",
    "target": "",
    "log_dir": ".embeddedskills/build"
  }
}
  • project:默认工程路径(相对 workspace),构建成功后会自动更新
  • target:默认 Target 名称,构建成功后会自动更新
  • log_dir:构建日志输出目录,默认 .embeddedskills/build

参数解析优先级

参数解析顺序(从高到低): 1. CLI 显式参数 2. 环境级配置(skill/config.json) 3. 工程级配置(.embeddedskills/config.json) 4. .embeddedskills/state.json(上次构建记录) 5. 搜索/询问

子命令

子命令用途风险
scan搜索当前目录下的 .uvprojx/.uvmpw 工程
targets枚举工程中的 Target
build增量编译
rebuild全量重建
clean清理工程
flash通过 Keil 烧录固件(兼容入口,优先建议使用 jlink/openocd)

执行流程

1. 读取 config.json,确认 uv4_exe 路径有效 2. 未指定子命令时默认执行 scan 3. 未提供工程路径时先执行 scan 搜索工程 4. 同时发现多个工程或多个 Target 时,列出选项让用户选择,绝不自动猜测 5. build/rebuild/cleanoperation_mode 决定是否需要确认 6. build/rebuild 成功后,尽量从工程配置中解析 flash_file / debug_file 等产物路径 7. flash 仅在最近一次构建成功时允许执行 8. 所有构建命令输出到日志文件后解析,返回结构化结果

脚本调用

skill 目录下有两个 Python 脚本,使用标准库实现,无额外依赖。

keil_project.py — 工程扫描与 Target 枚举

# 扫描工程
python <skill-dir>/scripts/keil_project.py scan --root <搜索目录> --json

# 枚举 Target
python <skill-dir>/scripts/keil_project.py targets --project <工程路径> --json

keil_build.py — 构建 / 重建 / 清理 / 烧录

python <skill-dir>/scripts/keil_build.py <build|rebuild|clean|flash> \
  --uv4 <UV4路径> \
  --project <工程路径> \
  --target <TargetName> \
  --log-dir <日志目录> \
  --json

rebuild 额外支持 --clean-first 使用 -cr 而非 -r

输出格式

所有脚本以 JSON 格式返回,基础字段为 status(ok/error)、actionsummarydetails,并可能附带 contextartifactsmetricsstatenext_actionstiming

成功示例:

{
  "status": "ok",
  "action": "build",
  "summary": "build 成功,errors=0 warnings=2",
  "details": {
    "project": "project.uvprojx",
    "target": "Debug",
    "log_file": ".build/project-Debug-build.log",
    "flash_file": "Objects/project.hex",
    "debug_file": "Objects/project.axf"
  },
  "metrics": { "errors": 0, "warnings": 2, "flash_bytes": 32768, "ram_bytes": 8192 }
}

错误示例:

{
  "status": "error",
  "action": "flash",
  "error": { "code": "build_not_clean", "message": "最近一次构建存在错误,禁止继续烧录" }
}

核心规则

  • 不修改工程配置文件(.uvprojx / .uvmpw / .uvoptx)
  • 不自动猜测工程路径或 Target,有歧义时必须询问用户
  • 参数解析优先级详见上方"参数解析优先级"章节
  • 构建成功后优先使用返回的 flash_file / debug_filejlink/openocd 串联
  • flash 前必须确认最近一次构建成功(errors == 0)
  • clean 不在自动流程中隐式执行
  • 构建失败时优先展示首个错误和日志文件路径
  • 结果回显中始终包含工程名、Target 名、日志路径;若识别到产物路径也要回显

参考

遇到编译器相关问题时可查阅 references/compiler-notes.md

Related skills

How it compares

Toolchain driver skill for Keil MDK—not a generic CI matrix or an MCP server for chip vendors.

FAQ

Who is keil for?

embedded developers using Keil µVision who want their AI coding agent to compile and report artifact paths without manual IDE clicks every time.

When should I use keil?

During Build when you need to enumerate Targets, incrementally compile or rebuild a.uvprojx, clean outputs, or flash via Keil before handing binaries to J-Link or OpenOCD in Ship or Operate bring-up.

Is keil safe to install?

It executes local UV4 and can flash hardware depending on mode; review the Security Audits panel on this page and set operation_mode 2 or 3 if you want summaries or confirmation before runs.

CLI & Terminalintegrationsdevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.