Claw ESP Expert
Use this skill when the user needs help with ESP-IDF environment checks, example discovery, pin safety review, or build diagnostics.
What this bundle includes
This ClawHub-facing bundle exposes nine stable MVP tools:
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
- INLINECODE6
- INLINECODE7
- INLINECODE8
These tools are implemented in the bundled runtime and are invoked through scripts/run-tool.mjs.
Safety contract
- - Treat this skill as a diagnostic-first ESP-IDF expert.
- Default to check and explain, not silent modification.
- Do not claim support for fully autonomous repair, deep serial-port management, or HIL automation unless the repository actually implements them.
- Do not invent additional tools beyond the ones listed in this file.
- Do not read arbitrary local config files unless the user explicitly asks; the MVP bundle does not require VS Code config scanning.
- Do not modify project files or system permissions unless the user clearly asks for that action.
Tool contract
manage_env
Purpose:
- - inspect local ESP-IDF availability
- report
$IDF_PATH, common install paths, python/python3, and idf.py availability - when explicitly asked, return mirror-aware manual installation guidance instead of running upstream install scripts automatically
Example invocation:
CODEBLOCK0
explore_demo
Purpose:
- - inspect local INLINECODE15
- find matching demos by keyword
- read the best matching
README.md / INLINECODE17 - summarize hardware requirements and structure
Example invocation:
CODEBLOCK1
safe_build
Purpose:
- - run GPIO safety audit before build
- reject fatal pin conflicts early
- invoke
idf.py build only after the audit passes - return structured build diagnostics, including partition overflow, memory overflow, missing headers, component resolution failures, config issues, and link errors
Example invocation:
CODEBLOCK2
analyze_partitions
Purpose:
- - parse
partitions.csv from the current ESP-IDF project - identify the most likely app partition (
factory / ota_0) - combine partition table data with overflow logs
- return a recommended expanded partition size and an updated CSV draft
- return a structured patch-style before/after suggestion for INLINECODE24
Example invocation:
CODEBLOCK3
decode_panic
Purpose:
- - parse ESP-IDF panic logs
- extract exception reason, registers, and backtrace addresses
- call the correct
addr2line tool for Xtensa or RISC-V chips - return decoded source locations from the ELF file
Example invocation:
CODEBLOCK4
analyze_monitor
Purpose:
- - inspect raw
idf.py monitor output - detect panic/backtrace markers automatically
- return the recent log excerpt
- trigger panic decoding when an ELF path is available
Example invocation:
CODEBLOCK5
flash_and_monitor
Purpose:
- - run INLINECODE30
- capture combined stdout/stderr
- analyze the resulting monitor log
- automatically trigger panic decoding when panic markers appear and an ELF path is available
- return stage status, stage summary, timeout info, recent log tail, and common serial/tool failure categories
Example invocation:
CODEBLOCK6
execute_project
Purpose:
- - run the minimum execution loop for an ESP-IDF project
- perform hardware audit first
- build the project
- then run INLINECODE32
- return a single structured result for the whole flow
Example invocation:
CODEBLOCK7
resolve_component
Purpose:
- - query the official ESP Component Registry
- prefer
espressif/* when an official component is a strong match - suggest the best-matching component from official registry data
- generate a minimal
idf_component.yml dependency snippet - optionally merge that dependency into an existing manifest draft
- return a structured patch-style before/after suggestion for the manifest
- surface component docs, supported targets, and the matching version
Example invocation:
CODEBLOCK8
Runtime notes
- -
manage_env can succeed even when ESP-IDF is not installed, because reporting NOT_FOUND is a valid diagnostic result. - INLINECODE38 returns manual install guidance; it does not clone repositories or run upstream install scripts inside the skill bundle.
- INLINECODE39 uses the official ESP Component Registry over the network and should be treated as an explicit online lookup step.
- INLINECODE40 needs the matching ELF file and a working
addr2line binary from the ESP-IDF toolchain. - INLINECODE42 is still log-driven; it does not open serial ports by itself in this MVP.
- INLINECODE43 does execute
idf.py flash monitor, so the serial port, permissions, and toolchain environment must already be working. - INLINECODE45 depends on a shell environment where
idf.py is executable. - The current hardware rules cover
esp32, esp32s3, esp32c3, esp32c6, esp32c5, esp32h2, and esp32p4. - Common SKU names are normalized to family rules, for example
ESP32-C6FH4 -> esp32c6 and ESP32-S3-PICO-1-N8R2 -> esp32s3. - Audit results can include
file, line, and evidence fields so the host can point back to the exact source location. - The pin audit can resolve several common patterns beyond direct literals, including
pin_bit_mask, common ..._io_num fields, macro chains, simple assignment aliases, and #define / const gpio_num_t aliases. - Pass user-controlled text through stdin JSON, not shell interpolation.
Files
- -
scripts/run-tool.mjs — minimal stdin-driven tool runner for ClawHub-safe execution - INLINECODE64 — bundled runtime entry
- INLINECODE65 — current SoC rules database (
esp32, esp32s3, esp32c3, esp32c6, esp32c5, esp32h2, esp32p4)
Out of scope for this MVP bundle
The following ideas are roadmap items, not current bundle guarantees:
- - automatic
idf_component.yml maintenance - automatic
partitions.csv edits - deep serial-port management UX
- HIL automation with INLINECODE75
Claw ESP Expert
当用户需要ESP-IDF环境检查、示例发现、引脚安全审查或构建诊断方面的帮助时,请使用此技能。
本技能包包含内容
此面向ClawHub的技能包提供九个稳定的MVP工具:
- - manageenv
- exploredemo
- resolvecomponent
- analyzepartitions
- decodepanic
- analyzemonitor
- flashandmonitor
- executeproject
- safebuild
这些工具在打包的运行时中实现,并通过scripts/run-tool.mjs调用。
安全约定
- - 将此技能视为诊断优先的ESP-IDF专家。
- 默认采取检查并解释的方式,而非静默修改。
- 除非仓库实际实现了完全自主修复、深度串口管理或HIL自动化,否则不得声称支持这些功能。
- 不得创建本文件中列出工具之外的额外工具。
- 除非用户明确要求,否则不得读取任意本地配置文件;MVP包不需要VS Code配置扫描。
- 除非用户明确要求,否则不得修改项目文件或系统权限。
工具约定
manage_env
用途:
- - 检查本地ESP-IDF可用性
- 报告$IDF_PATH、常见安装路径、python/python3及idf.py的可用性
- 当明确要求时,返回带镜像感知的手动安装指南,而非自动运行上游安装脚本
调用示例:
bash
printf %s {action:check} | node scripts/run-tool.mjs manage_env --stdin
explore_demo
用途:
- - 检查本地$IDFPATH/examples
- 按关键词查找匹配的示例
- 读取最佳匹配的README.md / READMECN.md
- 总结硬件需求和结构
调用示例:
bash
printf %s {query:gpio} | node scripts/run-tool.mjs explore_demo --stdin
safe_build
用途:
- - 在构建前运行GPIO安全审计
- 提前拒绝致命引脚冲突
- 仅在审计通过后调用idf.py build
- 返回结构化构建诊断信息,包括分区溢出、内存溢出、缺少头文件、组件解析失败、配置问题和链接错误
调用示例:
bash
printf %s {projectPath:/path/to/project,chip:esp32} | node scripts/run-tool.mjs safe_build --stdin
analyze_partitions
用途:
- - 解析当前ESP-IDF项目中的partitions.csv
- 识别最可能的应用程序分区(factory / ota_0)
- 结合分区表数据和溢出日志
- 返回推荐的分区扩展大小和更新的CSV草案
- 返回partitions.csv的结构化补丁式前后对比建议
调用示例:
bash
printf %s {projectPath:/path/to/project,rawLog:Part \factory\ ... overflow 0x20000} | node scripts/run-tool.mjs analyze_partitions --stdin
decode_panic
用途:
- - 解析ESP-IDF恐慌日志
- 提取异常原因、寄存器和回溯地址
- 为Xtensa或RISC-V芯片调用正确的addr2line工具
- 从ELF文件返回解码后的源代码位置
调用示例:
bash
printf %s {chip:esp32s3,elfPath:/path/to/app.elf,log:Guru Meditation Error...} | node scripts/run-tool.mjs decode_panic --stdin
analyze_monitor
用途:
- - 检查原始idf.py monitor输出
- 自动检测恐慌/回溯标记
- 返回最近的日志片段
- 当ELF路径可用时触发恐慌解码
调用示例:
bash
printf %s {chip:esp32s3,elfPath:/path/to/app.elf,log:...monitor output...} | node scripts/run-tool.mjs analyze_monitor --stdin
flashandmonitor
用途:
- - 运行idf.py flash monitor
- 捕获合并的stdout/stderr
- 分析生成的监视器日志
- 当出现恐慌标记且ELF路径可用时自动触发恐慌解码
- 返回阶段状态、阶段摘要、超时信息、最近日志尾部及常见串口/工具故障类别
调用示例:
bash
printf %s {projectPath:/path/to/project,chip:esp32s3,port:/dev/ttyUSB0} | node scripts/run-tool.mjs flashandmonitor --stdin
execute_project
用途:
- - 运行ESP-IDF项目的最小执行循环
- 首先执行硬件审计
- 构建项目
- 然后运行flashandmonitor
- 返回整个流程的单一结构化结果
调用示例:
bash
printf %s {projectPath:/path/to/project,chip:esp32s3,port:/dev/ttyUSB0} | node scripts/run-tool.mjs execute_project --stdin
resolve_component
用途:
- - 查询官方ESP组件注册表
- 当官方组件强匹配时优先选择espressif/*
- 从官方注册表数据中推荐最佳匹配组件
- 生成最小化的idf_component.yml依赖片段
- 可选地将该依赖合并到现有清单草案中
- 返回清单的结构化补丁式前后对比建议
- 展示组件文档、支持的目标和匹配版本
调用示例:
bash
printf %s {query:ledstrip,target:esp32s3} | node scripts/run-tool.mjs resolvecomponent --stdin
运行时说明
- - 即使ESP-IDF未安装,manageenv也能成功执行,因为报告NOTFOUND是有效的诊断结果。
- manageenv({ action: install })返回手动安装指南;它不会在技能包内克隆仓库或运行上游安装脚本。
- resolvecomponent通过网络使用官方ESP组件注册表,应视为显式的在线查找步骤。
- decodepanic需要匹配的ELF文件和ESP-IDF工具链中可用的addr2line二进制文件。
- analyzemonitor仍基于日志驱动;在此MVP中不会自行打开串口。
- flashandmonitor确实执行idf.py flash monitor,因此串口、权限和工具链环境必须已正常工作。
- safebuild依赖于idf.py可执行的shell环境。
- 当前硬件规则涵盖esp32、esp32s3、esp32c3、esp32c6、esp32c5、esp32h2和esp32p4。
- 常见SKU名称被标准化为系列规则,例如ESP32-C6FH4 -> esp32c6和ESP32-S3-PICO-1-N8R2 -> esp32s3。
- 审计结果可包含file、line和evidence字段,以便主机指向确切的源代码位置。
- 引脚审计可解析直接字面量之外的几种常见模式,包括pinbitmask、常见的...ionum字段、宏链、简单赋值别名以及#define / const gpionum_t别名。
- 通过stdin JSON传递用户控制的文本,而非shell插值。
文件
- - scripts/run-tool.mjs — 用于ClawHub安全执行的最小化stdin驱动工具运行器
- dist/index.js — 打包的运行时入口
- dist/data/soc/*.json — 当前SoC规则数据库(esp32、esp32s3、esp32c3、esp32c6、esp32c5、esp32h2、esp32p4)
本MVP包范围外
以下想法是路线图项目,而非当前包的保证:
- - 自动维护idf_component.yml
- 自动编辑partitions.csv
- 深度串口管理用户体验
- 使用pytest-embedded的HIL自动化