prototype
MAmattpocock/skills337k4,978 new stars in the last 7 days
Also available at https://sacred.computer/llm/skills/port-sacred-terminal-ui-to-typescript-cli/SKILL.md
Take a React Window*.tsx (or any sacred component) and produce a terminal CLI screen written in TypeScript that uses Simulacrum — the sacred CLI framework in scripts/cli/lib/.
See
components/AGENTS.mdfor the canonical catalog of every sacred React component (props, theming tokens, CLI primitive equivalent). Read it before identifying which React surface you are porting from.
Use this skill whenever you want a CLI version of an existing sacred React surface. Sacred ships a small zero-dependency layout framework that maps <Card>, <SimpleTable>, and <ActionButton> concepts onto CLI primitives. Preserve data and layout intent while adapting to terminal widths and input. Browser rendering and terminal output are not byte-identical; CLI ports are static.
A single .ts file under scripts/cli/templates/ that:
tsx as a shebang or npm run cli:typescript as the entry point.import { ... } from '../lib/card').createApp({ build }).start() with a build(page, innerW, selectedRow) function that returns string[].Read these files before starting:
scripts/cli/templates/template.ts — canonical example (run with npm run cli:typescript)scripts/cli/lib/ansi.ts — ANSI escapes, hex helpers, padding, gradient textscripts/cli/lib/window.ts — window frame (margin + window bg + shadow)scripts/cli/lib/card.ts — box-drawing card borders and word-wrapscripts/cli/lib/table.ts — formatRow, kvTable, kvTableGradient, ColSpec typescripts/cli/lib/button.ts — button, buttonRowscripts/cli/lib/app.ts — lifecycle: alt screen, raw mode, resize, paging, selectionscripts/cli/colors.json — sacred-themed color palette (single source of truth)| React surface | CLI primitive | Notes |
|---|---|---|
<Card title="T"> | cardTop('T', innerW) + cardBot(innerW) | Top + bottom borders |
Content <div> inside <Card> | cardRow(text, innerW) | 2ch left indent, padded to inner width |
| Key-value pair with gradient styling | kvTableGradient([[k, v]]) | 24ch key column, gradient on value |
<thead><tr><td> | cardHeaderRow(formatRow(TH, COL_SPEC, innerW), innerW) | #585858 background |
<tbody><tr><td> | cardRow(formatRow(row, COL_SPEC, innerW), innerW) | Per-cell alignment, status coloring |
styles.statusOk/statusOff | colSpec: { status: true } | ACTIVE/OPEN/APPROVED → bold green; CLOSED/PAID/SUSPENDED → gray |
<ActionButton hotkey="ESC"> | button('ESC', 'exit') | Hotkey + label background pair |
<RowSpaceBetween> | buttonRow(left, right, innerW) | Left + right justify with windowBg gap |
| Word-wrapped paragraph | wordWrap(text, innerW - 6) | Card padding is 3ch each side |
Animated <ASCIICanvas> header | omit | Sacred CLI ports are static; the React side keeps the animation |
type ColSpec = {
width: number;
align?: 'left' | 'right';
grow?: boolean;
status?: boolean;
gap?: number;
};
<ASCIICanvas> (CLI is static).const arrays at the top of your TS file. If the React component already imports JSON, share the same JSON.<table>. Mark a single column with grow: true.build(page, innerW, selectedRow). Push cardTop → rows → cardBot for each section. Append buttonRow(...) last.npm run cli:typescript. Verify margins, shadow, and inner padding match the React component.interactive: { count, onSelect, persist: true } to createApp and use cardSelectRow(content, innerW, i === selectedRow).totalPages: N (or () => N) and slice your data by page inside build.#!/usr/bin/env -S npx tsx.//NOTE(jimmylee): ... and explain why.UPPER_SNAKE_CASE.2026-04-08T09:00:00).$18,920.50).scripts/cli/colors.json via the framework.After writing the file:
npm test # JS framework + Python parity suite (chained)
npm run cli:typescript # your screen renders, ESC quits cleanly
If npm test fails, the framework is broken — fix it before continuing. If your screen flickers on resize, you forgot to wrap content in cardRow/cardSelectRow (the framework relies on padded rows for the in-place redraw).
If a JS module changes the bytes coming out of any primitive, the parity test in scripts/python/sacred_cli/__tests__/test_parity.py will fail until the Python mirror under scripts/python/sacred_cli/ is updated to match. Port the change to both runtimes in the same PR — see skills/port-sacred-terminal-ui-to-python/SKILL.md § "Verifying parity".
MAmattpocock/skills337k4,978 new stars in the last 7 days
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
FIfirecrawl/firecrawl215k5,595 new stars in the last 7 days
Apply color and font themes to slides, docs and web pages, with 10 built-in themes.
ANanthropics/skills203k3,265 new stars in the last 7 days
Set visual direction and typography for UI, avoiding templated defaults.
ANanthropics/skills203k3,265 new stars in the last 7 days
Build complex HTML artifacts with React, Tailwind CSS, state management and routing.
ANanthropics/skills203k3,265 new stars in the last 7 days