Write tui

From PyModel/pythinker-code · View interactive version

Write tui is an AI agent skill from the GitHub repository PyModel/pythinker-code. Use when writing or modifying the pythinker-code terminal UI in apps/pythinker-code/src/tui — components, dialogs/selectors, slash commands, themes, streaming render, or the PythinkerTUI controllers. Covers the architecture, where new features go, test placement, the theme system mechanics, and the

How to use this skill

Skill file

Write TUI (apps/pythinker-code)

The terminal UI lives in apps/pythinker-code/src/tui. Before writing TUI code, read apps/pythinker-code/AGENTS.md for the always-on map, module boundaries, and hard constraints (printable-key decoding, no chalk named colors, etc.). This skill is the how-to: architecture orientation, feature routing, test placement, theme mechanics, and the dialog spec.

For any list dialog, selector, input box, or status/toggle list, the interaction and visual rules are normative — see DESIGN.md in this folder and follow its self-check list before submitting.

Architecture

PythinkerTUI is a coordinator that wires state, layout, session, and dialogs together and delegates heavy logic to controllers.

When a controller or PythinkerTUI section keeps growing, split pure functions, state projections, and presentation components into the matching directory rather than expanding the file.

Where new features go

The feature type decides the landing spot:

Test placement

Theme system mechanics

Themes are managed centrally under src/tui/theme/:

Keep the color-token set in sync. ColorPalette in colors.ts is the source of truth for color tokens. When you add, rename, or remove one, update its mirrors in the same change: the custom-theme JSON schema (apps/pythinker-code/src/tui/theme/theme-schema.json), the token table in the custom-theme docs (docs/customization/themes.md), and the token table in the custom-theme built-in skill (packages/agent-core/src/skill/builtin/custom-theme.md).

Apply / switch flow:

The hard color rules (no chalk named colors, contrast ratios, no module-top-level cached styled functions, add a ColorPalette token before inventing a color) are normative and guard-enforced — they live in apps/pythinker-code/AGENTS.md. This skill only covers the mechanics.

Before you submit

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.