Plugin Dev logo

Plugin Dev

OrganizationPopular
Prismer-AI
plugin-dev

Prismer Evolution Plugin 开发指南 — 快速迭代 hook/skill、调试、日志查看、测试、发布全流程

Overview

PublisherPrismer-AI
RepositoryPrismerCloud
Skill nameplugin-dev
Stars
1.6K
Forks
14
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Prismer-AI on GitHub. Read the source before you install it.

Installation

Install the Plugin Dev AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Prismer-AI/PrismerCloud.git /tmp/PrismerCloud
mkdir -p .claude/skills
cp -r /tmp/PrismerCloud/sdk/prismer-cloud/claude-code-plugin/skills/plugin-dev .claude/skills/plugin-dev
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Plugin Dev in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Plugin Dev on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Plugin Dev is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Prismer Plugin 开发指南

本文档是插件开发的完整参考。涵盖环境搭建、快速迭代、调试排查、测试、发布全流程。


1. 快速开始 — Dev Mode

不要用 npm publish + /plugin install 的循环。 使用本地开发模式:

bash
cd sdk/prismer-cloud/claude-code-plugin
./scripts/dev.sh

这做了什么:

  • claude --plugin-dir . 直接加载本地文件(不走 npm)
  • 使用独立的 .dev-cache/ 目录(不污染生产 cache)
  • 自动设 PRISMER_LOG_LEVEL=debug

修改 hook 后怎么生效:

你改了什么怎么生效
hook script (scripts/*.mjs)在 Claude Code 里输入 /clear(2 秒)
skill 内容 (skills/*/SKILL.md)/clear/reload-plugins
hooks.json (新增/删除 hook)退出 Claude Code 重新运行 ./scripts/dev.sh
.mcp.json不影响(dev mode 不加载 .mcp.json)

迭代循环: 改代码 → /clear → 测试 → 看日志 → 再改。每次 2 秒,不需要装卸。


2. Hook 隔离测试

不需要启动完整 Claude Code 就能测试单个 hook:

bash
# 测试 SessionStart (模拟 startup 事件)
node scripts/test-hook.mjs session-start.mjs

# 测试 SessionStart (模拟 resume 事件)
node scripts/test-hook.mjs session-start.mjs --event resume

# 测试 PostToolUse (模拟 Bash 工具完成)
echo '{"tool_name":"Bash","tool_input":{"command":"npm run build"},"tool_result":{"stdout":"error TS2345"}}' | \
  node scripts/test-hook.mjs post-bash-journal.mjs

# 测试 PreToolUse stuck detection (模拟重复错误)
echo '{"tool_name":"Bash","tool_input":{"command":"npm run build"}}' | \
  node scripts/test-hook.mjs pre-bash-suggest.mjs

# 带自定义环境变量
node scripts/test-hook.mjs session-start.mjs --env PRISMER_API_KEY=sk-prismer-test-xxx

# 详细输出(含环境变量)
node scripts/test-hook.mjs session-start.mjs --verbose

输出说明:

  • [STDOUT] — 会注入到 Claude 上下文的内容
  • [STDERR] — 调试日志(不显示给 Claude)
  • [Exit: N] — 退出码(0 = 正常)
  • [Cache files] — 测试后生成的缓存文件

3. 日志与调试

3.1 查看调试日志

bash
# Dev mode 日志
tail -f .dev-cache/prismer-debug.log

# 格式化输出(更可读)
tail -20 .dev-cache/prismer-debug.log | while IFS= read -r line; do
  echo "$line" | node -e "
    const l=JSON.parse(require('fs').readFileSync(0,'utf8').trim());
    console.log(\`[\${l.ts.slice(11,19)}] \${l.lvl.toUpperCase()} [\${l.hook}] \${l.msg}\`,
      Object.fromEntries(Object.entries(l).filter(([k])=>!['ts','lvl','hook','msg'].includes(k))))
  " 2>/dev/null
done

在 Claude Code 中也可以用 /prismer:debug-log 查看。

3.2 日志级别

通过 PRISMER_LOG_LEVEL 环境变量控制:

级别内容场景
debug所有操作(含跳过的 trivial 命令)Dev mode(默认)
info关键操作(sync/memory/gene/signal)生产(默认)
warn仅失败和超时排查特定问题
error仅错误(同时输出到 stderr)最低噪音

3.3 常见问题速查

# 进化同步不工作?
grep sync-pull .dev-cache/prismer-debug.log

# Stuck detection 没触发?
grep stuck .dev-cache/prismer-debug.log

# Gene feedback 丢了?
grep gene-feedback .dev-cache/prismer-debug.log

# Memory 加载失败?
grep memory .dev-cache/prismer-debug.log

# 看某个 hook 的所有日志
grep '"hook":"session-start"' .dev-cache/prismer-debug.log

3.4 健康报告

SessionStart 完成后会输出一行健康摘要:

[Prismer] ✓ scope:myapp | genes:5 | memory:3 files | skills:2 synced | sync:ok | 340ms

告警时:

[Prismer] ⚠ scope:myapp | sync:timeout | 2100ms

字段含义:

  • scope — 当前项目 scope(来自 package.json name 或 git remote)
  • genes — 拉取到的 proven 策略数量
  • memory — 记忆文件数量
  • skills — 本次同步的技能数
  • sync — 同步状态(ok/timeout/error/skip)

4. 架构速览

4.1 Plugin 组件

plugin/
├── hooks/hooks.json     → 8 个 hook 定义,Claude Code 按事件触发
├── scripts/*.mjs        → Hook 实现(独立 Node 进程,stdin/stdout 通信)
├── scripts/lib/          → 共享工具(config 解析、signal 模式、日志)
├── skills/*/SKILL.md    → Skill 定义(Claude 读取后决定调用工具)
├── .mcp.json            → MCP server 配置(不随 npm 分发,可选安装)
└── .cache/              → 运行时数据(journal、cursor、pending)

4.2 Hook 数据流

SessionStart ──→ sync pull + memory + skills ──→ 输出被动上下文
     ▼ (session 进行中)
PreToolUse(Bash) ──→ 读 journal 计信号次数 ──→ ≥2 次? 查进化网络
PostToolUse(*) ──→ 写 journal + 检测错误信号 + gene feedback
PostToolUseFailure ──→ 提取失败信号 + gene feedback
     ▼ (session 结束)
Stop ──→ 有进化价值? ──→ block + 输出 review 指令 (Claude LLM 做抽象)
SessionEnd ──→ async push gene feedback + 信号 (Stop 的 fallback)

4.3 Hook 间通信文件

文件写入者读取者用途
session-journal.mdpost-bash-journal, post-tool-failurepre-bash-suggest, session-stop, session-endSession 操作记录
pending-suggestion.jsonpre-bash-suggestpost-bash-journal, post-tool-failure跟踪 gene 建议 → 反馈
sync-cursor.jsonsession-start, session-endsession-start进化网络同步游标
last-block-{scope}.jsonsession-stopsession-stopPer-scope 冷却 (1h)
injected-genes.jsonsession-startsession-end跟踪注入的 gene
sync-retry-queue.jsonsession-endsession-start失败重试队列
prismer-debug.log所有 hook (via logger)开发者调试日志

5. 修改指南

5.1 新增 Signal 模式

编辑 scripts/lib/signals.mjs,在 SIGNAL_PATTERNS 数组中添加:

javascript
{ type: 'error:your_new_signal', pattern: /your regex here/i },

测试:

bash
echo '{"tool_name":"Bash","tool_result":{"stdout":"your error output"}}' | \
  node scripts/test-hook.mjs post-bash-journal.mjs
# 检查 journal 是否记录了新 signal
cat .dev-cache/session-journal.md

5.2 新增 Hook

  1. scripts/ 下创建 your-hook.mjs
  2. hooks/hooks.json 中添加定义
  3. 退出 dev mode 重新运行 ./scripts/dev.sh

Hook 模板:

javascript
#!/usr/bin/env node
import { readFileSync } from 'fs';
import { createLogger } from './lib/logger.mjs';

const log = createLogger('your-hook');

let input = {};
try { input = JSON.parse(readFileSync(0, 'utf8')); } catch {}

log.info('start', { event: input.type });

// 你的逻辑...

// 输出到 Claude 上下文(可选)
process.stdout.write('Your context injection here');

5.3 新增 Skill

  1. 创建 skills/your-skill/SKILL.md
  2. /clear 加载

Skill 是给 Claude 看的文档,告诉它何时、如何调用工具。不是可执行代码。


6. 测试

bash
# 运行全部测试
cd sdk/prismer-cloud/claude-code-plugin
npm test

# Watch mode
npm run test:watch

# 测试单个 hook (隔离)
node scripts/test-hook.mjs session-start.mjs

7. 发布

bash
# 1. 更新版本
# package.json 的 version
# CHANGELOG.md 加条目

# 2. 构建验证
npm test

# 3. 发布到 npm
npm publish

# 4. 用户安装
# /plugin install prismer@prismer-cloud    (hooks + skills only)
# claude mcp add prismer -- npx -y @prismer/mcp-server@X.Y.Z  (可选 MCP)

注意: .mcp.json 不随 npm 包分发。MCP 是可选增强,通过 setup skill 引导安装。


8. MCP 与 Hooks 的关系

维度HooksMCP
触发方式Claude Code 自动触发(事件驱动)Claude 主动调用(tool call)
安装方式随插件自动安装单独 claude mcp add
依赖关系独立工作,不需要 MCP不需要 hooks
数据流方向Hook → stdout → Claude(被动注入)Claude → MCP tool → API(主动操作)
失败影响静默降级,不影响 session工具调用失败,Claude 可重试

开发建议: 优先用 hook 实现(自动、零成本)。MCP tool 仅在需要 Claude 主动操作时使用(创建 gene、写 memory、搜索 skill)。

Frequently asked questions

What does the Plugin Dev AI skill do?

Prismer Evolution Plugin 开发指南 — 快速迭代 hook/skill、调试、日志查看、测试、发布全流程

Why use Plugin Dev on TypingMind?

Because you install it once and use it with any model. Plugin Dev is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Plugin Dev in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Prismer-AI/PrismerCloud/tree/main/sdk/prismer-cloud/claude-code-plugin/skills/plugin-dev. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Plugin Dev?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Plugin Dev?

As many as you like. As long as a model supports skills, you can use Plugin Dev with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Plugin Dev AI skill free?

Yes. It is published on GitHub by Prismer-AI under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇