test

test is a command for Claude Code from jzl-maker/EA-SKILL. It costs 0 tokens per session (1,931 once invoked), scanned A, original, MIT.

A command for generating and running tests for embedded C code, either on a computer or on a physical development board. It creates both runnable test code and a written list of test cases.

In plain words
What is it for?
Use it to test a selected C file or function with lightweight unit tests, or to create acceptance tests for a board feature. Results show which cases passed or failed.
Why use it?
It removes much of the manual work needed to test hardware-related code and records what each test is meant to check. Simple functions can be tested on a computer, while hardware-dependent logic can be tested on the board.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it to test a selected C file or function with lightweight unit tests, or to create acceptance tests for a board feature. Results show which cases passed or failed.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/jzl-maker/ea-skill/test
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/jzl-maker/EA-SKILL

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test

README.md
[![agentmods](https://agentmods.dev/badge/commands/jzl-maker/ea-skill/test/github.svg)](https://agentmods.dev/commands/jzl-maker/ea-skill/test)
Your own site
<a href="https://agentmods.dev/commands/jzl-maker/ea-skill/test"><img src="https://agentmods.dev/badge/commands/jzl-maker/ea-skill/test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test

Your own site · 80×15
<a href="https://agentmods.dev/commands/jzl-maker/ea-skill/test"><img src="https://agentmods.dev/badge/commands/jzl-maker/ea-skill/test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,931 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01931
Opus 5.5 $0.00000 $0.00772
Sonnet 5.5 $0.00000 $0.00386
Haiku 4.5 $0.00000 $0.00193

Measured 1mo ago against content hash ddc6e8c912c5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/test.md · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.

命令: /ea test (测试生成与执行)

功能

测试双产出:每个测试都生成「测试用例文档 + 可运行测试代码」。

  • unit:纯函数 host 单元测试(轻量自研:桩函数 + 断言 + main,零框架依赖)
  • board:板级工装验收测试(用例文档 + 板载测试固件/驱动脚本)

触发

/ea test unit <文件>               # 对指定 .c 文件的纯函数生成单测
/ea test board <功能描述>          # 对功能/需求生成板级工装用例

⚠️ unit 只收 1 个位置参数(target)。写 /ea test unit <文件> <函数名> 会 error: unrecognized arguments —— 工具没有筛选函数名的参数。要只测某个函数,先跑一次 拿到「候选函数」列表,生成后在 .c 里删掉其余用例即可。

单元测试(unit)

流程

  1. 【读 context】 确认工程上下文
  2. 【扫描目标】 tools/test-runner/scripts/test_gen.py unit <文件> 提取函数签名,识别纯函数(无硬件外设调用)
  3. 【生成双产出】 写入 <STATE_DIR>/tests/unit/:
    • 测试代码 <name>.c:桩函数(mock GPIO_SetBits/USART_SendData 等硬件调用)+ 断言测试体 + main runner
    • 测试用例文档 <name>.md:用例ID / 输入 / 预期输出 / 覆盖点
  4. 【补全骨架】 ⚠️ 这一步不能跳 —— 见下「生成的骨架必然编译不过」
  5. 【host 编译运行】 补全后再编译(Windows 用 mingw gcc;也可用 arm-none-eabi-gcc)
  6. 【输出结果】 每个用例 PASS/FAIL

⚠️ 生成的骨架必然编译不过 —— 它是半成品,不是成品

test_gen.py 产出的是待补全的骨架:它只认函数名,不解析签名,所以断言一律写成 f(0)。拿未经补全的产物直接 --cc gcc 必然失败,这是预期行为,不是工具坏了:

现象 原因
implicit declaration of 'X' 骨架把原型声明写成了注释(/* int target_func(int a, int b); */),等你替换
too few arguments to function 'X' 实参一律按 f(0) 生成,无视真实签名(3 个形参也只给 1 个实参)
void value not ignored void 函数也被套进了 ASSERT_EQ(...)
fatal error: XXX.h: No such file 编译命令不带 -I,头文件搜索路径不从 .uvprojx 继承
undefined reference --cc gcc 只编译生成的 .c,未链接被测源;且 static 函数跨 TU 本就链不上

补全清单(AI 按需求逐项做,做完再编译):

  1. 换成真实的 #include 与函数原型声明(骨架里是注释)
  2. 按真实签名填实参,void 函数改用 ASSERT_TRUE 或直接调用
  3. 补 -I <头文件目录>,并把被测 .c 一起编译;static 函数改为在骨架中 #include 被测源
  4. 逐个核对 /* TODO: 核对输入/预期 */,给出真实输入与预期输出

调用方式

# 生成(不编译)
python <SKILL>/tools/test-runner/scripts/test_gen.py unit <目标.c>
# 产物: <STATE_DIR>/tests/unit/<name>.c + <name>.md

# 补全骨架后再编译运行(示例:头文件目录 + 被测源一并给上)
gcc <STATE_DIR>/tests/unit/<name>.c <被测源.c> -I <头文件目录> -o /tmp/ut && /tmp/ut

硬件耦合处理

  • 目标函数直接调用硬件寄存器/外设库且无法桩化 → 提示「该逻辑适合板级测试」→ 走 board
  • 测试代码中桩函数与真实实现冲突时,用 #ifdef EA_TEST 包裹被测模块

Read the full file on GitHub · 103 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed ddc6e8c912c5
  2. 1mo ago Changed · +34 lines 7ff1d050ca94
  3. 1mo ago Changed cb2f77810ccc
  4. 1mo ago First seen · 69 lines · 0 tokens per session scan A c744c1dd142f

Subscribe to this mod's changes

test is a command published in the GitHub repository jzl-maker/EA-SKILL (9 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,931 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.