Skip to content
Skills Library
Programming · Building & coding

rendering-layout-performance

/rendering-layout-performance

This skill should be used when the user asks to implement, optimize, debug, or review TUI rendering, layout, repainting, flicker, frame buffers, diff rendering, terminal resize behavior, alternate screen lifecycle, scrollback, viewports, tables, dashboards, progress displays, or performance over SSH/tmux. PROACTIVELY activate for: rendering performance, layout bugs, flicker, alternate screen cleanup, resize handling, terminal dashboards, frame pacing, virtual DOM/cell buffers, double buffering, dirty regions, scroll regions, long-running tasks, and high-frequency updates. Provides: render-loop

Licence
MIT
Last repository change
18.06.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 18.06.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

This skill should be used when the user asks to implement, optimize, debug, or review TUI rendering, layout, repainting, flicker, frame buffers, diff rendering, terminal resize behavior, alternate screen lifecycle, scrollback, viewports, tables, dashboards, progress displays, or performance over SSH/tmux. PROACTIVELY activate for: rendering performance, layout bugs, flicker, alternate screen cleanup, resize handling, terminal dashboards, frame pacing, virtual DOM/cell buffers, double buffering, dirty regions, scroll regions, long-running tasks, and high-frequency updates. Provides: render-loop

Original author description

This skill should be used when the user asks to implement, optimize, debug, or review TUI rendering, layout, repainting, flicker, frame buffers, diff rendering, terminal resize behavior, alternate screen lifecycle, scrollback, viewports, tables, dashboards, progress displays, or performance over SSH/tmux. PROACTIVELY activate for: rendering performance, layout bugs, flicker, alternate screen cleanup, resize handling, terminal dashboards, frame pacing, virtual DOM/cell buffers, double buffering, dirty regions, scroll regions, long-running tasks, and high-frequency updates. Provides: render-loop

How it works

  1. Rendering principles
  2. Layout rules
  3. Alternate screen lifecycle
  4. Performance checklist
  5. Failure modes
  6. Reference files
Original SKILL.md headings · 60 lines, 450 words
SKILL.md preview
---
name: rendering-layout-performance
description: |
  This skill should be used when the user asks to implement, optimize, debug, or review TUI rendering, layout, repainting, flicker, frame buffers, diff rendering, terminal resize behavior, alternate screen lifecycle, scrollback, viewports, tables, dashboards, progress displays, or performance over SSH/tmux. PROACTIVELY activate for: rendering performance, layout bugs, flicker, alternate screen cleanup, resize handling, terminal dashboards, frame pacing, virtual DOM/cell buffers, double buffering, dirty regions, scroll regions, long-running tasks, and high-frequency updates. Provides: render-loop rules, layout patterns, performance budgets, lifecycle cleanup checks, and failure triage.
---

# TUI Rendering, Layout, Performance, and Alternate Screen Lifecycle

Use this skill when a TUI draws incorrectly, flickers, wastes CPU, mishandles resize, corrupts scrollback, or needs a robust rendering architecture.

## Rendering principles

1. **Render from state.** The view should be a pure projection of current state and terminal dimensions.
2. **Batch writes.** Build a frame, diff or queue updates, then flush once. Avoid many small writes.
3. **Minimize terminal control churn.** Repeated style resets, cursor moves, and full clears are expensive and visible over remote links.
4. **Throttle high-frequency sources.** Coalesce logs, metrics, mouse motion, resize storms, and progress updates.
5. **Define frame ownership.** A full-screen renderer owns the screen while active; background output goes elsewhere.

## Layout rules

- Compute layout from `width` and `height` every frame or on every resize event.
- Establish minimum usable dimensions and render a clear small-screen message below that threshold.
- Prefer constraints, flex, grid, splits, or framework layout primitives over magic coordinates.
- Keep focus, selection, viewport offset, and cursor position in UI state.
- Test narrow, wide, tall, tiny, and odd terminal sizes.

## Alternate screen lifecycle

Use alternate screen for full-screen apps when users should return to the original scrollback after exit. Do not use it for simple output where command results should remain visible.

Cleanup must restore:

- Alternate screen.
- Raw/cbreak mode.
- Mouse tracking.
- Bracketed paste.
- Focus and extended keyboard modes.
- Cursor visibility and style.
- Terminal title or palette changes if modified.

## Performance checklist

- UI loop does not block on network, disk, child processes, or API calls.
- Long operations publish progress through messages/channels/tasks.
- Render rate is capped to useful human perception, especially for dashboards.
- Resize events are coalesced before expensive recalculation.
- Tables and lists virtualize or page large datasets.
- Logging does not write to stdout/stderr while the TUI owns the screen.
- Remote terminals and SSH latency are part of testing if supported.

## Failure modes

| Symptom | Likely cause | Fix |
|--|--|--|
| Flicker | clearing entire screen or flushing repeatedly | diff/batch writes, avoid full clears |
| High CPU while idle | unconditional redraw loop | render on events or capped tick |
| Corrupted shell after crash | missing cleanup on panic/exception | central terminal guard and finally/defer/drop cleanup |
| Layout overlap | absolute coordinates or stale dimensions | recompute constraints after resize |
| Logs appear inside UI | stdout/stderr logging while alternate screen active | file sink, in-app log panel, or buffered logs |

## Reference files

- `references/render-loop-patterns.md` - Frame buffers, dirty regions, throttling, and event loops.
- `references/alternate-screen-lifecycle.md` - Setup/teardown checklist and crash recovery.
Files in this package (3)
  • SKILL.md 4 KB
  • references/alternate-screen-lifecycle.md 1 KB
  • references/render-loop-patterns.md 10 KB

Versions

The database has no other skills named rendering-layout-performance.

Database snapshot: 13.11.2026 · package version b44327e86354 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100tui-troubleshooting
    Use this skill when a terminal UI freezes, hangs, shows a blank screen, corrupts terminal state, leaves raw mode stuck, stops responding to input, garbles output, breaks colors/cursor state, fails over SSH/tmux/screen, behaves differently on Windows/ConPTY, or needs deep…
  • 100sharpconsoleui
    Use SharpConsoleUI to build full terminal (TUI) applications in .NET — equally suited to full-screen single-window apps and multi-window desktops with overlapping draggable windows — using a compositor, a DOM layout engine, and 40+ reactive controls (data tables, tree views,…
  • 90platform-compatibility
    This skill should be used when the user asks about terminal emulator compatibility, operating-system differences, tmux/screen/Zellij, SSH/remote terminals, Windows ConPTY/classic console/Windows Terminal, Unix PTYs, macOS Terminal/iTerm2, Kitty/Alacritty/WezTerm/foot/GNOME…
  • 100tui-debug-in-pane
    Use when you need to reproduce or debug TUI rendering issues (garbled output, broken streaming, layout corruption) by running ralph in a tmux split pane and capturing live output.
  • 95tmux-cli-test
    Test interactive CLI and TUI behavior in a terminal using tmux. Use for keyboard navigation, prompts, redraws, or terminal-dependent behavior; ordinary command output and exit-code checks can run directly.
  • 90nextjs-performance
    Audit and optimize Next.js application performance when the user asks about Next.js performance, caching, or rendering strategies

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.