Logo van Miochat Plugin Builder

Miochat Plugin Builder

Community
Pretend-to
miochat-plugin-builder

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

Overzicht

UitgeverPretend-to
Repositorymio-chat-backend
Skillnaammiochat-plugin-builder
Sterren
38
Forks
3
Meegeleverde bestanden
1
LicentieMIT
Links
  • Instructies in Markdown

    Een SKILL.md-bestand dat het model laadt wanneer nodig, zodat het alleen tokens kost als een verzoek er daadwerkelijk bij past.

  • Werkt met elk LLM

    AI-skills zijn gewone Markdown, geen aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • 1 meegeleverde bestanden

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. Bestanden zijn alleen-lezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door Pretend-to op GitHub. Lees de broninhoud voordat je de skill installeert.

Installatie

Installeer de AI-skill Miochat Plugin Builder in TypingMind om deze met elke LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map — het leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/Pretend-to/mio-chat-backend/tree/master/lib/chat/llm/skills/miochat-plugin-builder
  4. Schakel de skill in elke chat in waarin je deze beschikbaar wilt hebben.
Plug-ins → Skills → Nieuwe skill → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

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
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Miochat Plugin Builder in een willekeurige chat in TypingMind in en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek erbij past, laadt het model zelf de volledige instructies — je hoeft de skill nooit handmatig aan te roepen en deze kost pas tokens wanneer je de skill daadwerkelijk gebruikt.

Het model laadt Miochat Plugin Builder automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Miochat Plugin Builder niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

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.

Meegeleverde bestanden

Het model leest deze bestanden wanneer nodig terwijl de skill geladen is. Ze worden beschikbaar gesteld als leesbare bestanden en worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Miochat Plugin Builder?

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

Waarom Miochat Plugin Builder gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Miochat Plugin Builder bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model, en je kunt midden in een chat van model wisselen zonder dat de skill niet meer werkt. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Miochat Plugin Builder in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/Pretend-to/mio-chat-backend/tree/master/lib/chat/llm/skills/miochat-plugin-builder. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Miochat Plugin Builder gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Miochat Plugin Builder gebruiken?

Zoveel als je wilt. Zolang een model skills ondersteunt, kun je Miochat Plugin Builder ermee gebruiken: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama en meer. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Miochat Plugin Builder gratis?

Ja. Deze skill is door Pretend-to op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. Deze volgt het open Agent Skills-formaat: een bestand met de naam SKILL.md met een naam en beschrijving, plus eventuele scripts, sjablonen of referentiebestanden die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇