textual-screenshot

Capture Textual terminal UI states as SVG screenshots using the headless test harness.

28.8k|4.0k|Updated Jul 27, 2025
One-click install
npx skills add https://github.com/langchain-ai/deepagents --skill textual-screenshot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: textual-screenshot
Source: https://github.com/langchain-ai/deepagents/tree/main/.agents/skills/textual-screenshot
Command: npx skills add https://github.com/langchain-ai/deepagents --skill textual-screenshot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires textual.

What problem does it solve?

Capturing a screenshot of a terminal-based UI normally requires a desktop environment, browser automation, or OS-level screen capture tools. This Skill renders a Textual application headlessly, drives it to a specific UI state, and saves the composed terminal as an SVG file.

Core Features & Use Cases

  • Headless TUI Capture: Runs a Textual App with run_test(size=(columns, rows)) and saves the visible state via app.save_screenshot() as SVG.
  • Deterministic State Control: Uses pilot.pause() and pilot.press(...) to reach and settle a target screen, modal, or widget before capturing.
  • Safe Isolation for deepagents-code: Sets DEEPAGENTS_HOME to a temporary directory and mocks _post_paint_init to prevent startup side effects when previewing the dcode TUI.
  • Use Case: A developer needs to visually verify how the /model modal looks in deepagents-code without launching a real terminal session; the Skill produces an SVG preview of that exact state.

Quick Start

Ask the agent to capture an SVG screenshot of the deepagents-code TUI showing the /model modal at 110x36 terminal size.

Frequently Asked Questions about textual-screenshot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I take a screenshot of a Textual app without a display?

Use Textual's headless test harness: start the app with app.run_test(size=(columns, rows)), drive it to the desired state with pilot actions, then call app.save_screenshot() with an .svg path. No desktop or browser is required.

How to capture a specific modal or screen in a Textual TUI?

Drive the app to that state using pilot.press(...) or direct app methods, then call await pilot.pause() so transitions settle before saving. Capture with app.save_screenshot() while the target state is visible.

Can I screenshot the deepagents-code dcode terminal UI?

Yes. Set DEEPAGENTS_HOME to a temporary directory before importing deepagents_code, construct DeepAgentsApp with a mocked agent, and mock _post_paint_init to isolate startup side effects. Then use run_test and save_screenshot as with any Textual app.

Why is my Textual screenshot blank or showing the wrong state?

Workers, animations, and modal transitions may not have settled. Add another await pilot.pause() after each state-changing action instead of arbitrary sleeps, and verify the target state is visible before calling save_screenshot.

What are the limitations of Textual SVG screenshots?

An SVG screenshot only proves visual appearance, not that interaction works; use normal Textual tests for behavior. Also avoid hand-editing the SVG and never capture secrets or private user data in the rendered state.