[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75W3BN87VVGXJXVAZHRAKZX":3,"skill-same:01M75W3BN87VVGXJXVAZHRAKZX":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M75W3BN87VVGXJXVAZHRAKZX","tui-design-system",null,"Use when designing or building any terminal user interface — choosing a layout paradigm, keybindings\u002Finteraction model, color system, data visualization, or motion. Framework-agnostic universal patterns that work with Ratatui, Ink, Textual, Bubbletea, or any TUI toolkit. For the repo's own pythinker-code TUI, use write-tui instead.","PyModel\u002Fpythinker-code","PyModel","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F316629828?v=4","01M75W0KV82C1WDD31FBA5P1G6","pymodel","01M75W0KVYQADNDDQG70WHT35B",29,"MIT","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftui-design-system\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: tui-design-system\ndescription: Use when designing or building any terminal user interface — choosing a layout paradigm, keybindings\u002Finteraction model, color system, data visualization, or motion. Framework-agnostic universal patterns that work with Ratatui, Ink, Textual, Bubbletea, or any TUI toolkit. For the repo's own pythinker-code TUI, use write-tui instead.\n---\n\n# TUI Design System\n\nUniversal design patterns for building exceptional terminal user interfaces. Framework-agnostic — works with Ratatui, Ink, Textual, Bubbletea, or any TUI toolkit.\n\n> For editing **this repo's** terminal UI (`apps\u002Fpythinker-code\u002Fsrc\u002Ftui`), use the **write-tui** skill instead. This skill is the cross-project design vocabulary.\n\n**Core philosophy:** TUIs earn their power through spatial consistency, keyboard fluency, and information density that respects human attention. Design for the expert's speed without abandoning the beginner's discoverability.\n\n## Design process\n\n```dot\ndigraph tui_design {\n    rankdir=TB;\n    \"What are you building?\" [shape=diamond];\n    \"Select layout paradigm\" -> \"Design interaction model\" -> \"Define visual system\" -> \"Validate against anti-patterns\" -> \"Ship it\";\n    \"What are you building?\" -> \"Select layout paradigm\";\n    \"Ship it\" [shape=doublecircle];\n}\n```\n\n1. Pick a **layout paradigm** from what you're building.\n2. Design the **interaction model** (navigation, keybindings, help, dialogs).\n3. Define the **visual system** (color tiers, semantic slots, hierarchy).\n4. Add **data visualization** and **motion** where they earn their place.\n5. **Validate** against the anti-patterns checklist, then ship.\n\n---\n\n## 1. Layout paradigm selector\n\n| App type | Paradigm | Examples |\n|---|---|---|\n| File manager | Miller Columns | yazi, ranger |\n| Git \u002F DevOps tool | Persistent Multi-Panel | lazygit, lazydocker |\n| System monitor | Widget Dashboard | btop, bottom, oxker |\n| Data browser \u002F K8s | Drill-Down Stack | k9s, diskonaut |\n| SQL \u002F HTTP client | IDE Three-Panel | harlequin, posting |\n| Shell augmentation | Overlay \u002F Popup | atuin, fzf |\n| Log \u002F event viewer | Header + Scrollable List | htop, tig |\n\n### Persistent Multi-Panel\nAll panels visible simultaneously; focus shifts between them. Users build spatial memory — \"branches are always bottom-left.\"\n\n```\n┌─ Status ──┬─────────── Detail ──────────┐\n├─ Files ───┤                             │\n│ > file.rs │  diff content here...       │\n│   main.rs │                             │\n├─ Branches ┤                             │\n│ * main    │                             │\n│   feat\u002Fx  │                             │\n└───────────┴─────────────────────────────┘\n  [q]uit [c]ommit [p]ush [?]help\n```\n**Use for:** multi-faceted tools needing simultaneous context (git clients, container managers, monitoring).\n**Key rule:** panels keep fixed positions across sessions. Never rearrange without user action.\n\n### Miller Columns\nThree-pane past\u002Fpresent\u002Ffuture navigation: parent (left), current (center), preview (right).\n\n```\n┌── Parent ──┬── Current ──┬── Preview ────────┐\n│   ..       │ > config\u002F   │ port: 8080        │\n│   src\u002F     │   lib\u002F      │ host: localhost   │\n│ > config\u002F  │   main.rs   │ log_level: debug  │\n│   tests\u002F   │   mod.rs    │ db_url: postgres  │\n└────────────┴─────────────┴───────────────────┘\n```\n**Use for:** navigating hierarchical data where context above and below matters.\n**Key rule:** selecting in the center shifts everything left; the preview always reflects the highlighted item.\n\n### Drill-Down Stack\nOne level at a time; navigation pushes\u002Fpops levels like a stack. Breadcrumb shows depth.\n\n```\n Context > namespace: prod > pods\n┌─────────────────────────────────────────────┐\n│ NAME              READY   STATUS    AGE       │\n│ > api-7f9c        2\u002F2     Running   3d        │\n│   worker-1a2b     1\u002F1     Running   3d        │\n└─────────────────────────────────────────────┘\n :pods  :deploy  :svc        [Enter] drill [Esc] up\n```\n**Use for:** deep hierarchies where showing all levels at once is impractical (Kubernetes, DB schemas).\n**Key rule:** always show the navigation path as a breadcrumb. Provide a `:resource` command mode for direct jumps.\n\n### Widget Dashboard\nSelf-contained widget panels with independent data. All info visible at once; no navigation required.\n\n```\n┌─── CPU ──────────────┬─── Memory ──────────┐\n│ ▁▂▃▅▇█▇▅▃▂▁▂▃▅▇      │ ████████░░ 78%       │\n│ core0: 45% core1: 67%│ 12.4G \u002F 16.0G        │\n├─── Network ──────────┼─── Disk ─────────────┤\n│ ▲ 1.2 MB\u002Fs ▼ 340KB\u002Fs │ \u002F: 67%  \u002Fhome: 45%   │\n├─── Processes ────────┴──────────────────────┤\n│ PID   USER  CPU%  MEM%  CMD                  │\n│ 1234  root  23.4  4.5   postgres             │\n└──────────────────────────────────────────────┘\n```\n**Use for:** monitoring, real-time status, dashboards.\n**Key rule:** each widget is self-contained with its own title. Use braille\u002Fblock characters for density.\n\n### IDE Three-Panel\nSidebar (left), editor\u002Fmain (center), detail\u002Foutput (bottom). Tab bar along top.\n**Use for:** editing-focused tools (SQL clients, HTTP tools, config editors).\n**Key rule:** sidebar toggles with a single key. Center supports tabs. Bottom panel can expand to full height.\n\n### Overlay \u002F Popup\nTUI appears on demand over the shell, disappears after use.\n**Use for:** shell augmentations (history search, file picker, command palette).\n**Key rule:** configurable height; return the selection to the caller; never disrupt scrollback.\n\n### Header + Scrollable List\nFixed header with meters\u002Fstats, scrollable data below, function bar at bottom.\n**Use for:** single-purpose viewers of one stream (process lists, logs, commit history).\n**Key rule:** header and footer stay pinned; only the middle scrolls.\n\n---\n\n## 2. Responsive layout\n\nTerminals resize constantly. Pick a degradation strategy and test it.\n\n| Strategy | Behavior |\n|---|---|\n| Priority collapse | Less important panels hide first below minimum width |\n| Stacking | Panels collapse to title-only bars; the active one expands (zellij pattern) |\n| Breakpoint modes | Switch layout entirely below a threshold (multi-panel → single panel) |\n| Minimum size gate | Show \"terminal too small\" below a usable minimum |\n\n**Rules:**\n- Define a minimum size (typically **80×24**). Below it, show a resize message.\n- Never crash on resize. Handle SIGWINCH gracefully.\n- Use constraint-based layouts (percentages, min\u002Fmax, ratios) — not absolute positions.\n- Test at **80×24, 120×40, 200×60**.\n\n---\n\n## 3. Interaction model\n\n### Navigation style by complexity\n\n| App complexity | Recommended model |\n|---|---|\n| Single-purpose, \u003C20 actions | Direct keybinding (every key = action) |\n| Multi-view, complex | Vim-style modes + contextual footer |\n| IDE-like, many features | Command palette + tabs + vim motions |\n| Data browser | Drill-down + fuzzy search + `:` command mode |\n\n### Keyboard design layers\n\n| Layer | Keys | Audience | Always shown? |\n|---|---|---|---|\n| L0 Universal | arrows, Enter, Esc, q | Everyone | Yes (footer) |\n| L1 Vim motions | `hjkl \u002F ? : gg G` | Intermediate | Yes (footer) |\n| L2 Actions | single mnemonics: `d`elete, `c`ommit, `p`ush | Regular | On `?` help |\n| L3 Power | composed commands, macros, custom bindings | Power | Docs only |\n\n**Lingua franca (don't deviate):** `j\u002Fk` down\u002Fup · `h\u002Fl` left\u002Fright or collapse\u002Fexpand · `\u002F` search · `?` help · `:` command mode · `q` quit (or Esc back one level) · `Enter` select\u002Fconfirm\u002Fdrill · `Tab` switch focus · `Space` toggle selection · `g\u002FG` top\u002Fbottom.\n\n**Never bind:** `Ctrl+C` (interrupt), `Ctrl+Z` (suspend), `Ctrl+\\` (quit). They belong to the terminal.\n\n### Focus management\n- Only one widget receives input at a time. `Tab`\u002F`Shift+Tab` cycle focus.\n- Focus indicator: highlighted border, color change, or cursor presence. Unfocused panels are dimmed or use thinner borders.\n- Modal dialogs are focus traps — the background receives no events.\n- Nested focus: the outer container routes events to the focused child.\n\n### Search & filtering\nUniversal pattern: press `\u002F`, type, results filter live.\n- `n\u002FN` next\u002Fprevious match · `Esc` dismiss.\n- Fuzzy by default; `'` prefix for exact. Highlight matched characters. Preview updates for the highlighted result.\n\n### Help — three tiers\n\n| Tier | Trigger | Content | Audience |\n|---|---|---|---|\n| Always visible | Footer bar | 3–5 essential shortcuts | Everyone |\n| On demand | `?` | Full keybindings for current context | Regular |\n| Documentation | `--help` \u002F man page | Complete reference | Power |\n\nFooter format: `[q]uit [\u002F]search [?]help [Tab]focus [Enter]select`. Make it context-sensitive — show only what's actionable right now.\n\n### Dialogs & confirmation\n\n| Severity | Pattern |\n|---|---|\n| Reversible | Just do it; brief status-bar confirmation |\n| Moderate (delete file) | Inline \"Press y to confirm\" |\n| Severe (drop database) | Modal requiring the resource name typed in |\n| Irreversible batch | `--dry-run` flag + explicit confirmation |\n\nModals render over a dimmed background. Toasts auto-dismiss in 3–5s. Status-bar messages are vim-style one-liners that auto-fade.\n\n---\n\n## 4. Color design system\n\n### Terminal color tiers — design for graceful degradation\n\n| Tier | Sequence | Colors | Strategy |\n|---|---|---|---|\n| 16 ANSI | `\\033[31m` | 16 (relative) | Foundation; terminal theme controls appearance |\n| 256 | `\\033[38;5;{n}m` | 256 | Extended; fixed colors may clash with themes |\n| True color | `\\033[38;2;{r};{g};{b}m` | 16.7M (absolute) | Full control; needs `COLORTERM=truecolor` |\n\n**Detection order:** `COLORTERM=truecolor|24bit` → true color · `TERM` contains `256color` → 256 · `NO_COLOR` set → no color · else 16 ANSI.\n\n**Golden rule:** the TUI must be usable in 16-color mode. True color *enhances* — it never *creates* the hierarchy.\n\n### Semantic color slots — name by function, not appearance\n\n| Slot | Purpose | Typical dark |\n|---|---|---|\n| `fg.default` | Body text | `#c0caf5` |\n| `fg.muted` | Secondary \u002F metadata | `#565f89` |\n| `fg.emphasis` | Headers, focused | `#e0e0e0` |\n| `bg.base` | Primary background | `#1a1b26` |\n| `bg.surface` | Panel\u002Fwidget bg | `#24283b` |\n| `bg.overlay` | Popup\u002Fdialog bg | `#414868` |\n| `bg.selection` | Selected highlight | `#364a82` |\n| `accent.primary` | Interactive \u002F focus | `#7aa2f7` |\n| `accent.secondary` | Supporting | `#bb9af7` |\n| `status.error` | Errors \u002F deletions | `#f7768e` |\n| `status.warning` | Caution | `#e0af68` |\n| `status.success` | Success \u002F additions | `#9ece6a` |\n| `status.info` | Informational | `#7dcfff` |\n\n**Never hardcode hex in widget code. Always reference a semantic slot.**\n\n### Visual hierarchy techniques\n\n| Technique | Effect | Use for |\n|---|---|---|\n| Bold (SGR 1) | More weight | Headers, labels, active items |\n| Dim (SGR 2) | Less weight | Metadata, timestamps |\n| Italic (SGR 3) | Distinction | Comments, types |\n| Underline (SGR 4) | Actionable | Links, URLs |\n| Reverse (SGR 7) | Swap fg\u002Fbg | Selection (always works!) |\n| Strikethrough (SGR 9) | Negation | Deleted\u002Fdeprecated |\n\n**Recipe:** 80% of content in `fg.default`. Headers `bold + fg.emphasis`. Metadata `dim + fg.muted`. Status in semantic colors. Accents for interactive elements only.\n\n### Background layering\nCreate depth without borders by stepping lightness: `bg.base` → `bg.surface` → `bg.overlay`, each ~5–8% lighter in dark themes. The contrast gradient reads as depth and reduces the need for box-drawing.\n\n### Theme architecture & accessibility\n- Base16 pattern: 8 monotones (background↔foreground gradient) + 8 accents. Ship a dark theme by default, at least one light variant, and respect `NO_COLOR`.\n- **WCAG AA:** 4.5:1 for body text, 3:1 for large text \u002F UI elements.\n- **Never use color alone** — pair with symbols (✓ ✗ ▲), text, position, or typography.\n- Color-blind-safe pairs: blue+orange, blue+yellow, black+white. Avoid red vs green as the only signal.\n- Test: monochrome mode, a color-blindness simulator, 3+ terminal emulators, light and dark.\n\n---\n\n## 5. Data visualization\n\n### Character-resolution building blocks\n\n| Element | Characters | Resolution | Use for |\n|---|---|---|---|\n| Full blocks | `█▉▊▋▌▍▎▏` | 8 steps\u002Fcell | Progress bars, bar charts |\n| Shade blocks | `░▒▓█` | 4 densities | Heatmaps, density plots |\n| Braille | `⠁⠂…⣿` (U+2800–28FF) | 2×4 dots\u002Fcell | High-res line\u002Fscatter |\n| Sparkline | `▁▂▃▄▅▆▇█` | 8 heights | Inline mini-charts |\n\n### Common widgets\n\n| Widget | Pattern | Tips |\n|---|---|---|\n| Progress bar | `[████████░░░░] 67%` | Show % + ETA; gradient green→yellow→red by urgency |\n| Sparkline | `▁▂▃▅▇█▇▅▃▂` | Inline time-series in headers\u002Fstatus bars |\n| Gauge | `CPU [██████████░░] 83%` | Label + bar + value; color by threshold |\n| Table | Sortable, zebra stripes | Numbers right, text left; truncate with `…` |\n| Tree | `├── └── │` guides | Indent 2–4\u002Flevel; expand\u002Fcollapse with Enter |\n| Diff | green `+`, red `-` | Word-level highlight within changed lines |\n| Log | colored level + ts + msg | TRACE dim · DEBUG cyan · INFO default · WARN yellow · ERROR red · FATAL red+bold |\n\n### Spinners\n\n| Context | Spinner | Interval |\n|---|---|---|\n| Default \u002F modern | braille `⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏` | 80ms |\n| Minimal | `-\\|\u002F` | 130ms |\n| Heavy processing | blocks `▖▘▝▗` | 100ms |\n\nSpinners for indeterminate work, progress bars for determinate. Show spinners only after a ~200ms delay so fast operations don't flash.\n\n---\n\n## 6. Animation & motion\n\nFlicker-free rendering, three layers — all required:\n1. **Double buffering** — render to an off-screen buffer, then swap. Never paint directly to the visible screen.\n2. **Diff-based updates** — compute the changed cells and emit only those escape sequences; don't repaint the whole screen each frame.\n3. **Frame budget** — cap at the display rate (15–60 fps is plenty for a TUI). Coalesce rapid state changes into one frame; throttle on resize.\n\nMotion guidelines:\n- Animate to communicate state change (loading, transition, focus move), not for decoration.\n- Keep transitions short (\u003C150ms feel). Anything longer needs a cancel path.\n- Respect reduced-motion preferences and `NO_COLOR`-style restraint — offer a static fallback.\n- Never animate on every keystroke; input must always feel instant.\n\n---\n\n## 7. Validate against anti-patterns\n\nBefore shipping, confirm none of these are true:\n\n- [ ] Crashes or corrupts on resize \u002F below minimum size (no size gate).\n- [ ] Hierarchy depends on true color — unusable in 16-color or `NO_COLOR`.\n- [ ] Information conveyed by color alone (no symbol\u002Ftext\u002Fposition backup).\n- [ ] Body-text contrast below WCAG AA (4.5:1).\n- [ ] Binds `Ctrl+C`, `Ctrl+Z`, or `Ctrl+\\`.\n- [ ] No footer hints and no `?` help — undiscoverable.\n- [ ] Panels rearrange themselves between sessions (broken spatial memory).\n- [ ] Destructive action with no confirmation proportional to severity.\n- [ ] Full-screen repaint every frame (flicker, wasted bandwidth over SSH).\n- [ ] Hardcoded hex\u002FANSI in widget code instead of semantic slots.\n- [ ] Search doesn't filter live, or `Esc` doesn't dismiss it.\n- [ ] Disrupts shell scrollback (for overlay\u002Fpopup tools).\n","# TUI Design System\n\nUniversal design patterns for building exceptional terminal user interfaces. Framework-agnostic — works with Ratatui, Ink, Textual, Bubbletea, or any TUI toolkit.\n\n> For editing **this repo's** terminal UI (`apps\u002Fpythinker-code\u002Fsrc\u002Ftui`), use the **write-tui** skill instead. This skill is the cross-project design vocabulary.\n\n**Core philosophy:** TUIs earn their power through spatial consistency, keyboard fluency, and information density that respects human attention. Design for the expert's speed without abandoning the beginner's discoverability.\n\n## Design process\n\n```dot\ndigraph tui_design {\n    rankdir=TB;\n    \"What are you building?\" [shape=diamond];\n    \"Select layout paradigm\" -> \"Design interaction model\" -> \"Define visual system\" -> \"Validate against anti-patterns\" -> \"Ship it\";\n    \"What are you building?\" -> \"Select layout paradigm\";\n    \"Ship it\" [shape=doublecircle];\n}\n```\n\n1. Pick a **layout paradigm** from what you're building.\n2. Design the **interaction model** (navigation, keybindings, help, dialogs).\n3. Define the **visual system** (color tiers, semantic slots, hierarchy).\n4. Add **data visualization** and **motion** where they earn their place.\n5. **Validate** against the anti-patterns checklist, then ship.\n\n---\n\n## 1. Layout paradigm selector\n\n| App type | Paradigm | Examples |\n|---|---|---|\n| File manager | Miller Columns | yazi, ranger |\n| Git \u002F DevOps tool | Persistent Multi-Panel | lazygit, lazydocker |\n| System monitor | Widget Dashboard | btop, bottom, oxker |\n| Data browser \u002F K8s | Drill-Down Stack | k9s, diskonaut |\n| SQL \u002F HTTP client | IDE Three-Panel | harlequin, posting |\n| Shell augmentation | Overlay \u002F Popup | atuin, fzf |\n| Log \u002F event viewer | Header + Scrollable List | htop, tig |\n\n### Persistent Multi-Panel\nAll panels visible simultaneously; focus shifts between them. Users build spatial memory — \"branches are always bottom-left.\"\n\n```\n┌─ Status ──┬─────────── Detail ──────────┐\n├─ Files ───┤                             │\n│ > file.rs │  diff content here...       │\n│   main.rs │                             │\n├─ Branches ┤                             │\n│ * main    │                             │\n│   feat\u002Fx  │                             │\n└───────────┴─────────────────────────────┘\n  [q]uit [c]ommit [p]ush [?]help\n```\n**Use for:** multi-faceted tools needing simultaneous context (git clients, container managers, monitoring).\n**Key rule:** panels keep fixed positions across sessions. Never rearrange without user action.\n\n### Miller Columns\nThree-pane past\u002Fpresent\u002Ffuture navigation: parent (left), current (center), preview (right).\n\n```\n┌── Parent ──┬── Current ──┬── Preview ────────┐\n│   ..       │ > config\u002F   │ port: 8080        │\n│   src\u002F     │   lib\u002F      │ host: localhost   │\n│ > config\u002F  │   main.rs   │ log_level: debug  │\n│   tests\u002F   │   mod.rs    │ db_url: postgres  │\n└────────────┴─────────────┴───────────────────┘\n```\n**Use for:** navigating hierarchical data where context above and below matters.\n**Key rule:** selecting in the center shifts everything left; the preview always reflects the highlighted item.\n\n### Drill-Down Stack\nOne level at a time; navigation pushes\u002Fpops levels like a stack. Breadcrumb shows depth.\n\n```\n Context > namespace: prod > pods\n┌─────────────────────────────────────────────┐\n│ NAME              READY   STATUS    AGE       │\n│ > api-7f9c        2\u002F2     Running   3d        │\n│   worker-1a2b     1\u002F1     Running   3d        │\n└─────────────────────────────────────────────┘\n :pods  :deploy  :svc        [Enter] drill [Esc] up\n```\n**Use for:** deep hierarchies where showing all levels at once is impractical (Kubernetes, DB schemas).\n**Key rule:** always show the navigation path as a breadcrumb. Provide a `:resource` command mode for direct jumps.\n\n### Widget Dashboard\nSelf-contained widget panels with independent data. All info visible at once; no navigation required.\n\n```\n┌─── CPU ──────────────┬─── Memory ──────────┐\n│ ▁▂▃▅▇█▇▅▃▂▁▂▃▅▇      │ ████████░░ 78%       │\n│ core0: 45% core1: 67%│ 12.4G \u002F 16.0G        │\n├─── Network ──────────┼─── Disk ─────────────┤\n│ ▲ 1.2 MB\u002Fs ▼ 340KB\u002Fs │ \u002F: 67%  \u002Fhome: 45%   │\n├─── Processes ────────┴──────────────────────┤\n│ PID   USER  CPU%  MEM%  CMD                  │\n│ 1234  root  23.4  4.5   postgres             │\n└──────────────────────────────────────────────┘\n```\n**Use for:** monitoring, real-time status, dashboards.\n**Key rule:** each widget is self-contained with its own title. Use braille\u002Fblock characters for density.\n\n### IDE Three-Panel\nSidebar (left), editor\u002Fmain (center), detail\u002Foutput (bottom). Tab bar along top.\n**Use for:** editing-focused tools (SQL clients, HTTP tools, config editors).\n**Key rule:** sidebar toggles with a single key. Center supports tabs. Bottom panel can expand to full height.\n\n### Overlay \u002F Popup\nTUI appears on demand over the shell, disappears after use.\n**Use for:** shell augmentations (history search, file picker, command palette).\n**Key rule:** configurable height; return the selection to the caller; never disrupt scrollback.\n\n### Header + Scrollable List\nFixed header with meters\u002Fstats, scrollable data below, function bar at bottom.\n**Use for:** single-purpose viewers of one stream (process lists, logs, commit history).\n**Key rule:** header and footer stay pinned; only the middle scrolls.\n\n---\n\n## 2. Responsive layout\n\nTerminals resize constantly. Pick a degradation strategy and test it.\n\n| Strategy | Behavior |\n|---|---|\n| Priority collapse | Less important panels hide first below minimum width |\n| Stacking | Panels collapse to title-only bars; the active one expands (zellij pattern) |\n| Breakpoint modes | Switch layout entirely below a threshold (multi-panel → single panel) |\n| Minimum size gate | Show \"terminal too small\" below a usable minimum |\n\n**Rules:**\n- Define a minimum size (typically **80×24**). Below it, show a resize message.\n- Never crash on resize. Handle SIGWINCH gracefully.\n- Use constraint-based layouts (percentages, min\u002Fmax, ratios) — not absolute positions.\n- Test at **80×24, 120×40, 200×60**.\n\n---\n\n## 3. Interaction model\n\n### Navigation style by complexity\n\n| App complexity | Recommended model |\n|---|---|\n| Single-purpose, \u003C20 actions | Direct keybinding (every key = action) |\n| Multi-view, complex | Vim-style modes + contextual footer |\n| IDE-like, many features | Command palette + tabs + vim motions |\n| Data browser | Drill-down + fuzzy search + `:` command mode |\n\n### Keyboard design layers\n\n| Layer | Keys | Audience | Always shown? |\n|---|---|---|---|\n| L0 Universal | arrows, Enter, Esc, q | Everyone | Yes (footer) |\n| L1 Vim motions | `hjkl \u002F ? : gg G` | Intermediate | Yes (footer) |\n| L2 Actions | single mnemonics: `d`elete, `c`ommit, `p`ush | Regular | On `?` help |\n| L3 Power | composed commands, macros, custom bindings | Power | Docs only |\n\n**Lingua franca (don't deviate):** `j\u002Fk` down\u002Fup · `h\u002Fl` left\u002Fright or collapse\u002Fexpand · `\u002F` search · `?` help · `:` command mode · `q` quit (or Esc back one level) · `Enter` select\u002Fconfirm\u002Fdrill · `Tab` switch focus · `Space` toggle selection · `g\u002FG` top\u002Fbottom.\n\n**Never bind:** `Ctrl+C` (interrupt), `Ctrl+Z` (suspend), `Ctrl+\\` (quit). They belong to the terminal.\n\n### Focus management\n- Only one widget receives input at a time. `Tab`\u002F`Shift+Tab` cycle focus.\n- Focus indicator: highlighted border, color change, or cursor presence. Unfocused panels are dimmed or use thinner borders.\n- Modal dialogs are focus traps — the background receives no events.\n- Nested focus: the outer container routes events to the focused child.\n\n### Search & filtering\nUniversal pattern: press `\u002F`, type, results filter live.\n- `n\u002FN` next\u002Fprevious match · `Esc` dismiss.\n- Fuzzy by default; `'` prefix for exact. Highlight matched characters. Preview updates for the highlighted result.\n\n### Help — three tiers\n\n| Tier | Trigger | Content | Audience |\n|---|---|---|---|\n| Always visible | Footer bar | 3–5 essential shortcuts | Everyone |\n| On demand | `?` | Full keybindings for current context | Regular |\n| Documentation | `--help` \u002F man page | Complete reference | Power |\n\nFooter format: `[q]uit [\u002F]search [?]help [Tab]focus [Enter]select`. Make it context-sensitive — show only what's actionable right now.\n\n### Dialogs & confirmation\n\n| Severity | Pattern |\n|---|---|\n| Reversible | Just do it; brief status-bar confirmation |\n| Moderate (delete file) | Inline \"Press y to confirm\" |\n| Severe (drop database) | Modal requiring the resource name typed in |\n| Irreversible batch | `--dry-run` flag + explicit confirmation |\n\nModals render over a dimmed background. Toasts auto-dismiss in 3–5s. Status-bar messages are vim-style one-liners that auto-fade.\n\n---\n\n## 4. Color design system\n\n### Terminal color tiers — design for graceful degradation\n\n| Tier | Sequence | Colors | Strategy |\n|---|---|---|---|\n| 16 ANSI | `\\033[31m` | 16 (relative) | Foundation; terminal theme controls appearance |\n| 256 | `\\033[38;5;{n}m` | 256 | Extended; fixed colors may clash with themes |\n| True color | `\\033[38;2;{r};{g};{b}m` | 16.7M (absolute) | Full control; needs `COLORTERM=truecolor` |\n\n**Detection order:** `COLORTERM=truecolor|24bit` → true color · `TERM` contains `256color` → 256 · `NO_COLOR` set → no color · else 16 ANSI.\n\n**Golden rule:** the TUI must be usable in 16-color mode. True color *enhances* — it never *creates* the hierarchy.\n\n### Semantic color slots — name by function, not appearance\n\n| Slot | Purpose | Typical dark |\n|---|---|---|\n| `fg.default` | Body text | `#c0caf5` |\n| `fg.muted` | Secondary \u002F metadata | `#565f89` |\n| `fg.emphasis` | Headers, focused | `#e0e0e0` |\n| `bg.base` | Primary background | `#1a1b26` |\n| `bg.surface` | Panel\u002Fwidget bg | `#24283b` |\n| `bg.overlay` | Popup\u002Fdialog bg | `#414868` |\n| `bg.selection` | Selected highlight | `#364a82` |\n| `accent.primary` | Interactive \u002F focus | `#7aa2f7` |\n| `accent.secondary` | Supporting | `#bb9af7` |\n| `status.error` | Errors \u002F deletions | `#f7768e` |\n| `status.warning` | Caution | `#e0af68` |\n| `status.success` | Success \u002F additions | `#9ece6a` |\n| `status.info` | Informational | `#7dcfff` |\n\n**Never hardcode hex in widget code. Always reference a semantic slot.**\n\n### Visual hierarchy techniques\n\n| Technique | Effect | Use for |\n|---|---|---|\n| Bold (SGR 1) | More weight | Headers, labels, active items |\n| Dim (SGR 2) | Less weight | Metadata, timestamps |\n| Italic (SGR 3) | Distinction | Comments, types |\n| Underline (SGR 4) | Actionable | Links, URLs |\n| Reverse (SGR 7) | Swap fg\u002Fbg | Selection (always works!) |\n| Strikethrough (SGR 9) | Negation | Deleted\u002Fdeprecated |\n\n**Recipe:** 80% of content in `fg.default`. Headers `bold + fg.emphasis`. Metadata `dim + fg.muted`. Status in semantic colors. Accents for interactive elements only.\n\n### Background layering\nCreate depth without borders by stepping lightness: `bg.base` → `bg.surface` → `bg.overlay`, each ~5–8% lighter in dark themes. The contrast gradient reads as depth and reduces the need for box-drawing.\n\n### Theme architecture & accessibility\n- Base16 pattern: 8 monotones (background↔foreground gradient) + 8 accents. Ship a dark theme by default, at least one light variant, and respect `NO_COLOR`.\n- **WCAG AA:** 4.5:1 for body text, 3:1 for large text \u002F UI elements.\n- **Never use color alone** — pair with symbols (✓ ✗ ▲), text, position, or typography.\n- Color-blind-safe pairs: blue+orange, blue+yellow, black+white. Avoid red vs green as the only signal.\n- Test: monochrome mode, a color-blindness simulator, 3+ terminal emulators, light and dark.\n\n---\n\n## 5. Data visualization\n\n### Character-resolution building blocks\n\n| Element | Characters | Resolution | Use for |\n|---|---|---|---|\n| Full blocks | `█▉▊▋▌▍▎▏` | 8 steps\u002Fcell | Progress bars, bar charts |\n| Shade blocks | `░▒▓█` | 4 densities | Heatmaps, density plots |\n| Braille | `⠁⠂…⣿` (U+2800–28FF) | 2×4 dots\u002Fcell | High-res line\u002Fscatter |\n| Sparkline | `▁▂▃▄▅▆▇█` | 8 heights | Inline mini-charts |\n\n### Common widgets\n\n| Widget | Pattern | Tips |\n|---|---|---|\n| Progress bar | `[████████░░░░] 67%` | Show % + ETA; gradient green→yellow→red by urgency |\n| Sparkline | `▁▂▃▅▇█▇▅▃▂` | Inline time-series in headers\u002Fstatus bars |\n| Gauge | `CPU [██████████░░] 83%` | Label + bar + value; color by threshold |\n| Table | Sortable, zebra stripes | Numbers right, text left; truncate with `…` |\n| Tree | `├── └── │` guides | Indent 2–4\u002Flevel; expand\u002Fcollapse with Enter |\n| Diff | green `+`, red `-` | Word-level highlight within changed lines |\n| Log | colored level + ts + msg | TRACE dim · DEBUG cyan · INFO default · WARN yellow · ERROR red · FATAL red+bold |\n\n### Spinners\n\n| Context | Spinner | Interval |\n|---|---|---|\n| Default \u002F modern | braille `⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏` | 80ms |\n| Minimal | `-\\|\u002F` | 130ms |\n| Heavy processing | blocks `▖▘▝▗` | 100ms |\n\nSpinners for indeterminate work, progress bars for determinate. Show spinners only after a ~200ms delay so fast operations don't flash.\n\n---\n\n## 6. Animation & motion\n\nFlicker-free rendering, three layers — all required:\n1. **Double buffering** — render to an off-screen buffer, then swap. Never paint directly to the visible screen.\n2. **Diff-based updates** — compute the changed cells and emit only those escape sequences; don't repaint the whole screen each frame.\n3. **Frame budget** — cap at the display rate (15–60 fps is plenty for a TUI). Coalesce rapid state changes into one frame; throttle on resize.\n\nMotion guidelines:\n- Animate to communicate state change (loading, transition, focus move), not for decoration.\n- Keep transitions short (\u003C150ms feel). Anything longer needs a cancel path.\n- Respect reduced-motion preferences and `NO_COLOR`-style restraint — offer a static fallback.\n- Never animate on every keystroke; input must always feel instant.\n\n---\n\n## 7. Validate against anti-patterns\n\nBefore shipping, confirm none of these are true:\n\n- [ ] Crashes or corrupts on resize \u002F below minimum size (no size gate).\n- [ ] Hierarchy depends on true color — unusable in 16-color or `NO_COLOR`.\n- [ ] Information conveyed by color alone (no symbol\u002Ftext\u002Fposition backup).\n- [ ] Body-text contrast below WCAG AA (4.5:1).\n- [ ] Binds `Ctrl+C`, `Ctrl+Z`, or `Ctrl+\\`.\n- [ ] No footer hints and no `?` help — undiscoverable.\n- [ ] Panels rearrange themselves between sessions (broken spatial memory).\n- [ ] Destructive action with no confirmation proportional to severity.\n- [ ] Full-screen repaint every frame (flicker, wasted bandwidth over SSH).\n- [ ] Hardcoded hex\u002FANSI in widget code instead of semantic slots.\n- [ ] Search doesn't filter live, or `Esc` doesn't dismiss it.\n- [ ] Disrupts shell scrollback (for overlay\u002Fpopup tools).\n",{"name":5,"description":7},"main","21e9d44fdaaca8c4f9214e5cc65f6a470cde9150",".agents\u002Fskills\u002Ftui-design-system",9,"https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code","https:\u002F\u002Fpythinker.com","https:\u002F\u002Fgithub.com\u002FPyModel","https:\u002F\u002Fpymodel.com","AI, LLM, and machine learning solutions. Think first, then code.","2026-11-14 19:27:49",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add PyModel\u002Fpythinker-code --skill tui-design-system",{"tool":40,"command":41},"bunx","bunx skills add PyModel\u002Fpythinker-code --skill tui-design-system",{"tool":43,"command":44},"pnpm","pnpm dlx skills add PyModel\u002Fpythinker-code --skill tui-design-system","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftui-design-system\u002FSKILL.md",true,[],[49,56,63,69,76,83],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M75W4KT7SF7713RMC0AW447N","pythinker-webbridge","Pythinker Browser Extension lets AI control the user's real browser — navigate, click, type, read, screenshot, and interact with any website using the user's actual login sessions. Use this skill whenever the user wants to interact with websites, automate browser tasks, scrape web content, or perform any action requiring a real browser. Also use when the user mentions \"browser\", \"webpage\", \"open URL\", \"screenshot\", or asks to read\u002Finteract with any website. Use even for simple-sounding browser requests — the daemon handles all complexity.","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002Fplugins\u002Fofficial\u002Fpythinker-webbridge\u002Fskills\u002Fpythinker-webbridge\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M75W4JD3116MVVZM0DPRFNG2","golden-skill","Golden fixture skill","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002Fpackages\u002Fmigration-legacy\u002Ftest\u002Ffixtures\u002Fgolden\u002F.pythinker\u002Fskills\u002Fgolden-skill\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M75W4D9XE0YP7GYTY7X9Y020","tools","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002Fpackages\u002Fagent-core-v2\u002Fsrc\u002Ffeatures\u002Fskill\u002Ftools\u002Fskill.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M75W44KYZ87VVKCFBR1MPX40","review","Analyze the available skill set and recommend candidate groups that could be consolidated into sub-skill bundles. Read-only — proposes a plan, does not move files.","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002Fpackages\u002Fagent-core-v2\u002Fsrc\u002Ffeatures\u002Fskill\u002Fcatalog\u002Fbuiltin\u002Fsub-skill\u002Freview\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M75W3V96RQ8N2E1DJB9A20PR","consolidate","Apply an approved sub-skill grouping by moving user-specified skills into a parent bundle, with timestamped backups of every modified directory.","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002Fpackages\u002Fagent-core-v2\u002Fsrc\u002Ffeatures\u002Fskill\u002Fcatalog\u002Fbuiltin\u002Fsub-skill\u002Fconsolidate\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M75W3S1NEJ5N05CDYS292QQG","sub-skill","Discover and reorganize the skill inventory into hierarchical sub-skill bundles. Use when the user asks to review, group, or consolidate skills into a parent bundle.","https:\u002F\u002Fgithub.com\u002FPyModel\u002Fpythinker-code\u002Fblob\u002Fmain\u002Fpackages\u002Fagent-core-v2\u002Fsrc\u002Ffeatures\u002Fskill\u002Fcatalog\u002Fbuiltin\u002Fsub-skill\u002FSKILL.md",[],[]]