rich-python

Designs and tests Rich terminal output including tables, trees, panels, progress, and live displays.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/schattenspiegel/skill-foundry-skills --skill rich-python-schattenspiegel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rich-python
Source: https://github.com/schattenspiegel/skill-foundry-skills/tree/main/skills/rich-python
Command: npx skills add https://github.com/schattenspiegel/skill-foundry-skills --skill rich-python-schattenspiegel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires rich, and includes references (resource) components.

What problem does it solve? Python terminal output built with Rich often breaks under redirection, narrow widths, markup-like user data, or non-TTY CI environments, and progress or live displays can corrupt output or swallow errors when their lifecycle is unmanaged. ## Core Features & Use Cases - Renderable selection and composition: Maps intents like aligned records, hierarchies, framed summaries, and dashboards to the correct Rich object (Table, Tree, Panel, Syntax, Progress, Live) with explicit anti-patterns. - Markup safety and stream separation: Enforces literal Text handling for untrusted values, stdout/stderr channel classification, and bypassing Rich entirely for machine-readable output such as JSON. - Deterministic testing: Provides a fixed-width, color-disabled Console harness with StringIO for asserting content, ordering, empty states, and absence of ANSI codes. - Use Case: A CLI tool prints job statuses as a Rich table with a progress bar; this Skill guides injecting a shared Console, escaping user-supplied owner names, and writing tests that pass in CI without a TTY. ## Quick Start Ask the assistant to review or write Rich terminal output code, for example to build a table of records with a progress display and tests that run correctly when output is redirected.

Frequently Asked Questions about rich-python

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

FAQPage Schema
How do I test Rich console output in Python?▼

Inject a Console configured with file=StringIO(), a fixed width, color_system=None, and force_terminal=False, then assert on the captured string. Check semantic content, row order, and empty states rather than full snapshots, which are brittle across Rich versions.

How do I render a table of records with Rich?▼

Create a Table with named columns representing stable fields, add one row per record, and print it through a shared Console. Convert values to explicit strings or Text objects and define empty-state, alignment, and overflow behavior.

When should I use Rich Progress versus Live?▼

Use Progress when task completion is the primary state, such as known iterables or multiple tracked tasks. Use Live when the entire view changes, like a dashboard or updating table. Keep one active live display per console and always use a context manager.

Why does Rich markup break with user-supplied text?▼

Rich markup is a parser, so strings containing bracket patterns like [red] are interpreted as style tags. Pass untrusted values as Text instances, use rich.markup.escape before interpolation, or pass markup=False for literal strings.

Should I use Rich for JSON or machine-readable output?▼

No. When a command supports --json or a pipe protocol, bypass Rich on stdout entirely and emit plain serialization. Rich may still render human-facing errors and diagnostics to a stderr-configured console.

Why does Rich progress output look wrong in CI or redirected files?▼

Rich detects non-interactive terminals and disables animated rendering, which is the correct behavior. Do not force terminal or interactive modes into redirected output; accept the plain rendering and emit separate structured logs if a durable audit trail is needed.