Tsh Writing Hooks
TheSoftwareHouse/copilot-collections
Custom hook and composable patterns — naming, composition, stable return shapes, lifecycle cleanup, and testing strategies.
Refactor existing Zhin.js plugins into a cleaner standard structure.
$ npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install zhinjs/zhin zhin-plugin-refactoring --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/zhinjs/zhin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/zhin-plugin-refactoring .claude/skills/zhin-plugin-refactoring && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "zhin-plugin-refactoring" agent skill from https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoring into .claude/skills/zhin-plugin-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "zhin-plugin-refactoring", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoringType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install zhinjs/zhin zhin-plugin-refactoring --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhinjs/zhin.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.github/skills/zhin-plugin-refactoring .agents/skills/zhin-plugin-refactoring && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "zhin-plugin-refactoring" agent skill from https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoring into .agents/skills/zhin-plugin-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "zhin-plugin-refactoring", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install zhinjs/zhin zhin-plugin-refactoring --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhinjs/zhin.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.github/skills/zhin-plugin-refactoring .cursor/skills/zhin-plugin-refactoring && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "zhin-plugin-refactoring" agent skill from https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoring into .cursor/skills/zhin-plugin-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "zhin-plugin-refactoring", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/zhinjs/zhin.git --path .github/skills/zhin-plugin-refactoring--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install zhinjs/zhin zhin-plugin-refactoring --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhinjs/zhin.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.github/skills/zhin-plugin-refactoring .gemini/skills/zhin-plugin-refactoring && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "zhin-plugin-refactoring" agent skill from https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoring into .gemini/skills/zhin-plugin-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "zhin-plugin-refactoring", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install zhinjs/zhin zhin-plugin-refactoringInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/zhinjs/zhin.git skills-src && mkdir -p .github/skills && cp -r skills-src/.github/skills/zhin-plugin-refactoring .github/skills/zhin-plugin-refactoring && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "zhin-plugin-refactoring" agent skill from https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoring into .github/skills/zhin-plugin-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "zhin-plugin-refactoring", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install zhinjs/zhin zhin-plugin-refactoring --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/zhinjs/zhin.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.github/skills/zhin-plugin-refactoring .opencode/skills/zhin-plugin-refactoring && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "zhin-plugin-refactoring" agent skill from https://github.com/zhinjs/zhin/tree/main/.github/skills/zhin-plugin-refactoring into .opencode/skills/zhin-plugin-refactoring/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "zhin-plugin-refactoring", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
zhin-plugin-refactoringRefactor existing Zhin.js plugins into a cleaner standard structure.
Zhin Plugin Refactoring is an agent skill from zhinjs/zhin. Refactor existing Zhin.js plugins into a cleaner standard structure. Use when asked to reorganize plugin files, split commands or services, migrate a messy plugin to standard layout, reduce coupling, clean lifecycle logic, or standardize plugin structure without changing behavior. 适用于已有 Zhin 插件重构、结构整理、职责拆分与标准化迁移。
Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files and assets (for example `assets/refactor-target-layout.md`, `references/refactor-before-after-example.md` and `references/refactor-decision-guide.md`).
It sits in Development, covering Refactoring and Hooks and plugins. The repository describes itself as: AI-native TypeScript bot framework — one codebase for 20+ chat platforms (QQ, Discord, Telegram, Slack, WeChat…). Opt-in AI agent with MCP, tools & security policies. <10MB core. The licence is MIT.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit fd5029a. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
pnpmFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Zhin Plugin Refactoring loads about 1.1k tokens when it runs, and up to ~2.2k if it reads all its reference files. Until then it costs about 85 tokens; SKILL.md has 245 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from zhinjs/zhin at commit fd5029a, republished under its MIT licence (© zhinjs). 245 words, ~1,140 tokens.
.claude/skills/zhin-plugin-refactoring/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.把已经存在但结构混乱的 Zhin 插件,整理成更清晰、更符合仓库约定的结构,同时尽量不改变现有行为。
配套参考按需加载:
src/services/、src/models/ 或 pages/zhin-plugin-standard-development先识别:
不要一上来就拆文件。先把当前行为面画清楚。
把现有代码按能力分类:
如果不知道怎么分类,先看 重构决策参考。
如果你需要一个“单文件旧插件如何拆成标准结构”的直观参考,直接看 重构前后对照示例。
根据当前复杂度选择目标结构,而不是追求最完整目录:
plugin.ts,只创建实际存在的命名能力目录src/services/、src/models/pages/<name>/index.tsxtools/<name>/index.ts目标结构可直接参考 目标结构草图。
迁移优先顺序:
优先移动低耦合代码,再移动依赖较多的装配代码。
如果你不确定某段旧代码该落到哪个目录,先对照 重构前后对照示例 再迁移。
重构后的入口文件(plugin.ts)应只负责:
definePlugin()(Plugin Runtime 形态;不要再用 usePlugin() / MessageCommand)context.resources.has/use,如 databaseHostToken / scheduleHostToken / httpHostToken)context.lifecycle.add(...))配置由 schema.json + context.config.get() 声明/读取(不再有 declareConfig())。能力放入明确的约定目录:命令用 commands/**/index.ts,中间件用 middlewares/<name>/index.ts,Handler 用 handlers/<name>/index.ts,Hook 用 hooks/<name>/index.ts,通用工具用 tools/<name>/index.ts,Skill 用 skills/<name>/SKILL.md,Agent 用 agents/<name>/agent.json;专用工具继续放在所属 Skill 或 Agent 的 tools/<name>/index.ts。运行时按目录装配,不要在入口手写注册,也不要把业务细节继续留在入口文件里。
检查以下问题:
context.lifecycle.add 挂反注册)scheduleHostToken 注册并随 generation 回收(不再有 addCron())httpHostToken 注册并有对应释放路径databaseHostToken 后挂载至少验证:
验证命令(按插件包名替换 <pkg>):
pnpm --filter <pkg> build
pnpm --filter <pkg> test
pnpm check:plugin-capability-publish
pnpm check:agent-tool-authoring-boundaries
pnpm check:skill-authoring-boundaries
pnpm check:agent-authoring-boundaries
pnpm check:hook-authoring-boundaries
# 手测:Sandbox 或 test-bot 触发原命令 / 访问原控制台路由输出验证报告:
## 重构验证
- [ ] build 通过
- [ ] test 通过
- [ ] 命令 A:通过 / 未测
- [ ] 路由/页面 B:通过 / 未测
- 回滚风险:(仅列未覆盖路径)| 触发条件 | 一线处理 | 仍失败 |
|---|---|---|
| 重构后命令不触发 | 对比重构前后 commands/ 约定目录的 defineCommand 导出与文件路径 | 回滚该模块,逐文件迁移 |
| 测试大面积失败 | 先恢复行为再谈结构;用 git 对比入口装配 | 🔴 暂停拆文件,只修回归 |
| Host 资源未装配 | 确认 context.resources.has(token) 守卫与 lifecycle 清理 | 对照 重构迁移清单 |
第 1 步「冻结当前行为」完成前,不得删除或改写用户可见命令/路由/页面逻辑。
pages/ 或 Console RPC 契约最终输出应包含:
| 文档 | 路径 |
|---|---|
| 标准开发(新建功能) | .github/skills/zhin-plugin-standard-development/SKILL.md |
| 迁移清单 | ./references/refactor-migration-checklist.md |
| 前后对照 | ./references/refactor-before-after-example.md |
© zhinjs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 4 other files (references, assets) in .github/skills/zhin-plugin-refactoring of zhinjs/zhin.
Open the folder on GitHubat commit fd5029a
Zhin Plugin Refactoring next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Zhin Plugin Refactoring this skillzhinjs/zhin | 137 | — | ~1.1k | Automated safety check: Pass | MIT | |
| Tsh Writing HooksTheSoftwareHouse/copilot-collections | 284 | — | ~3k | Automated safety check: Pass | MIT | |
| Plate Plugin Creatorudecode/plate | 17k | — | ~2.3k | Automated safety check: Pass | Custom licence | |
| Guidelinesakash-network/node | 1.1k | 22 repos | ~577 | Automated safety check: Pass | MIT | |
| Component Refactoringlangflow-ai/langflow | 156k | — | ~3.5k | Automated safety check: Pass | MIT | |
| Migrate Core Code to Submodulestinyhumansai/openhuman | 42k | — | ~2.6k | Automated safety check: Pass | GPL-3.0 |
TheSoftwareHouse/copilot-collections
Custom hook and composable patterns — naming, composition, stable return shapes, lifecycle cleanup, and testing strategies.
udecode/plate
Build new Plate plugins with Slate-first architecture, sane typing, and explicit React/Plate wrapper boundaries.
akash-network/node
Behavioral guidelines to reduce common LLM coding mistakes. An agent skill from akash-network/node.
langflow-ai/langflow
Refactor high-complexity React components in Langflow frontend.
tinyhumansai/openhuman
Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.
luongnv89/claude-howto
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
zhinjs/zhin
Migrate legacy Zhin.js plugins and projects to the convention-based Plugin Runtime — from usePlugin/getPlugin/addCommand/addMiddleware/addComponent/addTool/addCron/declareConfig/useContext and…
zhinjs/zhin
Audit Zhin.js changes for security, performance, lifecycle, and architecture regressions.
zhinjs/zhin
Implement Zhin.js plugins with Plugin Runtime. An agent skill from zhinjs/zhin.
zhinjs/zhin
使用 gh CLI 处理内置 GitHub Tool 未覆盖的 Issue、PR、Release、Workflow、搜索和 API 操作。
zhinjs/zhin
企业微信平台管理能力。当用户在企业微信中请求用户信息查询、部门架构查询、 发送文本消息时使用。即使用户没有提到企业微信,只要上下文是企业微信/WeCom 场景且涉及用户查询、部门管理或消息发送,就应触发。
zhinjs/zhin
签到积分系统查询能力。当用户想查看自己的积分、签到排行榜、连签天数、 或了解签到奖励时使用。日常签到通过聊天命令触发,此技能提供积分查询的 AI 工具。
Categories
Refactor existing Zhin.js plugins into a cleaner standard structure. Zhin Plugin Refactoring is an agent skill from zhinjs/zhin.js plugins into a cleaner standard structure.
Zhin Plugin Refactoring fits situations like: asked to reorganize plugin files; migrate a messy plugin to standard layout; reduce coupling; clean lifecycle logic.
Run `npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a claude-code`. Or copy the skill folder (.github/skills/zhin-plugin-refactoring in zhinjs/zhin) into .claude/skills/zhin-plugin-refactoring in your project. Claude Code loads it when a task matches its description.
Run `npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a codex`. Or copy the skill folder (.github/skills/zhin-plugin-refactoring in zhinjs/zhin) into .agents/skills/zhin-plugin-refactoring in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zhinjs/zhin --skill zhin-plugin-refactoring -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/zhin-plugin-refactoring, .gemini/skills/zhin-plugin-refactoring, .github/skills/zhin-plugin-refactoring and .opencode/skills/zhin-plugin-refactoring in your project.
Going by SKILL.md and its folder, Zhin Plugin Refactoring needs the command-line tools its instructions call (pnpm).
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Zhin Plugin Refactoring is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.1k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.1k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Zhin Plugin Refactoring: Tsh Writing Hooks (TheSoftwareHouse/copilot-collections, 284 stars), Plate Plugin Creator (udecode/plate, 17k stars), Guidelines (akash-network/node, 1.1k stars) and Component Refactoring (langflow-ai/langflow, 156k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
zhinjs (a GitHub organization) maintains it in zhinjs/zhin, which has 137 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on September 23, 2026.
Source: zhinjs/zhin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.