sample-plugin

Demonstrates language-agnostic plugin tools with a Python greeting generator and TypeScript calculator.

11.3k|1.3k|Updated Oct 15, 2025
One-click install
npx skills add https://github.com/MoonshotAI/kimi-cli --skill sample-plugin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sample-plugin
Source: https://github.com/MoonshotAI/kimi-cli/tree/main/examples/sample-plugin
Command: npx skills add https://github.com/MoonshotAI/kimi-cli --skill sample-plugin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires tsx, and includes scripts (resource) components.

What problem does it solve?

Developers building plugins for Kimi CLI need a working reference showing how to register tools written in different languages under the Skills + Tools model. This sample plugin provides a minimal, runnable example with one Python tool and one TypeScript tool.

Core Features & Use Cases

  • Python greeting tool (py_greet): Generates a greeting message in English, Chinese, or Japanese for a given name.
  • TypeScript calculator tool (ts_calc): Safely evaluates basic math expressions with a restricted character whitelist.
  • Use Case: A developer authoring a new Kimi CLI plugin can copy this structure—plugin.json manifest plus scripts/ directory—to learn how tool parameters, stdin JSON input, and multi-language commands are wired together.

Quick Start

Ask the agent to greet Alice in Chinese or to evaluate the expression 42 * 17 + 3 using the sample plugin tools.

Frequently Asked Questions about sample-plugin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Kimi CLI plugin with custom tools?

Define a plugin.json manifest listing each tool's name, description, command, and JSON Schema parameters, then place the executable scripts in a scripts/ directory. Tools receive parameters as JSON on stdin and print results to stdout.

Can Kimi CLI plugin tools be written in different languages?

Yes, plugin tools are language-agnostic because each tool declares its own command in plugin.json. This sample runs a Python script via python3 and a TypeScript script via npx tsx side by side.

How do plugin tools receive parameters from the agent?

Parameters are passed as a JSON object through stdin, which the script parses with json.loads in Python or JSON.parse in TypeScript. The tool prints its result to stdout and exits nonzero on errors.

Is the TypeScript calculator safe against malicious expressions?

The calculator validates input with a regex allowing only digits, whitespace, and basic arithmetic operators before evaluation. Expressions containing letters or other characters are rejected with an error and exit code 1.

What languages does the greeting tool support?

The py_greet tool supports English, Chinese, and Japanese through the lang parameter, which accepts en, zh, or ja. If the language is omitted or unrecognized, it falls back to English.