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.
npx agentmods add skills/zhinjs/zhin/plugin-testnpx skills add zhinjs/zhin --skill plugin-testgit clone --depth 1 https://github.com/zhinjs/zhinWhat 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 | $0.00051 | $0.00855 |
| Opus 5 | $0.00026 | $0.00428 |
| Sonnet 5 | $0.00010 | $0.00171 |
| Haiku 4.5 | $0.00005 | $0.00085 |
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 2d 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 runtime start。
适用场景
- 「帮我写测试」「增加覆盖率」「测试这个命令」
- 新功能配套测试、发布前验证
环境
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.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.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的依赖
输出格式
## 测试摘要
- 覆盖:`commands/...` / `tools/...`
- 命令:`pnpm --filter <pkg> test`
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.
- 2d ago First seen · 107 lines · 51 tokens per session scan A 06b03069c589
plugin-test is a skill published in the GitHub repository zhinjs/zhin (135 stars, last pushed 5d ago), licensed MIT. It adds 51 tokens to every session and 855 once invoked, about $0.0003 per session on Opus 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.
Other skills, from other repositories
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
coding
Use when five specialized coding agents (linter, perf, refactor, security, test) that enforce quality gates across the development lifecycle. From lint enforcement through performance profiling, refactoring, security auditing, and test coverage. Use when working with coding agents.
build-monetized-app
Use when the task is building a new app on Eliza Cloud that earns money — chat apps, agent apps, MCP-backed tools, anything that calls the cloud's chat/messages/inference endpoints on behalf of users. Covers app registration, container deploy, markup configuration, affiliate header, app charge requests, x402 payment…
contribute-to-eliza
Finish and prove a scoped elizaOS GitHub issue, or independently review and repair an open elizaOS pull request. Use when contributing compute to elizaOS by selecting unclaimed work, implementing or reviewing changes, adding real tests and evidence, validating artifacts, or preparing a contribution for maintainer…
discord
Use when you need to control Discord from Otto via the discord tool: send messages, react, post or upload stickers, upload emojis, run polls, manage threads/pins/search, create/edit/delete channels and categories, fetch permissions or member/role/channel info, set bot presence/activity, or handle moderation actions in…
eliza-cloud-buy-domain
Use whenever a user wants to register or buy a custom domain for an Eliza Cloud app — including in the same request as building the app ("build me X and put it on Y.com"). Uses Cloudflare as registrar after explicit user confirmation, paid from the user's existing cloud credit balance. Pairs with build-monetized-app…