Scrollback freeze optimization
Skill vishuwa2004/cskill-agents/skills/scrollback-freeze-optimization
Cache and reuse animated children once they slide into scrollback so terminal resets never occur.From its SKILL.md
npx -y skills add vishuwa2004/cskill-agents --skill scrollback-freeze-optimizationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
1.8 KB, 324 tokens by cl100k_base, as published. Nobody here has run it
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
- Use viewport visibility for the specific widget you are freezing and keep an explicit reference to the last rendered children.
- Only update the cache while the element is visible; otherwise return the cached subtree so React can reuse the same reference.
- Disable memoization on the freeze wrapper (explicit
'use no memo') so React doesn't bail out before the cached reference is read. - Keep the cached node simple so it can be safely reused after long pauses and still produce the correct layout.
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)
- Let the spinner still re-render while offscreen, which triggers repeated full-screen resets.
- Put the cache update inside a memoized component that never reads the cached ref.
- Assume scrollback nodes can simply be hidden with CSS; the terminal renderer still re-renders them.
What ships with it: 1 file
818 B alongside SKILL.md
- skill.yaml818 B