Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/zhinjs/zhinnpx agentmods add skills/zhinjs/zhin/plugin-testWrote 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.
[](https://agentmods.dev/skills/zhinjs/zhin/plugin-test)<a href="https://agentmods.dev/skills/zhinjs/zhin/plugin-test"><img src="https://agentmods.dev/badge/skills/zhinjs/zhin/plugin-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.
<a href="https://agentmods.dev/skills/zhinjs/zhin/plugin-test"><img src="https://agentmods.dev/badge/skills/zhinjs/zhin/plugin-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00051 | $0.00874 |
| Opus 5.5 | $0.00020 | $0.00350 |
| Sonnet 5.5 | $0.00010 | $0.00175 |
| Haiku 4.5 | $0.00005 | $0.00087 |
Grade A, and why
plugin-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 19d 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.
How it starts
The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Zhin 插件测试(Plugin Runtime)
为 Plugin Runtime 插件写 Vitest 测试。不要再测 new Plugin('/path') / usePlugin / MessageCommand 旧生命周期——CLI 路径是 zhin start(pnpm dev = zhin start --foreground --watch source config)。
适用场景
- 「帮我写测试」「增加覆盖率」「测试这个命令」
- 新功能配套测试、发布前验证
环境
pnpm test
pnpm test:watch
pnpm test:coverage
全局 API 已注入(describe / it / expect / vi)。根 vitest.config.ts:globals: true,匹配 **/*.test.ts。
优先测什么
| 层级 | 测什么 | 怎么测 |
|---|---|---|
| 命令逻辑 | defineCommand 的 execute |
直接调用 definition,传入 mock params/args/input |
| 工具逻辑 | defineAgentTool 的 execute |
同上,mock inputSchema 入参 |
| 纯函数 / 服务 | 业务模块 | 普通单元测,不碰 Runtime |
| 装配契约 | package zhin manifest、default export |
轻量:import default 是 PluginDefinition |
集成级「起完整 bot」成本高;优先单测 execute。需要端到端时用 examples/minimal-bot / Sandbox 手测,或仓库已有 Runtime 测试 helper(搜 definePlugin / PluginScope 相关测试)。
模板:命令 execute
import { describe, it, expect } from 'vitest';
import hello from '../commands/hello/index.js';
describe('commands/hello', () => {
it('returns greeting', async () => {
const result = await hello.execute({
params: {},
args: [],
input: { $content: 'hello' },
config: {},
} as never);
expect(result).toBe('Hello!');
});
});
带参数的命令对 params.name 断言即可。
模板:工具 execute
import { describe, it, expect } from 'vitest';
import weather from '../tools/get_weather/index.js';
describe('tools/get_weather', () => {
it('formats city weather', async () => {
const text = await weather.execute({ city: '上海' }, {} as never);
expect(text).toContain('上海');
});
});
禁止
// ❌ 旧经典 Plugin 生命周期
import { Plugin } from '@zhin.js/core'
root = new Plugin('/test/root.ts')
plugin = new Plugin('/plugins/my-plugin/src/index.ts', root)
// ❌ 依赖 usePlugin / MessageCommand 的测试
验证清单
-
pnpm --filter <pkg> test通过 - 新命令/工具有至少一条正向用例
- 边界(缺参、空串)按需求覆盖
- 不引入对
zhin.js/node/bootstrapNode的依赖
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 19d ago Changed eae5d2247481
- 2mo ago Changed 28cefb879161
- 3mo ago First seen · 107 lines · 51 tokens per session scan A 06b03069c589
plugin-test is a skill published in the GitHub repository zhinjs/zhin (136 stars, last pushed yesterday), licensed MIT. It adds 51 tokens to every session and 874 once invoked, about $0.0002 per session on Opus 5.5. 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-30.
plugin-test compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| plugin-testzhinjs/zhin | Skill | 136 | yesterday | MIT | A | 51 | Claude Code, Codex |
| test-generatorchainlesschain/chainlesschain | Skill | 11 | 17d ago | none | A | 18 | Claude Code |
| api-test-suite-builderseaworld008/Commonly-used-high-value-skills | Skill | 75 | 2d ago | MIT | A | 32 | Claude Code, Codex |
| Code Coverage AnalysisPramodDutta/qaskills | Skill | 253 | 29d ago | MIT | A | 45 | Claude Code, Codex |
| codingoyi77/1ai-skills | Skill | 19 | yesterday | MIT | A | 54 | Claude Code |
| java-junitPracticalSwan/agent-skills | Skill | 25 | 16d ago | MIT | A | 24 | Codex |
| csharp-xunitPracticalSwan/agent-skills | Skill | 25 | 16d ago | MIT | A | 25 | Codex |