plugin-init

A project starter for creating Zhin.js plugins, which are installable packages that extend the Zhin.js bot framework. It sets up the required files, folders, package metadata, entry point, and documentation.

In plain words
What is it for?
Use it to start a new Zhin.js plugin, choose its basic structure, and prepare folders for commands, tests, configuration, or other supported plugin parts.
Why use it?
It removes the need to remember the framework’s required plugin layout and startup rules. It also helps avoid using older plugin registration patterns that the input says are no longer supported.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/zhinjs/zhin/plugin-init
Any agent
npx skills add zhinjs/zhin --skill plugin-init
Clone the repo
git clone --depth 1 https://github.com/zhinjs/zhin

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,935 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00056 $0.01935
Opus 5 $0.00028 $0.00967
Sonnet 5 $0.00011 $0.00387
Haiku 4.5 $0.00006 $0.00194

Measured 2d ago against content hash 85352f35aacc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

plugin-init 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.

packages/toolkit/create-zhin/template/skills/plugin-init/SKILL.md · 204 lines

How it starts

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

Zhin 插件初始化(Plugin Runtime)

引导创建一个符合 Plugin Runtime 的新插件。唯一启动路径是 zhin runtime start;插件即 package,plugin.ts 必须 default-export definePlugin()

禁止再脚手架 usePlugin() / MessageCommand / src/index.ts 命令式注册——zhin.js/nodebootstrapNode 已删除,唯一入口是 Plugin Runtime。

适用场景

  • 用户说「帮我创建一个插件」「新建插件」「初始化一个 xxx 插件」
  • 需要从零搭建插件包结构

优先路径(二选一)

场景 命令 / 动作 输出
已有 Zhin 项目 zhin new <name>(仓库根或项目根) 官方 npm 包结构
全新应用 pnpm create zhin-app 完整 bot 项目

仅当用户明确要求「手写目录」或 zhin new 不可用时,才走下方手工流程。

初始化流程

第 1 步:确认插件信息

向用户确认:

  1. 插件名称:kebab-case,如 my-plugingroup-manager(须匹配 ^[a-z][a-z0-9-]*$
  2. 插件类型:普通插件 / 服务插件 / 适配器插件
  3. 核心功能:命令、中间件、组件、定时任务、AI 工具、控制台页
  4. 是否需要数据库
  5. 是否需要控制台前端

第 2 步:生成目录结构

命名规范:

  • npm 包名:社区插件 zhin.js-{name},官方插件 @zhin.js/{name}
  • 目录位于 plugins/{name}/(或项目内约定路径)

最小结构(约定目录插件):

plugins/{name}/
├── package.json          # 含 "zhin" manifest
├── schema.json           # 可选:插件配置
├── plugin.ts             # definePlugin 入口(只做装配)
├── tsconfig.json
├── README.md
├── commands/             # defineCommand,路径即路由
│   └── hello.ts
├── tests/
│   └── hello.test.ts
└── skills/               # 可选:给 AI 用的 SKILL
    └── {name}/
        └── SKILL.md

单文件入门(不必先拆目录):见仓库 examples/single-file-bot/bot.ts——在 setup({ addCommand }) 里注册命令。

按需增加约定目录(一个文件一个能力,default export):

目录 API
commands/**/*.ts defineCommand()
middlewares/*.ts defineMiddleware()
components/*.tsx defineComponent()
tools/*.ts defineAgentTool()
pages/*.tsx definePage()
skills/<name>/SKILL.md Markdown Skill
agents/<name>.agent.md Markdown Agent

第 3 步:生成 package.json

{
  "name": "zhin.js-{name}",
  "version": "0.1.0",
  "type": "module",
  "zhin": {
    "protocol": 1,
    "type": "plugin",
    "entry": "./plugin.ts",
    "features": ["@zhin.js/command"]
  },
  "exports": {
    ".": "./plugin.ts"
  },
  "files": ["plugin.ts", "commands", "schema.json", "README.md"],
  "peerDependencies": {
    "zhin.js": "*"
  },
  "devDependencies": {
    "zhin.js": "latest"
  }
}

Read the full file on GitHub · 204 lines

Files

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.

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. 2d ago First seen · 204 lines · 56 tokens per session scan A 85352f35aacc

Subscribe to this mod's changes

plugin-init is a skill published in the GitHub repository zhinjs/zhin (135 stars, last pushed 5d ago), licensed MIT. It adds 56 tokens to every session and 1,935 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.

Related

Other skills, from other repositories

agent-development

This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development…

mahmoud20138/Tradecraft · 80 tokens

tcapi

Skill to call Cloud API for Tencent Cloud (腾讯云). Used for cloud automation or resource management. 当用户需要查询、创建、管理腾讯云资源,或执行云 API 自动化操作时触发。优先使用 Octop 自带 venv 中的 tccli,凭证支持全自动 OAuth 登录。.

TencentCloud/Octop · 68 tokens

test-driven-development

TDD: enforce RED-GREEN-REFACTOR, tests before code.

mateaix/mateclaw · 20 tokens

ckjia-shopping

跨平台比价与购物推荐 / Cross-platform price comparison. 淘宝 / 京东 / 天猫 / 拼多多商品聚合搜索 + 拍图识物。需要先启用 ckjia-shopping MCP server 并配置 CKJIAMCPKEY 才能用。.

mateaix/mateclaw · 64 tokens

xhs_note

小红书图文创作 / 笔记 / 种草文案 (xiaohongshu / red note) — 端到端:成文→配图(≥3 张竖版)→去AI化→在线预览打包交付。以图为主、文字辅助:标题四件套 + 碎句正文 + 话题标签,配 3:4 竖版卡片,最少 3 张图。honors user persona & style memory.

mateaix/mateclaw · 114 tokens

agent-creation

Create a new Stencila agent. Use when asked to create, write, scaffold, or set up an agent directory or AGENT.md file. Covers workspace and user-level agents with model, provider, tool, trust, and MCP configuration.

stencila/stencila · 53 tokens