install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pproenca/dot-skills/terminal-ui" ~/.claude/skills/comeonoliver-skillshub-terminal-ui && rm -rf "$T"
manifest:
skills/pproenca/dot-skills/terminal-ui/SKILL.mdsource content
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 Writerender-single-write
- Overwrite Content Instead of Clear and Redrawrender-overwrite-dont-clear
- Use Synchronized Output Protocol for Animationsrender-synchronized-output
- Target 60fps for Smooth Animationrender-60fps-baseline
- Update Only Changed Regionsrender-partial-updates
- Defer ANSI Escape Code Generation to Final Outputrender-escape-sequence-batching
2. Input & Keyboard (CRITICAL)
- Use useInput Hook for Keyboard Handlinginput-useinput-hook
- Provide Immediate Visual Feedback for Inputinput-immediate-feedback
- Handle Modifier Keys Correctlyinput-modifier-keys
- Use isActive Option for Focus Managementinput-isactive-focus
- Always Provide Escape Routesinput-escape-routes
3. Component Patterns (HIGH)
- Use Box Component with Flexbox for Layoutstuicomp-box-flexbox
- Use Text Component for All Visible Contenttuicomp-text-styling
- Use measureElement for Dynamic Sizingtuicomp-measure-element
- Use Static Component for Log Outputtuicomp-static-for-logs
- Use Percentage Widths for Responsive Layoutstuicomp-percentage-widths
- Use Border Styles for Visual Structuretuicomp-border-styles
4. State & Lifecycle (HIGH)
- Use useApp Hook for Application Lifecycletuistate-useapp-exit
- Always Clean Up Effects on Unmounttuistate-cleanup-effects
- Use Functional State Updates to Avoid Stale Closurestuistate-functional-updates
- Stabilize Callbacks with useCallbacktuistate-usecallback-stable
- Memoize Expensive Computations with useMemotuistate-usememo-expensive
5. Prompt Design (MEDIUM-HIGH)
- Use Clack group() for Multi-Step Promptsprompt-group-flow
- Validate Input Early with Descriptive Messagesprompt-validation
- Handle Cancellation Gracefully with isCancelprompt-cancellation
- Use Spinner and Tasks for Long Operationsprompt-spinner-tasks
- Build Custom Prompts with @clack/coreprompt-custom-render
6. UX & Feedback (MEDIUM)
- Show Progress for Operations Over 1 Secondux-progress-indicators
- Use Colors Semantically and Consistentlyux-color-semantics
- Write Actionable Error Messagesux-error-messages
- Show Next Steps After Completionux-next-steps
- Use Intro and Outro for Session Framingux-intro-outro
7. Configuration & CLI (MEDIUM)
- Provide Sensible Defaults for All Optionstuicfg-sensible-defaults
- Support Standard Environment Variablestuicfg-env-vars
- Prefer Flags Over Positional Argumentstuicfg-flags-over-args
- Implement Comprehensive Help Systemtuicfg-help-system
- Support Machine-Readable Output Formattuicfg-json-output
8. Robustness & Compatibility (LOW-MEDIUM)
- Detect TTY and Adjust Behavior Accordinglyrobust-tty-detection
- Handle Process Signals Gracefullyrobust-signal-handling
- Use Meaningful Exit Codesrobust-exit-codes
- Always Restore Terminal State on Exitrobust-terminal-restore
- Degrade Gracefully for Limited Terminalsrobust-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