tui-design
Guide Elph terminal UI development with iocraft (components, flex layout, scroll, a11y, dialogs, and transcript ergonomics) and CLI/slash command UX: anstyle…
от riipandi★ 34 звезды на GitHub
Установить tui-design в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
TUI & Terminal UX Design
Language
- In-chat guidance follows the user's language.
- Code, paths, identifiers, key names, and command names stay literal.
- Permanent documentation and code comments are written in English.
Objective
Help implement and refine:
- Interactive TUIs with iocraft — mental model, layout, hooks, a11y.
- CLI / slash command output — structured, scannable text with optional ANSI color (
anstyle), good defaults, and safe behavior when color is off or output is not a TTY.
Read existing TUI and CLI code in the repo first; match local conventions (for
example crates/coding-agent/src/tui/, crates/elph-tui/src/,
crates/coding-agent/src/cli/, crates/coding-agent/src/memory/format.rs,
and crates/rendown/). Do not design against generic ratatui assumptions:
Elph uses iocraft, the local vendor/iocraft patch, crossterm events, smol-backed
use_future, and rendown for Markdown/terminal rendering.
Elph UI architecture
The application shell lives under crates/coding-agent/src/tui/ and owns
session state, global events, transcript, prompt input, dialogs, and slash
palette. Reusable visual primitives live in crates/elph-tui/src/; rendered
Markdown and code go through rendown. Keep these responsibilities separate:
MainShell
├── fixed chrome (header/status)
├── transcript panel (scroll + sticky prompt behavior)
├── modal/dialog or overlay
└── prompt/editor/footer
Before editing, locate the nearest existing component and its tests. Prefer a
new file under the existing module tree over enlarging shell/mod.rs,
status_dialog.rs, or another already cohesive-but-large module. Preserve the
existing pub/pub(crate) visibility and do not make internals public to
support an integration test.
Runtime and platform facts
- iocraft is pinned to
=0.8.4and patched tovendor/iocraftbecause Elph needs bracketed paste support. use_futureruns on smol; use smol timers for iocraft hook work rather than assuming a Tokio runtime is present.- Tokio is used by application/agent async work. Never block the render loop with filesystem, process, network, database, or embedding work; use the established async/task boundary.
- Clipboard dependencies have Linux Wayland-specific features. PTY, signals, and shell behavior are platform-specific; keep Unix code gated and provide a Windows path or an explicit documented limitation.
- Use
Path/PathBufandMAIN_SEPARATOR; never construct OS paths with hardcoded/or\.
Mental model
1. Terminal as a single viewport
The UI is one tree of elements sized to the terminal (use_terminal_size). Think web flexbox in a fixed viewport: columns stack top-to-bottom; one region usually grows to fill leftover height; fixed chrome (header, input, footer) does not grow.
2. Component = function + props + element tree
Each visual unit is a #[component] function taking &Props and Hooks. Props are plain structs (#[derive(Default, Props)]). Parent passes data down; interactive state lives in hooks, not in props.
Decompose by responsibility, not by screen coordinates:
- Shell (root layout, global events, exit)
- Scrollable content panel
- Fixed chrome (header, status, input area)
- Small leaf widgets (labels, inputs, buttons)
Prefer several small components over one monolithic element! block.
3. State vs presentation
| Concern | Where it lives |
|---|---|
| Layout dimensions | use_terminal_size, derived widths/heights |
| User-driven values (mode, selection, draft text) | use_state / focused widget state |
| Side effects (timers, async) | use_future |
| Global app control (quit) | use_context_mut::<SystemContext> |
| Pure rendering | Props + read-only hook state |
Initialize state with a closure: use_state(|| initial) — not use_state(initial) for non-Copy values.
4. Events are edge-triggered
Handle use_terminal_events on press, not release:
if kind == KeyEventKind::Release {
return;
}
Match on (modifiers, code). Decide whether shortcuts are global (shell) or local (focused TextInput) before wiring keys.
5. Layering: flow vs overlap
Flow layout — children affect parent size and sibling position (default).
Overlap — child with position: Position::Absolute is taken out of flow. Use for badges, border labels, overlays. Parent needs position: Position::Relative. Set background_color: Color::Reset on the overlay so it paints over the border cleanly. Negative margin (margin_bottom: -1) can sit a label on the border line without adding row height.
L
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл tui-design?
Guide Elph terminal UI development with iocraft (components, flex layout, scroll, a11y, dialogs, and transcript ergonomics) and CLI/slash command UX: anstyle coloring, readable structured output, TTY/NO_COLOR rules, and dialog-safe plain text. Use when building or refactoring a TUI, CLI subcommands, slash commands, colored terminal output, fixing scroll/focus/layout bugs, improving keyboard/contrast ergonomics, or the user mentions iocraft, terminal UI, CLI colors, anstyle, command UX, accessibility, a11y, or runs /tui-design.
Как установить скилл tui-design?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tui-design запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…