Agent Skills › MoonshotAI/kimi-code

MoonshotAI/kimi-code

GitHub

用于在kimi-code仓库中生成changesets,涵盖包版本升级选择、内部包与CLI处理、变更级别判断及英文日志撰写。需先检查实际代码变更,遵循核心规则处理忽略包和CLI捆绑逻辑,确保版本号准确并生成规范的changeset文件。

7 skills 2,969

Install All Skills

npx skills add MoonshotAI/kimi-code --all -g -y
More Options

List skills in collection

npx skills add MoonshotAI/kimi-code --list

Skills in Collection (7)

用于在kimi-code仓库中生成changesets,涵盖包版本升级选择、内部包与CLI处理、变更级别判断及英文日志撰写。需先检查实际代码变更,遵循核心规则处理忽略包和CLI捆绑逻辑,确保版本号准确并生成规范的changeset文件。
需要为kimi-code仓库创建或更新changeset时 涉及@moonshot-ai/kimi-code或其他内部包的版本发布流程时
.agents/skills/gen-changesets/SKILL.md
npx skills add MoonshotAI/kimi-code --skill gen-changesets -g -y
SKILL.md
Frontmatter
{
    "name": "gen-changesets",
    "description": "Use when generating changesets in the kimi-code repository, including package bump selection, internal package and CLI bundle handling, bump levels, major confirmation, and English changelog wording."
}

Generate Changesets

kimi-code uses changesets to manage versions and changelogs. The current user-facing published package is:

  • @moonshot-ai/kimi-code: the CLI

All other @moonshot-ai/* packages are treated as internal packages, including @moonshot-ai/kimi-code-sdk, agent-core, kosong, kaos, kimi-code-oauth, kimi-telemetry, and migration-legacy.

@moonshot-ai/pi-tui is a special internal package: it is a private fork (private: true) that is never published, but it keeps its own changelog through changesets. It is an exception to Core Rule 4 — see the dedicated section below.

Core Rules

  1. Inspect the actual changes first. Use git status / git diff --name-only to identify which packages were actually changed.
  2. List packages that changesets can release. If a changed package is ignored in .changeset/config.json, do not put that ignored package in frontmatter together with a non-ignored package; changesets rejects mixed ignored/non-ignored frontmatter.
  3. Map ignored internal changes to the affected released package. If an ignored internal package changes CLI output or behavior, list @moonshot-ai/kimi-code and describe the actual user-visible or release-artifact change in the changelog text.
  4. Internal package source changes that enter the CLI bundle must manually list the CLI. @moonshot-ai/kimi-code inline-bundles @moonshot-ai/* source, but those internal packages are devDependencies from the CLI's perspective, so changesets will not automatically propagate bumps. If a change enters the CLI output, list @moonshot-ai/kimi-code.
    • Web app (@moonshot-ai/kimi-web) changes always enter the CLI bundle. @moonshot-ai/kimi-web is ignored by changesets (see .changeset/config.json) and cannot be mixed with @moonshot-ai/kimi-code in one changeset frontmatter. Describe the web change in the changelog text, but list @moonshot-ai/kimi-code so the CLI release carries the bundled dist-web output.
  5. Docs-only and tests-only changes usually do not need a changeset. README, internal docs, and test/ changes that do not enter package output do not trigger a CLI bump.
  6. @moonshot-ai/vis / vis-server / vis-web are ignored by changesets and should not be handled.

Workflow

  1. List the changed packages and check whether each one is ignored by .changeset/config.json.
  2. Choose a bump level for each package.
  3. If an ignored internal package change enters the CLI bundle, put @moonshot-ai/kimi-code in frontmatter instead of mixing the ignored package into the same changeset.
  4. Create a short kebab-case file under .changeset/.
  5. Split unrelated changes into separate changesets; keep one logical change in one file.

Format:

---
"<package A>": patch
"<package B>": minor
---

<English changelog entry>

Bump Levels

Level When to use
patch Bug fixes; build/package fixes; internal refactors that do not change behavior; wording tweaks; small dependency upgrades; small improvements to existing features with limited user-facing impact (e.g. a new keyboard shortcut, a flag alias, a minor UX tweak)
minor A substantial new user-facing feature, such as a new slash command, a new built-in tool, or a new mode
major Breaking changes: incompatible config changes, renamed or removed commands/arguments, behavior semantics changes, and similar

When in doubt between patch and minor: if the change improves an existing feature and the user-facing impact is small, choose patch even when the change is technically "new". Reserve minor for a substantial new capability that introduces something users could not do before.

Major Rule

Never write major on your own.

If you believe a change qualifies as major, stop first, explain why, and ask the user for confirmation. Only write major after the user explicitly agrees. If the user does not reply, replies ambiguously, or disagrees, fall back to minor; if minor is also unclear, fall back to patch.

Wording Rules

  • Changelog entries must be written in English.
  • Keep the whole entry concise. Aim for one short sentence that states what was done; at most a short sentence plus a one-line usage hint. Do not write a paragraph, do not pile on technical detail, and do not enumerate every sub-change.
  • For new user-facing features, append a brief usage hint so users know how to try it. Keep it to a single short line — a command name, a subcommand, a flag, or a one-line "how to use". Do not explain design rationale or list edge cases. Skip the hint for bug fixes, internal changes, and refactors.
    • Slash command: Add the /foo slash command to list active sessions. Run /foo to see them.
    • CLI subcommand: Add the kimi web subcommand to open the web UI. Run kimi web to launch it.
    • Flag: Add a --bar flag to skip confirmation prompts. Pass --bar to skip.
    • Too long: Add the /foo command to list active sessions. It accepts an optional --all flag to include background sessions, supports filtering by name with /foo <name>, and writes the result to the transcript...
  • User-facing CLI wording should only be used when CLI users can perceive the change.
  • Internal changes that do not affect CLI users can still share a changeset with the CLI, but the wording must describe the real change honestly and must not present it as a user-facing feature.
  • Do not mention file names, class names, function names, PR numbers, or commit hashes.
  • Do not include real internal endpoints, key names, account names, or service names. If an example is needed, use neutral placeholders such as example.com, example.test, or YOUR_API_KEY.
  • Avoid vague words such as refactor, optimize, and improve. Describe the actual change, or use more specific wording.

When You Are Unsure About a Change

Generate the changeset from what the diff clearly shows. If part of a change is unclear and you cannot confidently describe what it does for users, do not guess or pad the entry with vague wording.

  1. Finish the changeset for the parts that are clear.
  2. Then ask the user once, in a short list: name the specific change(s) you do not understand, and ask whether you may dig into the repository (read related source, tests, or call sites) to describe it more accurately.
  3. Only read more code after the user agrees. If the user says no or does not reply, keep the concise wording you already have and do not invent detail.

Common Examples

An internal package fixes a bug visible to CLI users:

---
"@moonshot-ai/kimi-code": patch
---

Fix occasional loss of tool call results in long conversations.

A new user-facing slash command (note the short usage hint):

---
"@moonshot-ai/kimi-code": minor
---

Add the /foo slash command to list active sessions. Run /foo to see them.

A new CLI subcommand:

---
"@moonshot-ai/kimi-code": minor
---

Add the kimi web subcommand to open the web UI. Run kimi web to launch it.

A new flag on an existing command:

---
"@moonshot-ai/kimi-code": patch
---

Add a --bar flag to skip confirmation prompts. Pass --bar to skip.

An internal package has an internal-only change, but it enters the CLI bundle:

---
"@moonshot-ai/kimi-code": patch
---

Unify tool execution metadata handling.

Only SDK source changed, and the CLI does not use it:

---
"@moonshot-ai/kimi-code-sdk": patch
---

Clarify session status typing for internal SDK callers.

Web app changes

@moonshot-ai/kimi-web is ignored by changesets and must never appear in a changeset frontmatter. Because the web app is bundled into the CLI release artifact, any web change that ships must list @moonshot-ai/kimi-code instead and describe the actual web-facing change in the text.

  • Prefix the changelog entry text with web: (for example web: Fix the chat not scrolling to the bottom after sending a message.) so the synced docs changelog can mark web UI entries. Apply this whenever the change is to the web project (@moonshot-ai/kimi-web).
  • If a PR contains both web UI changes and server API changes, split them into separate changesets so each entry has a focused description.
  • Do not enumerate every micro-tweak; keep it to one sentence that captures what the web user gets.

Web-only fix:

---
"@moonshot-ai/kimi-code": patch
---

web: Fix the chat not scrolling to the bottom after sending a message.

Web UI plus server APIs in the same PR (split into two changesets):

---
"@moonshot-ai/kimi-code": minor
---

web: Add the server-hosted web UI, including chat layout and session list behaviors.
---
"@moonshot-ai/kimi-code": minor
---

Add the server REST and WebSocket APIs that power the web UI.

@moonshot-ai/pi-tui changes

@moonshot-ai/pi-tui is a vendored fork that lives in packages/pi-tui. It is private: true and is never published, but it is not ignored by changesets: changesets versions it and writes packages/pi-tui/CHANGELOG.md so the fork keeps its own history. Because it is bundled into the CLI like other internal packages, it is an exception to Core Rule 4 — do not list @moonshot-ai/kimi-code for a change that only touches pi-tui.

  • Changes that only affect pi-tui (build, package, strict-mode cleanup, renderer fixes): list @moonshot-ai/pi-tui only. No CLI changeset.
  • If the same change is also user-visible in the CLI (for example a terminal rendering fix that CLI users can see), add a separate changeset that lists @moonshot-ai/kimi-code with CLI-focused wording, in addition to the pi-tui changeset. Do not mix both packages in one frontmatter — the two changelogs need different wording.

pi-tui-only change:

---
"@moonshot-ai/pi-tui": patch
---

Export the package manifest so the bundled binary can locate its native assets.

pi-tui change that is also visible in the CLI (two separate changesets):

---
"@moonshot-ai/pi-tui": patch
---

Clamp the differential render to the visible viewport so scrolling up during streaming no longer jumps to the top.
---
"@moonshot-ai/kimi-code": patch
---

Fix the transcript jumping to the top when scrolling up through history during streaming output.

Red Flags

  • You are about to write major without asking the user.
  • A new user-facing feature entry has no usage hint, or the hint runs to multiple lines and explains design rationale.
  • You guessed wording for a change you do not understand instead of asking the user whether you may dig into the repo.
  • Internal package source enters the CLI bundle, but @moonshot-ai/kimi-code is missing.
  • A changeset frontmatter mixes ignored internal packages with non-ignored packages.
  • packages/node-sdk was not changed, but @moonshot-ai/kimi-code-sdk was listed for "internal package sync".
  • The changelog entry is in Chinese.
  • The wording claims more than the diff actually did.
  • The CLI wording mentions internal package names, class names, or PR numbers.
  • The entry includes real internal identifiers instead of neutral placeholders.
  • A change that only touches @moonshot-ai/pi-tui lists @moonshot-ai/kimi-code instead of @moonshot-ai/pi-tui, or mixes both packages in one frontmatter.
  • A web app change entry is missing the web: prefix.
用于在代码变更影响产品行为或用户体验时,同步更新双语用户文档。需检查变更影响、同步英文变更日志,并依据规范编辑文档及调用翻译技能保持中英镜像一致。
代码变更涉及用户可见的行为修改 需要更新CLI使用指南或配置说明 发布前需维护双语文档一致性
.agents/skills/gen-docs/SKILL.md
npx skills add MoonshotAI/kimi-code --skill gen-docs -g -y
SKILL.md
Frontmatter
{
    "name": "gen-docs",
    "description": "Update Kimi Code CLI user documentation after meaningful code changes that affect product behavior or user experience."
}

Gen Docs

Overview

This repository maintains bilingual user documentation under docs/. docs/en/ and docs/zh/ are mirrored pairs for most pages; update both in the same change. Changelog is the exception — English is the source, and Chinese is translated from English.

Use this skill to update the corresponding documentation whenever the codebase has changes that affect product behavior or user experience.

For a full pre-release audit of all pages (detecting hallucinations and coverage gaps), use the audit-docs skill instead.

Prerequisites

This skill depends on the following being in place. If any are missing, stop and report to the user before continuing:

  • docs/ directory with docs/zh/, docs/en/, and docs/.vitepress/config.ts set up (VitePress site).
  • docs/AGENTS.md style guide — defines source-of-truth rules, terminology table, typography, and writing style.
  • docs/scripts/sync-changelog.mjs — auto-syncs root CHANGELOG.md to docs/en/release-notes/changelog.md.
  • translate-docs skill in .agents/skills/ — handles bilingual synchronization.

Workflow

  1. Inspect changes

    • git log main..HEAD --oneline — commits on the current branch
    • git diff main..HEAD --stat — file-level scope
    • ls .changeset/*.md (excluding README.md) — pending changeset entries
    • Read CHANGELOG.md and any subpackage packages/*/CHANGELOG.md for already-recorded entries.
  2. Understand user-facing impact

    For each change, read the actual implementation when needed; do not infer behavior from commit messages or PR titles alone. Skip:

    • Internal refactors with no externally visible behavior change
    • Tests, CI, type-only changes
    • Tooling / build-system changes that do not change how users invoke the CLI

    If after the scan you conclude there is no user-facing impact, say so and stop.

  3. Sync English changelog

    Run:

    node docs/scripts/sync-changelog.mjs
    

    This updates docs/en/release-notes/changelog.md from the root CHANGELOG.md. Never edit the docs changelog by hand.

  4. Update user docs

    Following the rules in docs/AGENTS.md, edit the affected pages in whichever locale you are working in, then sync the mirror. Match terminology with the term table in docs/AGENTS.md and the existing wording in surrounding pages.

    Cover all relevant sections:

    • Guides (getting-started, use cases, interaction, sessions, IDE integration)
    • Customization (skills, agents, MCP, hooks, plugins, etc.)
    • Configuration (config files, env vars, providers, data locations)
    • Reference (CLI subcommands, slash commands, keyboard shortcuts)
    • Release notes (docs/zh/release-notes/breaking-changes.md if a breaking change is involved)
  5. Sync bilingual content

    Invoke the translate-docs skill. It will:

    • Sync updated non-changelog pages between docs/en/ and docs/zh/
    • Translate the English changelog → Chinese under docs/zh/release-notes/changelog.md

Rules and conventions

  • Locale sync: Non-changelog pages stay mirrored between docs/en/ and docs/zh/. Changelog flows English → Chinese.
  • Terminology: Use the term table in docs/AGENTS.md exactly. Do not invent new translations or use synonyms.
  • Scope discipline: Only update sections affected by the recent changes. Do not opportunistically rewrite unrelated docs.
  • Public examples: Never write real internal endpoints, key names, account names, or service names into docs. Use neutral placeholders such as https://api.example.com/v1, https://registry.example.com/v1/models/api.json, example.test, and YOUR_API_KEY.
  • Breaking changes: If any change is breaking, also update docs/en/release-notes/breaking-changes.md (under ## Unreleased) with **Affected** + **Migration** subsections, and mirror it in docs/zh/release-notes/breaking-changes.md.
  • Do not edit auto-synced files: docs/en/release-notes/changelog.md is regenerated by the sync script; any manual edit will be overwritten.

Common mistakes

  • Describing what code changed instead of what the user can now do (or can no longer do).
  • Adding a new section heading per feature instead of weaving the change into existing prose.
  • Updating only one locale and leaving its mirror stale.
  • Editing only the mirror to fix wording that should be corrected in the locale you changed first.
  • Inventing new terminology that drifts from the docs/AGENTS.md term table.
  • Using real internal values in examples instead of neutral example placeholders.
在合并kimi-code发布PR前,预览面向用户的中文CLI更新日志。通过读取PR diff中的预生成changelog,复用strip/classify/translate逻辑渲染中文预览,仅输出结果不写文件。
用户需要在合并发布PR前查看中文更新日志预览 处理包含kimi-code CLI变更的release PR
.agents/skills/pre-changelog/SKILL.md
npx skills add MoonshotAI/kimi-code --skill pre-changelog -g -y
SKILL.md
Frontmatter
{
    "name": "pre-changelog",
    "description": "Use before merging a kimi-code release PR to preview the user-facing CLI changelog in Chinese. Reads the changelog that changesets pre-generated in the release PR, then reuses sync-changelog's strip \/ classify \/ translate logic to render a Chinese preview. Writes no files."
}

Pre-Changelog

Preview the user-facing Chinese changelog of an open kimi-code release PR before it is merged. Read-only: this skill writes no files and commits nothing.

This skill reuses sync-changelog's strip / classify / translate rules. Read sync-changelog first; only the data source (release PR diff instead of a published CHANGELOG.md) and the output (preview instead of docs files) differ.

Workflow

1. Locate the release PR

gh pr list --state open --search "ci: release packages in:title" \
  --json number,title,url,headRefName,baseRefName

Pick the one with headRefName: changeset-release/main; record number, url as <RELEASE>. If none is open, nothing to preview — stop.

2. Read the pre-generated CLI changelog block

changesets already pre-generates apps/kimi-code/CHANGELOG.md inside the release PR. Extract the new version block from the diff:

gh api repos/MoonshotAI/kimi-code/pulls/<RELEASE>/files \
  --jq '.[] | select(.filename=="apps/kimi-code/CHANGELOG.md") | .patch'

Take the added lines (+) from the top ## <version> down to (but not including) the next ## . That is the version block to preview.

If the CLI changelog is not in the diff (for example an SDK-only release), stop and tell the user — there is no user-facing CLI changelog to preview.

3. Render the Chinese preview (reuse sync-changelog)

Process the version block exactly as sync-changelog does for the docs site, but only in memory:

  • Strip (sync-changelog step 3): drop the H1, the ### Patch Changes / ### Minor Changes / ### Major Changes subheadings, PR links, and commit-hash links; keep only each entry's body text.
  • Classify (sync-changelog step 4): bucket into Features / Bug Fixes / Polish / Refactors / Other; order within each section by reader value.
  • Translate (sync-changelog step 6): translate entry bodies to Chinese; section headings become 新功能 / 修复 / 优化 / 重构 / 其他.

If an upstream entry is not in English, flag it and stop (changeset entries must be English).

4. Output

Print the preview directly. Use <version>(预览) as the heading because the version is not released yet. Write for empty sections. Do not write any file.

发版 PR: <url>

## <version>(预览)

### 新功能
- ...

### 修复
- ...

Rules

  • Read-only. Never write CHANGELOG.md, docs files, or commit anything.
  • Classification, ordering, and translation follow sync-changelog exactly — do not reword or reclassify beyond what it specifies.
  • If the release PR has no CLI changelog diff, report it and stop.
在发布成功后,将CLI包的CHANGELOG同步至中英文文档站点,翻译增量内容并在专用分支提交PR。
npm发布成功且Release PR已合并 需要更新docs站点的中英文changelog
.agents/skills/sync-changelog/SKILL.md
npx skills add MoonshotAI/kimi-code --skill sync-changelog -g -y
SKILL.md
Frontmatter
{
    "name": "sync-changelog",
    "description": "Use after a release succeeds, when maintainers need to sync apps\/kimi-code\/CHANGELOG.md into docs\/en\/release-notes\/changelog.md and docs\/zh\/release-notes\/changelog.md, then open a PR on a dedicated branch."
}

Sync Changelog

Overview

kimi-code uses changesets for versioning. Each package gets its own CHANGELOG.md. The user-facing CLI package, @moonshot-ai/kimi-code, writes its changelog here:

apps/kimi-code/CHANGELOG.md

This file is the only upstream source for the documentation-site changelog. Internal package changelogs such as packages/*/CHANGELOG.md do not go into the documentation site.

After the release flow finishes (Release PR merged → Version Packages completed → npm publish succeeded), maintainers manually run this skill to copy the new CLI changelog entries into the docs site, translate the English increment into Chinese, wait for an optional human review, then commit on a dedicated branch and open a PR.

When To Use

  • A new version has been published to npm.
  • The top of apps/kimi-code/CHANGELOG.md contains version blocks that are not yet in docs/en/release-notes/changelog.md.
  • The gen-docs flow does not run this automatically; maintainers must explicitly do it after release.

Do not run this before the Release PR is merged. At that point, changesets has not yet written the new version into apps/kimi-code/CHANGELOG.md.

Source And Targets

File Role Edited by
apps/kimi-code/CHANGELOG.md Only upstream source, generated by changesets Never edit manually
docs/en/release-notes/changelog.md English docs changelog; source of truth for docs This skill
docs/zh/release-notes/changelog.md Chinese docs changelog, translated from English This skill, following translate-docs

Core rule: the English docs changelog is the source of truth, and Chinese is translated from English. This matches translate-docs.

Preconditions

Before editing, confirm:

  • The released version exists on npm (npm view @moonshot-ai/kimi-code versions --json) or has a matching GitHub Release tag.
  • The top of apps/kimi-code/CHANGELOG.md is that new version.

If any condition is not true, stop and confirm with the user.

Do not edit or commit directly on main. All sync work happens on a dedicated branch created in step 1.

Workflow

1. Prepare Branch

Start from an up-to-date default branch:

git fetch origin
git checkout main
git pull --ff-only origin main

Before creating the branch, peek at the version range so the branch name matches the newest version being synced:

rg '^## ' apps/kimi-code/CHANGELOG.md | head -5
rg '^## ' docs/en/release-notes/changelog.md | head -5

Name the branch after the newest upstream version that is not yet in the English docs page:

docs/changelog-sync-<newest-version>

Example: syncing 0.2.1 only → docs/changelog-sync-0.2.1.

git checkout -b docs/changelog-sync-<newest-version>

If the branch already exists locally or on the remote, stop and confirm with the user instead of reusing it.

2. Find The Version Range

Use the same version lists from step 1. Confirm:

  • First sync: copy all upstream version blocks into the English page.
  • Incremental sync: copy every upstream version block above the latest version already present in the English page.

Use upstream order: newest version first.

3. Strip Decorations And Extract Entry Text

Upstream entries look like this:

- [#317](https://github.com/...) [`2f51db4`](https://github.com/...) - Clean up lint warnings ...

Keep:

  • Version headings such as ## 0.2.0.
  • Only the body text of each entry, after the PR/hash decoration.

Remove:

  • The upstream H1 # @moonshot-ai/kimi-code because the docs page already has # Changelog.
  • Changesets subheadings such as ### Patch Changes, ### Minor Changes, and ### Major Changes.
  • PR links such as [#317](...).
  • Commit hash links such as [`2f51db4`](...).

After stripping, each entry should be only:

- <body text>

Web UI prefix: if the entry is a web UI change, prefix the body text with web: so readers can tell it affects the web UI:

- web: <body text>

An entry counts as a web UI change when its upstream commit touches apps/kimi-web/. Check with git show --name-only <hash> (the commit hash is the one stripped above). gen-changesets writes this prefix for web changes, so it is usually already present in upstream — preserve it when it is there, and add it when a web entry lacks it. When a commit touches both web and non-web code, use web: only if the user-facing change described by the entry is in the web UI. Keep the web: prefix on the Chinese page too — it is a scope marker, not translated text.

Upstream language rule: gen-changesets requires changelog entries to be English. If the upstream CLI changelog contains a non-English entry, stop and report it to the user. Do not silently rewrite it while syncing docs.

Public-text rule: do not copy real internal endpoints, key names, account names, or service names into docs changelogs. Replace examples with neutral placeholders such as example.com, example.test, or YOUR_API_KEY while preserving the user-visible meaning.

4. Classify Entries

The docs changelog uses five section types:

English section Chinese section Meaning
### Features ### 新功能 New user-facing functionality, such as a new command, flag, mode, or capability that did not exist before
### Bug Fixes ### 修复 Fixes for behavior that was broken
### Polish ### 优化 User-visible improvements to existing functionality, including UX adjustments, behavior tweaks, and performance improvements that are not fixes or new capabilities
### Refactors ### 重构 Internal changes with no user-visible behavior change, including build, CI, tests, dependency cleanup, and internal renames
### Other ### 其他 Anything that does not fit above, such as CDN/endpoint swaps and docs-related artifacts

Classification process:

  1. Classify from the stripped entry text first.
  2. If unclear, inspect the related commit or PR:
    • Use the stripped commit hash with git show <hash>.
    • Or use the PR number with gh pr view <NNN>.
  3. If it is still unclear, put it in Other. Do not guess or force entries into Features.

Features vs. Polish: ask whether the entry introduces something the user could not do before. If yes (new command, flag, mode, viewer, or capability), use Features. If it only improves an existing surface (a UI panel that already existed, an existing prompt, an existing tool card, an existing payload pipeline), use Polish. Verbs like Add do not automatically mean Features — a small visual addition to an existing UI is still polish.

Keyword hints:

  • Features: Add ... command/flag/option/mode/viewer, Introduce, Support, Allow, Enable, Implement, New ... command/flag/option
  • Bug Fixes: Fix, Resolve, Correct, Address, Prevent ... from, Stop ... from, ... no longer ...
  • Polish: Polish, Optimize, Improve, Enhance, Speed up, Reduce, Cap, Shorten, Wrap, Clarify, Tweak, Adjust, Offload, Show ... in existing surface, performance and UX adjustments to existing features
  • Refactors: Refactor, Rename, Clean up, Simplify, Remove unused, Migrate to, Unify, Restructure, Internal, dependency bumps, pure CI/build/test changes
  • Other: docs artifacts, CDN/endpoint switches, anything that genuinely fits no other section

Within each version, section order is:

Features → Bug Fixes → Polish → Refactors → Other

Omit empty sections. Within each section, order entries by reader value, not upstream order:

  1. Put the most valuable, obvious, and larger changes first.
  2. Prefer broad user-visible features, workflow-changing fixes, high-frequency bugs, and large cross-cutting improvements over small polish, narrow edge cases, and internal cleanup.
  3. If entries have similar value, preserve upstream order.

Do not reword or exaggerate entries just to make them look more important; only reorder existing entries.

5. Write The English Page

Never change the English page header:

# Changelog

This page documents the changes in each Kimi Code CLI release.

Insert new version blocks immediately after the header paragraph and before the previous latest version.

Every version heading must carry its release date in parentheses:

## <version> (YYYY-MM-DD)

Take the date from the version's published GitHub Release tag, not from when you run the sync:

git log -1 --format=%cs "@moonshot-ai/kimi-code@<version>"

Use the half-width parenthesis form (YYYY-MM-DD) on the English page. Never invent or guess a date; if the tag is missing, stop and confirm with the user.

Example:

## 0.2.0 (2026-05-26)

### Bug Fixes

- Fix the TUI not restoring the current todo list after resuming a session.

### Refactors

- Clean up lint warnings across the CLI, SDK examples, and bundled runtime code without changing product behavior.
- Update the native release workflow to use current GitHub artifact actions.

6. Translate The Increment Into Chinese

After updating the English page, translate only the newly added English content into docs/zh/release-notes/changelog.md.

Follow translate-docs, direction en → zh. Changelog direction is English-to-Chinese even though many other docs flows use Chinese-to-English.

Chinese page requirements:

  • Header:

    # 变更记录
    
    本页记录 Kimi Code CLI 每个版本的变更内容。
    
  • Preserve version headings including the release date, but use full-width parentheses on the Chinese page, such as ## 0.2.0(2026-05-26). The date must match the English page; only the parenthesis style differs (half-width () in English, full-width () in Chinese).

  • Translate section headings exactly:

    • ### Features### 新功能
    • ### Bug Fixes### 修复
    • ### Polish### 优化
    • ### Refactors### 重构
    • ### Other### 其他
  • The Chinese page must mirror the English page 1:1 for versions, sections, section order, entry order, and entry counts.

  • Keep the classification and entry order from the English page. Do not reclassify or reorder while translating.

  • Translate only entry body text. Do not add entries that are not present in English.

  • Follow docs/AGENTS.md for Chinese typography: full-width punctuation, spaces between Chinese and English, and the glossary.

Chinese wording style

Structural fidelity does not mean literal translation. The Chinese entries should read like a concise, idiomatic Chinese changelog. Keep the same facts as the English entry, but rephrase for natural Chinese prose.

Guidelines:

  • One entry, one sentence. Avoid chaining multiple effects with commas or semicolons. If the English entry is long, split it into shorter sentences or keep only the most important effect.
  • Prefer common changelog verbs: 新增、支持、修复、优化、改进、调整.
  • Avoid indirect "through... make..." structures. Do not write "通过 X,使 Y"; prefer direct cause-effect or just state the result.
    • Bad: 通过缓存已渲染消息行,使终端在长篇对话中保持响应。
    • Better: 缓存已渲染消息行,提升长对话下终端的响应速度。
  • Be specific, not vague. Prefer concrete actions over abstract quality words.
    • Bad: 加固默认系统提示词和内置工具描述。
    • Better: 优化默认系统提示词与内置工具描述,避免 Agent 阻塞后台任务。
  • Name concrete files or config keys when it helps clarity.
    • Bad: 插件现在可以在其清单中声明 hooks。
    • Better: 插件现支持在 kimi.plugin.json 中声明生命周期 hooks。
  • Include required argument placeholders in CLI options.
    • Bad: --allowed-host
    • Better: --allowed-host <host>
  • Keep usage hints to one short clause.
    • Bad: 传入 --allowed-host 以允许额外的 host。例如 ... (多句展开)
    • Better: 例如 kimi web --allowed-host example.com。
  • Do not translate technical identifiers: keep command names, flag names, file names, env vars, config keys, and the web: scope prefix as-is.

Example — translating a feature entry:

English source:

- Add a --allowed-host flag to kimi web that lets extra Host header values pass the DNS-rebinding check, and include allow guidance in the 403 error message. Pass --allowed-host <host> to allow an extra host.

Before (literal, wordy):

- 为 `kimi web` 新增 `--allowed-host` 标志,允许额外的 Host 请求头值通过 DNS 重绑定检查,并在 403 错误消息中包含允许指引。传入 `--allowed-host <host>` 以允许额外的 host。例如 `kimi web --allowed-host example.com`。

After (concise, idiomatic):

- `kimi web` 新增 `--allowed-host <host>` 选项,可将指定 Host 加入 DNS 重绑定白名单;403 错误会提示如何通过 `--allowed-host` 或 `KIMI_CODE_ALLOWED_HOSTS` 放行,例如 `kimi web --allowed-host example.com`。

7. Verify

Review:

git diff docs/en/release-notes/changelog.md docs/zh/release-notes/changelog.md

Check:

  • Versions and version counts match between English and Chinese.
  • Every version heading carries its release date from the published tag, with half-width parentheses in English and full-width in Chinese.
  • Each version has the same section set and order on both pages.
  • Each section has the same number of entries on both pages.
  • Within each section, the most valuable, obvious, and larger entries appear before smaller or narrower entries.
  • PR links and commit hashes were stripped.
  • Real internal identifiers were replaced with neutral placeholders.
  • There are no empty sections.
  • Markdown indentation and blank lines are intact.

Then run the docs build:

pnpm --filter docs run build

8. Human Review Checkpoint

After verification passes, before committing, ask the user whether they want to review the sync result. Use AskQuestion with options such as:

  • Review first — show the diff and wait for the user to finish checking.
  • Skip review, commit and open PR — proceed directly to steps 9 and 10.

If the user chooses review:

  1. Show the uncommitted diff:

    git diff docs/en/release-notes/changelog.md docs/zh/release-notes/changelog.md
    
  2. Summarize synced versions, section counts, and anything that needed manual classification.

  3. Tell the user to reply when they are done reviewing, or to ask for edits.

  4. Do not commit, push, or open a PR until the user explicitly says review is complete, or asks to proceed.

If the user requests edits during review, make the changes, re-run verification from step 7, and return to this checkpoint.

9. Commit

Only run this step when the user skipped review or confirmed review is complete.

Stage only the changelog docs files:

git add docs/en/release-notes/changelog.md docs/zh/release-notes/changelog.md

Use a neutral docs-sync commit message:

docs(changelog): sync <version range> from apps/kimi-code/CHANGELOG.md

Do not create a changeset for changelog docs sync. Docs sync does not enter the bundle.

10. Push And Open PR

Run immediately after step 9.

Push the branch:

git push -u origin HEAD

Create the PR with gh pr create. Title follows Conventional Commits:

docs(changelog): sync <version range> from apps/kimi-code/CHANGELOG.md

Fill in .github/pull_request_template.md. For changelog sync PRs:

  • Related Issue: write N/A — post-release docs maintenance (no issue required).
  • Problem: the docs-site changelog is behind the published CLI release(s).
  • What changed: list synced version(s), note English source + Chinese translation, and mention verification (pnpm --filter docs run build).
  • Checklist: check CONTRIBUTING; explain no issue, no tests, no changeset, and that gen-docs is not needed because this is the dedicated changelog sync flow.

Example body:

## Related Issue

N/A — post-release docs maintenance

## Problem

The docs-site changelog has not yet been synced for `<version range>` after the npm release.

## What changed

- Synced `<version range>` from `apps/kimi-code/CHANGELOG.md` into `docs/en/release-notes/changelog.md`
- Translated the new English increment into `docs/zh/release-notes/changelog.md`
- Verified with `pnpm --filter docs run build`

## Checklist

- [x] I have read the CONTRIBUTING document.
- [x] I have linked a related issue, or explained the problem above.
- [ ] I have added tests that prove my feature works. (N/A — docs-only sync)
- [x] Ran `gen-changesets` skill, or this PR needs no changeset. (No changeset — docs sync is out of bundle)
- [x] Ran `gen-docs` skill, or this PR needs no doc update. (This PR is the dedicated changelog sync)

Return the PR URL to the user when done.

Rules

  • The English docs changelog is the source of truth.
  • Never edit upstream apps/kimi-code/CHANGELOG.md.
  • Do not backfill unreleased .changeset/*.md drafts into the docs site.
  • Prefix web UI entries with web: (when the upstream commit touches apps/kimi-web/), and keep the prefix on both the English and Chinese pages.
  • If upstream wording is wrong, leave upstream alone and fix it in a future changeset.
  • Always sync on a docs/changelog-sync-* branch and open a PR; never push changelog docs sync directly to main.
  • Wait for the human review checkpoint before committing, pushing, or opening a PR.

Common Mistakes

Mistake Fix
Adding entries directly to the English docs page without reading upstream Use apps/kimi-code/CHANGELOG.md as the source
Copying PR links or commit hashes into docs Strip them; keep only body text
Rewording upstream English entries Upstream is frozen; copy the body text unless the user explicitly asks otherwise
Leaving English text untranslated in the Chinese page The Chinese page must be fully Chinese except preserved technical terms
Editing upstream changelog text Do not edit upstream
Losing two-space indentation in multi-line list items Restore indentation so Markdown lists stay valid
Copying ### Patch Changes into docs Remove changesets headings and classify under Features / Bug Fixes / Polish / Refactors / Other
Guessing unclear entries as Features Inspect commit/PR; if still unclear, use Other
Treating any Add ... line as Features If the entry only adds a small element to an existing UI/surface, use Polish
Filing UX or performance tweaks under Other Use Polish for user-visible improvements to existing functionality
Preserving upstream order when a small entry hides a larger change Reorder within the section so the highest-value, most obvious items appear first
Reclassifying entries while translating Chinese classification must mirror English
Leaving empty sections Delete sections with no entries
Putting everything under Other for convenience Classify what can be classified first
Translating tool names, command names, or config keys Keep them as written
Creating a changeset for docs sync Do not create one
Committing or pushing directly on main Create docs/changelog-sync-<version>, commit there, then open a PR
Committing or opening a PR before the user skips review or confirms review is done Wait at the human review checkpoint
Using curly quotes or half-width Chinese punctuation Follow docs/AGENTS.md
Omitting the release date from a version heading, or guessing it Add (YYYY-MM-DD) (full-width () in Chinese) taken from the published tag
Forgetting or translating the web: prefix on web UI entries Prefix web UI entries (commit touches apps/kimi-web/) with web: on both pages; keep the prefix as-is when translating

Stop Signals

  • The top version in apps/kimi-code/CHANGELOG.md is not published on npm or GitHub Releases.
  • You are about to edit apps/kimi-code/CHANGELOG.md.
  • You are about to add docs sync to a changeset.
  • English and Chinese versions, entry counts, or section sets do not match.
  • A section is empty.
  • A Chinese term is uncertain and docs/AGENTS.md does not answer it.
  • A docs/changelog-sync-* branch already exists for the same version and you cannot confirm whether it is stale.
  • The user asked to review but has not yet confirmed review is complete.
同步docs/zh与docs/en双语文档,依据AGENTS.md规则翻译并校对。检测变更,保持结构一致,应用术语和排版规范,确保内容准确且风格统一。
用户请求同步中英文文档 执行gen-docs增量更新任务 执行audit-docs发布前审计任务
.agents/skills/translate-docs/SKILL.md
npx skills add MoonshotAI/kimi-code --skill translate-docs -g -y
SKILL.md
Frontmatter
{
    "name": "translate-docs",
    "description": "Translate and sync bilingual user documentation between docs\/zh\/ and docs\/en\/ following the source-of-truth rules in docs\/AGENTS.md."
}

Translate Docs

Overview

This repository keeps bilingual user documentation under docs/zh/ and docs/en/. This skill synchronizes the two locales, page by page, after either side has been updated.

This skill is invoked by both gen-docs (incremental updates) and audit-docs (full pre-release audit) to keep locale mirrors in sync.

Prerequisites

If any of the following are missing, stop and report to the user before continuing:

  • docs/zh/ and docs/en/ mirrored directory structure.
  • docs/AGENTS.md — terminology table, typography rules, and source-of-truth rules.

Locale sync rules

  • Changelog (release-notes/changelog.md): English is the source. Translate to Chinese.
  • Breaking changes (release-notes/breaking-changes.md): English is the source. Translate to Chinese.
  • All other pages: docs/en/ and docs/zh/ are mirrored pairs. After either side changes, update the other locale in the same change.

When non-changelog pages change in either locale, sync the mirror before release. When the English changelog changes, sync the Chinese changelog.

Workflow

  1. Detect what needs syncing

    • git diff main..HEAD --stat docs/ — see which files changed
    • For each changed file under docs/en/ or docs/zh/, locate its mirror in the other locale (same relative path).
  2. Translate page by page, section by section

    • Keep heading hierarchy, list structure, code blocks, callout blocks, and link targets identical between the two versions.
    • When in doubt about a technical term, read the actual code to confirm behavior rather than guessing.
  3. Apply terminology and typography rules from docs/AGENTS.md

    • Use the term table exactly. Do not invent translations or use synonyms.
    • English H2+ uses sentence case (proper nouns excepted, per the term table).
    • Chinese typography: full-width punctuation (,。;:?!()), space between Chinese and ASCII (letters / numbers / inline code / links).
    • Callout titles (::: tip / ::: warning / ::: info / ::: danger) use the short Chinese labels from docs/AGENTS.md.
  4. Verify

    • git diff docs/ — scan for terminology drift or punctuation regressions.
    • Run the docs build if available (pnpm --filter docs run build or equivalent) to catch broken links and Markdown errors.

Rules and conventions

  • Do not one-sided fixes: if the changed locale has an unclear or incorrect statement, fix it there first; do not patch only the mirror.
  • Match style, not just words: Chinese docs use a narrative tone (see docs/AGENTS.md writing-style examples); preserve that tone in Chinese; preserve sentence-case headings and concise English style in English.
  • Code blocks and identifiers stay as-is: do not translate code, command names, flag names, or file paths.
  • Public examples: Do not introduce real internal endpoints, key names, account names, or service names while translating. Keep or replace them with neutral placeholders such as example.com, example.test, and YOUR_API_KEY in both locales.

Common mistakes

  • Rewriting only the mirror because a phrase feels awkward in the target language — fix the changed locale first, then sync.
  • Letting English headings slip into Title Case (only sentence case is allowed for H2+).
  • Forgetting to add spaces between Chinese characters and inline code or English words.
  • Translating proper nouns listed in the term table (Wire, MCP, ACP, JSON, OAuth, macOS, uv, etc.).
  • Updating only one direction and leaving the other locale stale — always finish all pages flagged by the diff.
  • Copying real internal values into the mirror instead of using neutral example placeholders.
指导编写和修改 kimi-code 终端 UI 的技能,涵盖架构、组件、控制器、主题及对话框规范。适用于涉及 TUI 开发、测试放置及设计遵循的场景。
需要编写或修改 apps/kimi-code/src/tui 下的代码 涉及终端 UI 组件、对话框、斜杠命令或主题的变更 需要遵循 TUI 架构约束和设计规范
.agents/skills/write-tui/SKILL.md
npx skills add MoonshotAI/kimi-code --skill write-tui -g -y
SKILL.md
Frontmatter
{
    "name": "write-tui",
    "description": "Use when writing or modifying the kimi-code terminal UI in apps\/kimi-code\/src\/tui — components, dialogs\/selectors, slash commands, themes, streaming render, or the KimiTUI controllers. Covers the architecture, where new features go, test placement, the theme system mechanics, and the dialog interaction\/visual spec (DESIGN.md)."
}

Write TUI (apps/kimi-code)

The terminal UI lives in apps/kimi-code/src/tui. Before writing TUI code, read apps/kimi-code/AGENTS.md for the always-on map, module boundaries, and hard constraints (printable-key decoding, no chalk named colors, etc.). This skill is the how-to: architecture orientation, feature routing, test placement, theme mechanics, and the dialog spec.

For any list dialog, selector, input box, or status/toggle list, the interaction and visual rules are normative — see DESIGN.md in this folder and follow its self-check list before submitting.

Architecture

KimiTUI is a coordinator that wires state, layout, session, and dialogs together and delegates heavy logic to controllers.

  • src/tui/kimi-tui.ts — the KimiTUI coordinator. Holds state, owns startup/shutdown order, layout/editor wiring, user-input entry, sending/queueing, session lifecycle, and the slash-command handler dispatch. It should not accumulate event-routing or rendering logic — those live in controllers.
  • src/tui/tui-state.tsTUIState, createTUIState, createInitialAppState. The single global UI state shape. Before adding a new global field, decide whether it truly belongs here vs. local component state.
  • src/tui/controllers/ — the independently-testable responsibilities. Each controller owns one slice:
    • session-event-handler.ts — routes SDK session events (handleEvent dispatch + the per-event handleXxx). Concrete event handling goes here, not in KimiTUI.
    • streaming-ui.ts — streaming render: assistant delta, thinking, tool call / result, compaction, subagent, background agent, transcript aggregation.
    • session-replay.ts — resume/replay orchestration; drives replay records through the same live render hooks. Stateless replay parsing/limiting/projection helpers belong in src/tui/utils/message-replay.ts.
    • tasks-browser.ts — the tasks browser controller.
    • editor-keyboard.ts — editor keyboard handling, exit shortcuts, external editor, clipboard image.
    • auth-flow.ts — login/auth orchestration (refreshConfigAfterLogin, etc.).
  • src/tui/commands/ — slash-command declaration, parsing, ordering, and dynamic skill-command generation. Parsing and types only; execution is dispatched from KimiTUI's slash-command handler section, and complex execution sinks into utils or focused components.
  • src/tui/components/ — pi-tui components by UI type: chrome/ (footer, todo, welcome, loader, device code), dialogs/ (selectors, approval/question panels, settings popups that replace the editor), editor/ (input box + mention provider), media/ (image, diff, code highlight), messages/ (transcript blocks + tool-renderers), panes/ (activity, queue).
  • src/tui/reverse-rpc/ — adapts SDK approval/question callbacks into UI panel data and the user's choice back into an SDK response.
  • src/tui/theme/ — themes, color tokens, style helpers, pi-tui markdown theme, terminal-background detection. The single source of truth for color.
  • src/tui/utils/ — TUI-only utilities (need TUIState or a component). App-wide, UI-independent helpers go in src/utils/.

When a controller or KimiTUI section keeps growing, split pure functions, state projections, and presentation components into the matching directory rather than expanding the file.

Where new features go

The feature type decides the landing spot:

  • CLI argumentssrc/cli/commands.ts / src/cli/options.ts, passed into the TUI via src/cli/run-shell.ts. The CLI never operates on the session directly.
  • CLI subcommandssrc/cli/sub/, non-interactive only; reach core via @moonshot-ai/kimi-code-sdk.
  • Slash commands → declare/parse/type under src/tui/commands/; add the execution entry in KimiTUI's slash-command handler section; sink complex logic into utils or a focused component.
  • Skill-derived commands → hook into buildSkillSlashCommands / the skill command map; do not hard-code a single skill.
  • Transcript message types → define the shape in src/tui/types.ts, add/extend a components/messages/ component, register the renderer in the transcript builder.
  • Tool-result display → extend components/messages/tool-renderers/registry.ts and the renderer; do not stack branches inside ToolCallComponent.
  • Popup / selectorcomponents/dialogs/, mounted via mountEditorReplacement; follow DESIGN.md. If triggered by an SDK callback, check whether reverse-rpc/ needs an adapter/controller/handler.
  • SDK event handling → add the dispatch in session-event-handler.ts's handleEvent, then the matching handleXxx.
  • Streaming rendercontrollers/streaming-ui.ts.
  • Session start / resume behavior → the session-management section of KimiTUI; replay behavior → controllers/session-replay.ts, reusing live render paths.
  • Status bar / activity / queuechrome/footer, panes/activity, panes/queue, and the matching updateXxx.
  • Configuration option → read/write + schema in src/tui/config.ts, then the settings UI; persist through saveTuiConfig (a component never writes the config file itself).
  • Constants → shared CLI/TUI non-copy constants in src/constant/; TUI-only non-copy constants in src/tui/constant/. Component-local copy, option labels, help text, dialog titles/footers stay next to their component — do not centralize copy into a global module.
  • General capability → no TUI-state dependency → src/utils/; depends on TUI state or a component → src/tui/utils/.

Test placement

  • Component behavior tests sit next to the component's existing tests (test/tui/components/...).
  • Command parsing tests → test/tui/commands/.
  • reverse-rpc tests → test/tui/reverse-rpc/.
  • Pure utility tests → next to the corresponding utils tests.
  • Do not create a generic some-feature.test.ts just to land a small feature; extend the nearest existing test file.

Theme system mechanics

Themes are managed centrally under src/tui/theme/:

  • colors.ts — semantic tokens: ColorPalette, darkColors, lightColors.
  • styles.ts — common chalk helpers built on top of ColorPalette.
  • pi-tui-theme.ts — the markdown/pi-tui theme config.
  • terminal-background.ts — terminal background detection used by auto resolution.
  • bundle.ts — packs colors, styles, markdownTheme into a KimiTUIThemeBundle.
  • index.ts / detect.ts — theme type and auto/dark/light resolution.

Keep the color-token set in sync. ColorPalette in colors.ts is the source of truth for color tokens. When you add, rename, or remove one, update its mirrors in the same change: the custom-theme JSON schema (apps/kimi-code/src/tui/theme/theme-schema.json), the token tables in the custom-theme docs (docs/en/customization/themes.md and docs/zh/customization/themes.md), and the token table in the custom-theme built-in skill (packages/agent-core/src/skill/builtin/custom-theme.md).

Apply / switch flow:

  • UI entry: ThemeSelectorComponenthandleThemeCommandapplyThemeChoice.
  • The real apply step is KimiTUI.applyTheme: it updates state.theme, state.appState.theme, and notifies components to refresh their palette.
  • Persist the choice through saveTuiConfig — a component must not write the config file itself.

The hard color rules (no chalk named colors, contrast ratios, no module-top-level cached styled functions, add a ColorPalette token before inventing a color) are normative and guard-enforced — they live in apps/kimi-code/AGENTS.md. This skill only covers the mechanics.

Before you submit

  • Run lint / format / test on the files you changed.
  • For any dialog/selector/input/toggle list, walk the self-check list at the end of DESIGN.md.
  • Keep printableChar() for printable-key comparisons (CI guard) and chalk.hex(colors.<token>) for color (CI guard).
通用数据源助手,支持股票金融、宏观经济、企业工商、学术论文及法律法规查询。通过MCP工具动态获取接口文档并调用,需核对股票代码和企业全称,不支持实时新闻搜索。
查询A股/港股/美股行情或财报 查询全球宏观经济数据 查询中国企业工商信息 检索arXiv或Google Scholar论文 查找中国法律法规或司法案例
plugins/official/kimi-datasource/SKILL.md
npx skills add MoonshotAI/kimi-code --skill kimi-datasource -g -y
SKILL.md
Frontmatter
{
    "name": "kimi-datasource",
    "description": "Universal data-source assistant. Use this skill when the user wants external structured data such as stocks, financial reports, technical indicators, A-share\/HK\/US markets, global macroeconomics, Chinese enterprise registry information, arXiv papers, Google Scholar results, or Chinese laws\/regulations and judicial cases.\nThis plugin exposes tools via MCP server `plugin-kimi-datasource_data`; call them in the flow `mcp__plugin-kimi-datasource_data__get_data_source_desc` → `mcp__plugin-kimi-datasource_data__call_data_source_tool`."
}

kimi-datasource — 通用数据源助手

0. 调用方式

本 skill 使用 datasource MCP server 注册的两个工具,不要通过 Bash 手动执行脚本:

  • mcp__plugin-kimi-datasource_data__get_data_source_desc
  • mcp__plugin-kimi-datasource_data__call_data_source_tool

这两个工具由 Kimi Code 托管执行,参数直接按 tool schema 传 JSON。

工具会读取当前 Kimi Code 环境对应的本地 OAuth 登录凭据;当设置了 KIMI_CODE_OAUTH_HOST / KIMI_CODE_BASE_URL 时,会使用对应环境的隔离凭据。如果没有登录凭据,让用户先在 Kimi Code 里执行 /login

1. 这个 skill 提供什么能力

本 plugin 后面挂了 7 个外部数据源。每一行的"数据源名"就是传给 get_data_source_descname

能力域 数据源名 典型问题
A股 / 港股 / 美股 行情和财务 stock_finance_data "茅台现在多少钱"、"宁德时代 2024 年财报"、"腾讯股东"、"杭州的人工智能股票"
Yahoo Finance 全球金融 yahoo_finance "苹果分析师评级"、"AAPL 期权链"、"标普 500 历年价格"
世界银行宏观经济 world_bank_open_data "中国历年 GDP"、"印度通胀率"、"各国人口增长对比"
中国企业工商信息 tianyancha "字节跳动股东"、"比亚迪司法风险"、"宁德时代专利"
arXiv 论文预印本 arxiv "找 RAG 综述"、"下载 2406.xxxxx"
Google Scholar 学术搜索 scholar "Hinton 最新论文"、"transformer 综述高引文献"
中国法律法规 / 司法案例 yuandian_law "民法典关于居住权的规定"、"帮我查劳动合同解除的相关法条"、"找几个不当得利的判例"

不支持的能力:通用 Web 搜索 / 实时新闻。问到这类问题,告诉用户当前数据源不覆盖。

2. 标准工作流:get_data_source_desccall_data_source_tool

后端可用 API 经常会调整,这份 skill 故意不抄具体的 API 名和参数表。每次调用前你都应当现场问数据源:"你都有什么接口?"

1. 根据用户问题,从上表挑出一个 data_source_name
2. 执行 get_data_source_desc,读取该数据源的 Markdown 文档
3. 仔细读返回的 Markdown,里面列了:
     - 该数据源整体说明(含 ticker 格式、全局约束)
     - 每个 API 的描述 / 必填参数 / 可选参数 / 默认值 / 取值范围
4. 选最匹配的 API,按文档拼 params
5. 执行 call_data_source_tool
6. 读返回结果,用用户提问时使用的语言回答

例 1:用户问"茅台最近一年走势"

  1. 股票走势 → stock_finance_data

  2. 调用 mcp__plugin-kimi-datasource_data__get_data_source_desc,参数 {"name":"stock_finance_data"}

  3. 从文档里找到"获取历史价格"那个 API,看它要 ticker / start_date / end_date / file_path

  4. 用 web_search 核对 → 茅台 = 600519.SH

  5. 调用 mcp__plugin-kimi-datasource_data__call_data_source_tool,参数形如 {"data_source_name":"stock_finance_data","api_name":"<文档里写的 api>","params":{"ticker":"600519.SH","start_date":"...","end_date":"...","file_path":"/tmp/mao_1y.csv"}}

例 2:用户问"找几篇 retrieval augmented generation 的综述"

  1. 论文搜索 → arxiv(或 scholar,arxiv 更适合预印本,scholar 引用更全)

  2. 调用 mcp__plugin-kimi-datasource_data__get_data_source_desc,参数 {"name":"arxiv"}

  3. 从文档里找到搜索类 API,看它要 query / file_path / max_results

  4. 执行 call_data_source_tool

例 3:用户问"字节跳动有哪些股东"

  1. 企业工商 → tianyancha

  2. 调用 mcp__plugin-kimi-datasource_data__get_data_source_desc,参数 {"name":"tianyancha"}

  3. 注意:tianyancha 的 API 是动态注册的,文档会指引你先用搜索类接口找到合适的 API 名,再调用

  4. 必须使用企业全称("北京字节跳动科技有限公司"),不要用简称。不知道全称就先用 tianyancha 文档里的"公司搜索"接口查

3. 调用前的几条铁律

3.1 股票代码必须核对,不能凭记忆猜

A 股 .SH/.SZ/.BJ,港股 .HK,美股 .US 等。用户通常只说中文名("茅台"、"宁德时代"、"腾讯"),不会给代码。

调任何股票相关 API 前,先用 web_search / WebSearch 一类联网工具确认正确代码 + 后缀。

如果当前环境没有任何联网工具,让用户亲口确认代码,不要硬猜。错了的话接口会静默返回错数据或空数据。

3.2 企业相关查询必须用全称

tianyancha 拒收"特斯拉"、"网易"、"腾讯"这种简称,必须给"北京特斯拉销售有限公司"这种全名。不知道全名时,先调它的公司搜索 API。

3.3 多数 API 需要 file_path

绝大部分数据源 API 把完整结果以 CSV 形式写到 file_path。漏传会报 Missing required parameters: file_path。不知道传啥时,给一个 /tmp/<场景>_<时间戳>.csv 即可。

3.4 一次调用不要堆太多 ticker

stock_finance_data 的实时接口最多 3 个 ticker,历史接口最多 10 个。超过会被截断或报错。多了就分批调。

4. 怎么读返回结果

call_data_source_tool 的 stdout 一般含两段:

  1. data_preview:CSV 头 + 前几行(通常 1~3 行),方便你直接答简单问题
  2. CSV 数据已写入:/tmp/xxx.csv:完整数据落盘路径

策略:

  • 用户只问"XX 现在多少钱"、"中国 2023 GDP 多少"这种单值 → data_preview 一般够,直接答
  • 用户要画图、对比、算盈亏、列清单 → 用 Read 工具把 CSV 读出来再处理
  • 混合 A+港股查询时服务端会自动把 CSV 拆成 _a.csv / _hk.csv 两份,原 file_path 那个文件不存在

如果接口返回失败,提示文字一般会写明原因(参数不对 / 不支持 / 数据空等)。把人话原因反馈给用户,不要硬走第二次。

5. watchlist.json — 用户自选股

${KIMI_SKILL_DIR}/watchlist.json 是用户的自选股列表。用户问"看一下我的自选股"时,读这个文件,再走标准 get_data_source_desc("stock_finance_data") → call_data_source_tool 流程查实时行情;文档里的实时接口最多 3 个 ticker 一批,多了分批调。

格式:

[
  {"code": "600519.SH", "name": "贵州茅台"},
  {"code": "0700.HK", "name": "腾讯控股", "hold_cost": 350.5, "hold_quantity": 100}
]
  • codename 必填;hold_costhold_quantity 可选
  • 两者都有时顺便算盈亏:(当前价 - hold_cost) * hold_quantity
  • 用户说"帮我加 XX 到自选股"时:先 web_search 核对代码,再追加到 JSON 数组

6. 注意事项

  • 回答用户时,使用用户提问时使用的语言。如果用户用中文问,就用中文答;如果用户用英文问,就用英文答;用其他语言问,就用其他语言答。
  • 不要凭记忆猜股票代码 / 企业全称。错代码会让接口静默返回错数据,用户察觉不到
  • 不要在没读 desc 的情况下硬传 api_name。后端会报 API_NOT_FOUND。除非这次会话里你已经读过该数据源的 desc 并记得参数
  • 不要给投资建议。给完数据加一句"AI 生成,不构成投资建议"即可
  • 如果某个数据源接口返回的报错明显是后端 bug(参数 schema 自相矛盾、内部 Python 报错等),汇报错误给用户,不要硬试——这种 bug 我们这边修不了,要后端服务侧改

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-08 19:14
浙ICP备14020137号-1 $Гость$