Catalogue / ratatui
ratatui
MITSignedBuild or modify terminal UIs in Rust with ratatui. Use for any TUI, terminal dashboard, file browser, log viewer, or "make this CLI interactive" task. Do not use for non-Rust or non-terminal tasks.--- name: ratatui description: Build or modify terminal UIs in Rust with ratatui. Use for any TUI, terminal dashboard, file browser, log viewer, or "make this CLI interactive" task. Do not use for non-Rust or non-terminal tasks. ---
ratatui
Write terminal UIs that work, look deliberate, and contain no filler.
Two failures this skill prevents:
- Stale or invented APIs. ratatui changes between releases. Never write ratatui code from memory.
- Slop. Default styling nobody chose, decorative panels, fake data, dead keys, narrating comments. If it is on screen it is real.
All paths below are relative to this skill's installed directory. Locate this SKILL.md first, then derive the skill directory: SKILL_DIR=$(dirname "$(realpath <path-to-this-SKILL.md>)"). Run every bundled script through that absolute path. Never assume the working directory is the skill or repository root.
Which workflow
New application (no existing codebase): follow steps 1-5 in full.
Existing application (bug fix, small feature, layout tweak): skip the design brief unless the change alters the layout archetype. Inspect the existing code first. Make the smallest change that fixes the issue. Preserve existing dependencies, patterns, and key bindings. Run the existing tests, not new ones unless the bug lacks coverage. Do not restructure.
1. Research (before any code)
Run $SKILL_DIR/scripts/crate-versions.sh ratatui color-eyre unicode-width plus every other crate you plan to use. Quote what it returns. Set rust-version in Cargo.toml to the highest MSRV among your dependencies.
- Check
cargo --versionagainst each dependency's MSRV. Fix before continuing. - Read the ratatui CHANGELOG and BREAKING-CHANGES for your version.
- Confirm widget crates support your ratatui version (
cargo tree -d). - Import crossterm through
ratatui::crossterm. Do not addcrosstermto
Cargo.toml unless you can state why.
- Uncertain API: write a ten-line program and compile it.
See references/research-checklist.md for pitfalls found in practice.
2. Design brief (new apps only)
Write this before any code. Every line justified from the app's actual data.
- Purpose: one sentence, user, keyboard habits.
- Data: what is shown, how big (10 rows or 100,000?), how it changes.
- Layout archetype: pick one and say why (list+preview, multi-panel,
drill-down, dashboard, header+list, popup/overlay).
- Accent color: exactly one ANSI color, what it marks. Secondary text is
dim, not a second color.
- Density: compact or roomy, and why.
- Modes and keys: vim-style plus arrows. Never rebind Ctrl-C, Esc, Enter.
- States: empty, loading, failed, too small.
- Not doing: features left out on purpose.
3. Build
New app: start from templates/dirview/. Copy the structure, then replace the domain. Rename the crate reference in main.rs.
Existing app: do not copy the template. Read the existing code first. Make the smallest change. Preserve existing dependencies and patterns.
| File | Job | |---|---| | action.rs | Enum of everything the user can do | | keymap.rs | One key table drives input, footer hints, and ? help | | state.rs | All state and State::update(Action). No terminal types | | fs.rs | I/O. No terminal types | | ui/ | Rendering only. Reads state, never changes it | | theme.rs | Colors by role. The only file that names a color | | event.rs, app.rs, main.rs | Input, loop, startup |
Rules:
- Everything visible works. No fake data, dead keys, placeholder rows.
- Measure text with
unicode-width, never.len(). Sanitize untrusted text. - Build only rows on screen. Cost per frame must not grow with data.
- 16 ANSI colors by default. Respect
NO_COLOR. No forced background. - One border style, plain Unicode, no emoji.
- Handle every state: empty, error, loading, too small, resize.
- Destructive actions confirm. Slow work never blocks the draw loop.
color-eyreinmain, typed errors in the library, no swallowed results.- Comments say why, not what. No TODOs, no commented-out code.
4. Verify
cargo fmt --check cargo clippy --all-targets -- -D warnings cargo test
Then:
- Dump screens. Render through
TestBackendat 40x8, 80x24, 200x60 plus
empty, error, help states. Read the text. Fix misalignment or clipping.
- PTY smoke.
$SKILL_DIR/scripts/pty-smoke.py PATH/TO/BINARY. Universal
checks run by default (startup, alternate screen, tiny terminal, clean exit via Ctrl-C). Add --quit-keys, --keys, --tiny-text, --check-ctrl-c, --check-color, --check-resize for app-specific checks.
- Slop scan.
$SKILL_DIR/scripts/lint-slop.sh PROJECT_DIRmust print
clean.
If a check cannot run, say which and why. Do not report success for unrun checks.
5. Report
Say what was built, versions used, which checks passed, and anything unverified. Keep it short. Do not recap the steps.
References
references/research-checklist.md: version and API research, pitfallsreferences/ux-principles.md: layouts, keys, color, responsivenessreferences/slop-tells.md: what reads as generated, with before/after
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 5.2 kB | 89c2243f8c32 |
| SKILVAULT_SOURCE.json | 4.2 kB | 5035ad6efea8 |
| THIRD_PARTY_NOTICES.md | 1.1 kB | 3838e2d14200 |
| references/research-checklist.md | 4.4 kB | 8abd54881a1d |
| references/slop-tells.md | 5.1 kB | 543a5eeb497c |
| references/ux-principles.md | 7.9 kB | c7c4c1257283 |
| scripts/crate-versions.sh | 1.1 kB | 6da53b648528 |
| scripts/lint-slop.sh | 4.4 kB | a2bc2ec5ed45 |
| scripts/pty-smoke.py | 8.4 kB | 6478985a2a2b |
| templates/dirview/Cargo.lock | 49.1 kB | 31e86a3262e1 |
| templates/dirview/Cargo.toml | 376 B | edd03169eedb |
| templates/dirview/README.md | 1.4 kB | ddb66ad0b3f2 |
| templates/dirview/examples/dump.rs | 1.5 kB | 358340b2c8c8 |
| templates/dirview/src/action.rs | 510 B | 02fd7c14159f |
| templates/dirview/src/app.rs | 1.2 kB | 664b25677dc6 |
| templates/dirview/src/event.rs | 505 B | ce8da523a6a0 |
| templates/dirview/src/fs.rs | 3.1 kB | 27e8722c5061 |
| templates/dirview/src/keymap.rs | 8.2 kB | e80e1f8fe662 |
| templates/dirview/src/lib.rs | 391 B | c78e629f1bd4 |
| templates/dirview/src/main.rs | 922 B | 5821e00b7ea3 |
| templates/dirview/src/state.rs | 13.7 kB | 8bfa78d234b3 |
| templates/dirview/src/theme.rs | 1.9 kB | fdd22f9570f7 |
| templates/dirview/src/ui/footer.rs | 2.7 kB | d72d17aa566c |
| templates/dirview/src/ui/help.rs | 2.0 kB | f2d0ecf7d95b |
| templates/dirview/src/ui/list.rs | 4.9 kB | a5b6429c4f92 |
| templates/dirview/src/ui/mod.rs | 4.3 kB | dde140440ba4 |
| templates/dirview/src/ui/preview.rs | 2.9 kB | 2633bd969486 |
| templates/dirview/src/ui/text.rs | 4.7 kB | ab25332189ab |
| templates/dirview/tests/render.rs | 4.6 kB | 82309aa8b1f1 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | 8aa5c8a405c7 | 29 Nov 2026 |
Locking a skill to one version needs Pro.