terminal-ui
Original:🇺🇸 English
Translated
Terminal User Interface (TUI) performance and UX guidelines for TypeScript applications using Ink and Clack. This skill should be used when building CLI tools, interactive terminal prompts, or developer tooling with TUI components. Triggers on tasks involving TUI components, CLI prompts, terminal rendering, keyboard input handling, or developer tooling.
7installs
Sourcepproenca/dot-skills
Added on
NPX Install
npx skill4agent add pproenca/dot-skills terminal-uiTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →DevEx Developer Experience TUI Best Practices
Comprehensive developer experience guide for building TypeScript terminal user interfaces using Ink (React for CLIs) and Clack prompts. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Building CLI tools with interactive prompts using @clack/prompts
- Creating React-based terminal UIs with Ink
- Handling keyboard input and user interactions
- Optimizing terminal rendering and preventing flicker
- Designing developer-friendly CLI experiences
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Rendering & Output | CRITICAL | |
| 2 | Input & Keyboard | CRITICAL | |
| 3 | Component Patterns | HIGH | |
| 4 | State & Lifecycle | HIGH | |
| 5 | Prompt Design | MEDIUM-HIGH | |
| 6 | UX & Feedback | MEDIUM | |
| 7 | Configuration & CLI | MEDIUM | |
| 8 | Robustness & Compatibility | LOW-MEDIUM | |
Quick Reference
1. Rendering & Output (CRITICAL)
- - Batch Terminal Output in Single Write
render-single-write - - Overwrite Content Instead of Clear and Redraw
render-overwrite-dont-clear - - Use Synchronized Output Protocol for Animations
render-synchronized-output - - Target 60fps for Smooth Animation
render-60fps-baseline - - Update Only Changed Regions
render-partial-updates - - Defer ANSI Escape Code Generation to Final Output
render-escape-sequence-batching
2. Input & Keyboard (CRITICAL)
- - Use useInput Hook for Keyboard Handling
input-useinput-hook - - Provide Immediate Visual Feedback for Input
input-immediate-feedback - - Handle Modifier Keys Correctly
input-modifier-keys - - Use isActive Option for Focus Management
input-isactive-focus - - Always Provide Escape Routes
input-escape-routes
3. Component Patterns (HIGH)
- - Use Box Component with Flexbox for Layouts
tuicomp-box-flexbox - - Use Text Component for All Visible Content
tuicomp-text-styling - - Use measureElement for Dynamic Sizing
tuicomp-measure-element - - Use Static Component for Log Output
tuicomp-static-for-logs - - Use Percentage Widths for Responsive Layouts
tuicomp-percentage-widths - - Use Border Styles for Visual Structure
tuicomp-border-styles
4. State & Lifecycle (HIGH)
- - Use useApp Hook for Application Lifecycle
tuistate-useapp-exit - - Always Clean Up Effects on Unmount
tuistate-cleanup-effects - - Use Functional State Updates to Avoid Stale Closures
tuistate-functional-updates - - Stabilize Callbacks with useCallback
tuistate-usecallback-stable - - Memoize Expensive Computations with useMemo
tuistate-usememo-expensive
5. Prompt Design (MEDIUM-HIGH)
- - Use Clack group() for Multi-Step Prompts
prompt-group-flow - - Validate Input Early with Descriptive Messages
prompt-validation - - Handle Cancellation Gracefully with isCancel
prompt-cancellation - - Use Spinner and Tasks for Long Operations
prompt-spinner-tasks - - Build Custom Prompts with @clack/core
prompt-custom-render
6. UX & Feedback (MEDIUM)
- - Show Progress for Operations Over 1 Second
ux-progress-indicators - - Use Colors Semantically and Consistently
ux-color-semantics - - Write Actionable Error Messages
ux-error-messages - - Show Next Steps After Completion
ux-next-steps - - Use Intro and Outro for Session Framing
ux-intro-outro
7. Configuration & CLI (MEDIUM)
- - Provide Sensible Defaults for All Options
tuicfg-sensible-defaults - - Support Standard Environment Variables
tuicfg-env-vars - - Prefer Flags Over Positional Arguments
tuicfg-flags-over-args - - Implement Comprehensive Help System
tuicfg-help-system - - Support Machine-Readable Output Format
tuicfg-json-output
8. Robustness & Compatibility (LOW-MEDIUM)
- - Detect TTY and Adjust Behavior Accordingly
robust-tty-detection - - Handle Process Signals Gracefully
robust-signal-handling - - Use Meaningful Exit Codes
robust-exit-codes - - Always Restore Terminal State on Exit
robust-terminal-restore - - Degrade Gracefully for Limited Terminals
robust-graceful-degradation
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
- render-single-write - Example rule file
- input-useinput-hook - Example rule file
Full Compiled Document
For the complete guide with all rules expanded:
AGENTS.md