Agent skill

Write Tui

by MoonshotAI in MoonshotAI/kimi-code

A skill your agent uses 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…

MITAuto-check passedAgent Workflows

Install Write Tui

skills CLI
$ npx skills add MoonshotAI/kimi-code --skill write-tui -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install MoonshotAI/kimi-code write-tui --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/MoonshotAI/kimi-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/write-tui .claude/skills/write-tui && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
write-tui
GitHub stars
7.8k
Token cost
~2.1k tokens
SKILL.md length
897 words
Files
2
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses 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…

  • Modifying the kimi-code terminal UI in apps/kimi-code/src/tui — components
  • SKILL.md covers Architecture, Where new features go, Test placement and Theme system mechanics, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Dialogs/selectors

What it does

Write Tui is an agent skill from MoonshotAI/kimi-code. 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).

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `DESIGN.md`).

It sits in Agent Workflows, covering Design tokens and Hooks and plugins. It works with Kimi. The repository describes itself as: Kimi Code CLI — The Starting Point for Next-Gen Agents. The licence is MIT.

When your agent uses it

  • Modifying the kimi-code terminal UI in apps/kimi-code/src/tui — components
  • Dialogs/selectors
  • Streaming render
  • The KimiTUI controllers

Example prompts

  • “/write-tui”

What it can do on your machine

Read from SKILL.md and the folder at commit 21406fb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Write Tui loads about 2.1k tokens when it runs. Until then it costs about 85 tokens; SKILL.md has 897 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~85
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from MoonshotAI/kimi-code at commit 21406fb, republished under its MIT licence (© MoonshotAI). 897 words, ~2,101 tokens.

Download SKILL.mdSave it as .claude/skills/write-tui/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
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.ts — TUIState, 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), markdown/ (the app's Markdown wrapper and mermaid art), 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 arguments → src/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 subcommands → src/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 / selector → components/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 render → controllers/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 / queue → chrome/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/.
Show full SKILL.md (269 more words)Show less

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-v2/src/features/skill/catalog/builtin/custom-theme.md).

Apply / switch flow:

  • UI entry: ThemeSelectorComponent → handleThemeCommand → applyThemeChoice.
  • 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).

© MoonshotAI, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .agents/skills/write-tui of MoonshotAI/kimi-code.

  • SKILL.md
  • DESIGN.md

Open the folder on GitHubat commit 21406fb

Compare with similar skills

Write Tui next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Write Tui compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Write Tui this skillMoonshotAI/kimi-code7.8k—~2.1kAutomated safety check: PassMIT
Hook Development for Claude Code Pluginsanthropics/claude-plugins-official37k11 repos~4.1kAutomated safety check: NotesApache-2.0
Claude Code Agent Developmentanthropics/claude-plugins-official37k8 repos~2.8kAutomated safety check: PassApache-2.0
Claude Code Skill Developer Guidediet103/claude-code-infrastructure-showcase10k10 repos~3.5kAutomated safety check: PassMIT
Plugin Settings Patternanthropics/claude-plugins-official37k7 repos~3kAutomated safety check: PassApache-2.0
MCP Integration for Pluginsanthropics/claude-plugins-official37k11 repos~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    37k GitHub starsUsed in 11 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes
  • Claude Code Agent Development

    anthropics/claude-plugins-official

    Official

    Explains how to write agents for Claude Code plugins: the markdown file with YAML frontmatter, trigger descriptions, model and color settings, and system prompt design.

    37k GitHub starsUsed in 8 repos~2.8k tokens
    Agent WorkflowsAuto-check passed
  • Claude Code Skill Developer Guide

    diet103/claude-code-infrastructure-showcase

    A guide to creating and managing Claude Code skills with auto-activation: skill-rules.json triggers, hooks, enforcement levels, YAML frontmatter and progressive disclosure.

    10k GitHub starsUsed in 10 repos~3.5k tokens
    Agent WorkflowsAuto-check passed
  • Plugin Settings Pattern

    anthropics/claude-plugins-official

    Official

    Shows how Claude Code plugins keep per-project settings and state in .claude/plugin-name.local.md files with YAML frontmatter and a markdown body.

    37k GitHub starsUsed in 7 repos~3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    37k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Claude Code Command Development

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code slash commands: Markdown files with YAML frontmatter, arguments, file references, bash context and interactive prompts.

    37k GitHub starsUsed in 10 repos~4.8k tokens
    Agent WorkflowsAuto-check passed

More from MoonshotAI/kimi-code

All 11 skills in this repo
  • Kimi Webbridge

    MoonshotAI/kimi-code

    Kimi Browser Extension(Kimi 浏览器扩展,原 Kimi WebBridge)lets AI control the user's real browser — navigate, click, type, read, screenshot, and interact with any website using the user's actual login…

    7.8k GitHub stars~3.6k tokensUpdated 5 days ago
    Auto-check passed
  • Gen Changesets

    MoonshotAI/kimi-code

    A skill your agent uses when generating changesets in the kimi-code repository — deciding whether to write one, which package to list, the bump level, the wording, and the confirmation workflow.

    7.8k GitHub stars~1.1k tokensUpdated 5 days ago
    Auto-check passed
  • Gen Docs

    MoonshotAI/kimi-code

    Update Kimi Code CLI user documentation after meaningful code changes that affect product behavior or user experience.

    7.8k GitHub stars~1.2k tokensUpdated 5 days ago
    Auto-check passed
  • Kimi Datasource

    MoonshotAI/kimi-code

    Universal data-source assistant for stocks (Wind, S&P, SEC EDGAR), macro (World Bank, IMF, FRED, NBS), Chinese government data and standards (GB/HB/DB/TT), corporate, academic, legal, WHO/FAO/OECD…

    7.8k GitHub stars~1.8k tokensUpdated 5 days ago
    Auto-check passed
  • Pre Changelog

    MoonshotAI/kimi-code

    Use before merging a kimi-code release PR to preview the user-facing CLI changelog in Chinese.

    7.8k GitHub stars~1.6k tokensUpdated 5 days ago
    Auto-check passed
  • Review PR

    MoonshotAI/kimi-code

    在 kimi-code 仓库里 review 一个 PR 时使用:按 PR 模板逐节核对描述与 diff,并单独做一轮"回归与用户影响"评审,给出影响等级与评审摘要,评审摘要用用户当前使用的语言。

    7.8k GitHub stars~1.1k tokensUpdated 5 days ago
    Auto-check passed

Works with

Categories

Questions about Write Tui

What does Write Tui do?

A skill your agent uses 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…. Write Tui is an agent skill from MoonshotAI/kimi-code. 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.

When should I use Write Tui?

Write Tui fits situations like: modifying the kimi-code terminal UI in apps/kimi-code/src/tui — components; dialogs/selectors; streaming render; the KimiTUI controllers.

How do I install Write Tui in Claude Code?

Run `npx skills add MoonshotAI/kimi-code --skill write-tui -a claude-code`. Or copy the skill folder (.agents/skills/write-tui in MoonshotAI/kimi-code) into .claude/skills/write-tui in your project. Claude Code loads it when a task matches its description.

How do I install Write Tui in Codex?

Run `npx skills add MoonshotAI/kimi-code --skill write-tui -a codex`. Or copy the skill folder (.agents/skills/write-tui in MoonshotAI/kimi-code) into .agents/skills/write-tui in your project. Codex loads it when a task matches its description.

Can I use Write Tui in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add MoonshotAI/kimi-code --skill write-tui -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/write-tui, .gemini/skills/write-tui, .github/skills/write-tui and .opencode/skills/write-tui in your project.

What does Write Tui need to run?

SKILL.md names no scripts, command-line tools or credentials: Write Tui is instructions for the agent only.

Does Write Tui access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Write Tui safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Write Tui use?

Write Tui is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Write Tui use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Write Tui?

Skills that share tags, products or a category with Write Tui: Hook Development for Claude Code Plugins (anthropics/claude-plugins-official, 37k stars), Claude Code Agent Development (anthropics/claude-plugins-official, 37k stars), Claude Code Skill Developer Guide (diet103/claude-code-infrastructure-showcase, 10k stars) and Plugin Settings Pattern (anthropics/claude-plugins-official, 37k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Write Tui?

MoonshotAI (a GitHub organization) maintains it in MoonshotAI/kimi-code, which has 7,785 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 2, 2026.

Source: MoonshotAI/kimi-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.