write-tui
Use when writing or modifying the kimi-code terminal UI in apps/kimi-code/src/tui — components, dialogs/selectors, slash commands, themes, streaming render…
от P-A-N-52★ 47 звёзд на GitHub
Установить write-tui в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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— theKimiTUIcoordinator. Holdsstate, 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 (handleEventdispatch + the per-eventhandleXxx). Concrete event handling goes here, not inKimiTUI.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 insrc/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 fromKimiTUI's slash-command handler section, and complex execution sinks intoutilsor 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 (needTUIStateor a component). App-wide, UI-independent helpers go insrc/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 viasrc/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 inKimiTUI's slash-command handler section; sink complex logic intoutilsor 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 acomponents/messages/component, register the renderer in the transcript builder. - Tool-result display → extend
components/messages/tool-renderers/registry.tsand the renderer; do not stack branches insideToolCallComponent. - Popup / selector →
components/dialogs/, mounted viamountEditorReplacement; follow DESIGN.md. If triggered by an SDK callback, check whetherreverse-rpc/needs an adapter/controller/handler. - SDK event handling → add the dispatch in
session-event-handler.ts'shandleEvent, then the matchinghandleXxx. - 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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- DESIGN.md
FAQ
Что делает скилл write-tui?
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?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл write-tui запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…