Miochat Plugin Builder logo

Miochat Plugin Builder

Community
Pretend-to
miochat-plugin-builder

Master Guide for building and managing MioChat plugins using terminal and file-editor tools.

Overview

PublisherPretend-to
Repositorymio-chat-backend
Skill namemiochat-plugin-builder
Stars
38
Forks
3
Bundled files
1
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.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Pretend-to on GitHub. Read the source before you install it.

Installation

Install the Miochat Plugin Builder 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.
    https://github.com/Pretend-to/mio-chat-backend/tree/master/lib/chat/llm/skills/miochat-plugin-builder
  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/Pretend-to/mio-chat-backend.git /tmp/mio-chat-backend
mkdir -p .claude/skills
cp -r /tmp/mio-chat-backend/lib/chat/llm/skills/miochat-plugin-builder .claude/skills/miochat-plugin-builder
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Miochat Plugin Builder 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 Miochat Plugin Builder 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 Miochat Plugin Builder 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.

MioChat Plugin Builder: Master Edition (V3 Hook Architecture)

You are a Master Architect of the MioChat ecosystem. You extend the system by managing plugins in the root /plugins/ (Standard Project-Level) or /plugins/custom/ (Agile Single-File) directories.

[!IMPORTANT] Directory Standards:

  • /plugins/<plugin-name>/: The ONLY place for new project-level plugins.
  • lib/plugins/: RESERVED for system core plugins. Do not add new plugins here.

🏗️ Project-Level Plugins (V3 Standard)

V3 plugins support logic-separation via hooks and automatic configuration via presets.

  • Location: /plugins/<plugin-name>/
  • Structure:
    text
    plugins/my-plugin/
    ├── package.json      # Metadata & Dependencies
    ├── index.js          # Plugin Entry Class
    ├── tools/            # MioFunction tools (Business Logic)
    ├── hooks/            # [Optional] BaseHook implementations (AOP Logic)
    └── presets/          # [Optional] Preset JSON files (Auto-Seeding)

1. index.js Implementation

The index.js should handle initialization and optional hook propagation.

javascript
import Plugin from '../../lib/plugin.js' 

export default class MyPlugin extends Plugin {
  constructor() {
    super({ importMetaUrl: import.meta.url })
  }

  async initialize() {
    await super.initialize() // MUST call super to load tools/hooks
    
    // Optional: Propagate private hooks to the global execution chain
    // this._propagateHooks() 
  }

  getInitialConfig() {
    return { apiKey: '', maxRequests: 100 }
  }
}

2. Developing Tools (tools/)

Tools represent actions and functions available to the LLM agent. Place files inheriting MioFunction in the tools/ directory.

Basic Tool Example
javascript
import { MioFunction } from '../../../lib/function.js'

export default class MyTool extends MioFunction {
  constructor() {
    super({
      name: 'my_tool',
      description: 'Tool description for LLM system prompt',
      parameters: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search keyword' }
        },
        required: ['query']
      }
    })
    this.func = this.execute.bind(this)
  }

  async execute(e) {
    const { query } = e.params
    return { success: true, result: `Searched for ${query}` }
  }
}
Dynamic Schema & Polymorphism (getDescription / getParameters)

MioFunction allows overriding getDescription(context) and getParameters(type, context) to dynamically tailor prompt instructions and parameters based on the execution context (e.g. Group Chat vs Single Chat vs specific External Channels):

javascript
export default class ContextAwareTool extends MioFunction {
  constructor() {
    super({
      name: 'smart_profile',
      description: 'Single chat default instructions',
      parameters: {
        type: 'object',
        properties: { prompt: { type: 'string' } },
        required: ['prompt']
      }
    })
    this.func = this.execute.bind(this)
  }

  // Dynamic description based on context (e.g., group chat vs single chat)
  getDescription(context = null) {
    if (context?.isGroup || context?.metaData?.memberId) {
      return 'Group chat instructions: manage role title and duties in the group...'
    }
    return this.description // Fallback to default
  }

  // Dynamic parameters schema based on context
  getParameters(type = null, context = null) {
    if (context?.isGroup || context?.metaData?.memberId) {
      return {
        type: 'object',
        properties: {
          title: { type: 'string', description: 'Group member title' },
          intro: { type: 'string', description: 'Group member duties' },
          prompt: { type: 'string', description: 'Personal prompt instructions' }
        },
        required: ['prompt']
      }
    }
    return this.parameters // 100% backwards compatible fallback
  }

  async execute(e) {
    const { prompt, title, intro } = e.params
    return { success: true, prompt, title, intro }
  }
}

3. Developing Hooks (hooks/)

Hooks allow you to intercept tool execution. Just place files inheriting BaseHook in the hooks/ directory.

javascript
import BaseHook from '../../../lib/hooks/BaseHook.js'
import { HOOK_POINTS } from '../../../lib/hooks/types.js'

export default class MyRateLimitHook extends BaseHook {
  constructor(options) {
    super({
      name: 'my-limiter',
      hookPoint: HOOK_POINTS.TOOL_BEFORE_EXECUTE,
      priority: 80,
      namespace: options.namespace // Injected automatically
    })
  }

  async execute(ctx) {
    const { user, config } = ctx
    if (user.usage > config.maxRequests) {
      ctx.error = 'Usage limit exceeded'
      return false // Block execution
    }
    return true
  }
}

[!TIP] Detailed Hook Points: For a full list of system-wide hook points (including TOOL_, LLM_, and PLUGIN_ lifecycle hooks) and advanced AOP design patterns, please refer to the core documentation: hooks.md.

4. Using Presets (presets/)

Any .json files in the presets/ folder are automatically synchronized to the system database upon plugin loading.

Preset JSON Structure:

json
{
  "name": "Expert Role",
  "category": "common",      // common | recommended | hidden
  "hidden": true,            // [IMPORTANT] Set to true to hide from UI preset list
  "opening": "Hello world",
  "history": [
    { "role": "system", "content": "System prompt goes here" }
  ],
  "tools": ["sh", "read"],
  "model": "gpt-4o",
  "provider": "plugin-name",
  "recommended": false,
  "avatar": "url"
}

Note: The system prompt should be the first element in the history array with role: \"system\".

You can output custom frontend UI components by setting extraRender in the tool result or calling this.setOuterRender(e, renders).

Placement Modes:

  • 'inner': Inside the collapsible tool box.
  • 'outer': Directly in the message flow.

🧪 Debugging & Validation (The Loop)

1. Find Hashed Tool Name

  • API: GET /api/plugins/:pluginName/tools
  • Header: X-Admin-Code: ******

2. Execute Debug Call

  • API: POST /api/plugins/:pluginName/tools/:toolName/debug
  • Body: {"parameters": { ... }}

💡 Expert Debugging Tips

  • Active Port: Usually 3080 for the production/live instance.
  • Hot Reload:
    • Saving tools/*.js: Automatic reload.
    • Saving hooks/*.js: Automatic reload via Plugin.initialize.
    • Saving index.js: Triggers plugin-level hot reload via middleware.js watcher.

🛠️ Master Workflow (V3 Loop)

  1. Plan: Define tools, hooks (for security/audit), and presets (for UX).
  2. Develop: Implement logic.
  3. Hot Reload: Save files. Observe logs: [PluginName] 已加载 N 个私有钩子.
  4. Identify: Call GET /.../tools to find names.
  5. Validate: Call POST /.../debug with test parameters.
  6. Refine: Fix code and repeat.

Note: Call Skill(skill_name: "miochat-plugin-builder") to refresh these instructions.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Miochat Plugin Builder AI skill do?

Master Guide for building and managing MioChat plugins using terminal and file-editor tools.

Why use Miochat Plugin Builder on TypingMind?

Because you install it once and use it with any model. Miochat Plugin Builder 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 Miochat Plugin Builder in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Pretend-to/mio-chat-backend/tree/master/lib/chat/llm/skills/miochat-plugin-builder. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Miochat Plugin Builder?

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 Miochat Plugin Builder?

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

Is the Miochat Plugin Builder AI skill free?

Yes. It is published on GitHub by Pretend-to 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 👇