Scrollback freeze optimization

From ychampion/cskill-agents · View interactive version

Scrollback freeze optimization is an AI agent skill from the GitHub repository ychampion/cskill-agents. Cache and reuse animated children once they slide into scrollback so terminal resets never occur.

How to use this skill

Skill file

SKILL: Scrollback Freeze Optimization

Domain: terminal-ui

Trigger: Apply whenever you render active widgets that can scroll into terminal history and would otherwise force full-screen updates.

Source Pattern: Distilled from reviewed terminal rendering, layout, animation, and accessibility implementations.

Core Method

Wrap any timer-driven subtree with a viewport-aware container that caches the last visible React element in a ref. When the viewport reports hidden, always return the cached node instead of the live children; React's diffing sees no change and the terminal renderer skips the expensive full-screen redraw.

Key Rules

Example Application

Wrap a spinner in scrollback with the freeze wrapper so once you scroll past it, log-update never touches the spinner subtree even though its timer continues running when visible.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.