Skip to content

Commit 8aa5c8a

Browse files
Merge pull request #3 from programmersd21/work/skill-quality-and-evals
Refine Ratatui skill guidance and evaluation integrity
2 parents 5f15c43 + 431b2d3 commit 8aa5c8a

40 files changed

Lines changed: 2143 additions & 785 deletions

‎.github/workflows/betamax.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Betamax
2+
3+
on:
4+
pull_request:
5+
6+
permissions: {}
7+
8+
concurrency:
9+
group: betamax-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
render:
14+
runs-on: ubuntu-24.04
15+
timeout-minutes: 15
16+
permissions:
17+
contents: read
18+
env:
19+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
20+
steps:
21+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
22+
with:
23+
persist-credentials: false
24+
25+
- uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
26+
with:
27+
toolchain: stable
28+
29+
- name: Build dirview
30+
run: cargo build --manifest-path skills/ratatui/templates/dirview/Cargo.toml
31+
32+
- name: Run terminal interaction tape
33+
uses: joshka/betamax-action@bc6fa6bfb5e20dd342b588601f4e1a945661d5fe
34+
with:
35+
tapes: tapes/**/*.tape
36+
formats: gif,png
37+
extra-outputs: target/betamax/dirview-*.png
38+
39+
- name: Upload terminal state checkpoints
40+
if: always()
41+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
42+
with:
43+
name: betamax-terminal-checkpoints
44+
path: target/betamax/*.json
45+
if-no-files-found: warn
46+

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ jobs:
8989
run: bash -n skills/ratatui/scripts/*.sh
9090
- name: python syntax
9191
run: python3 -m py_compile skills/ratatui/scripts/pty-smoke.py
92+
- name: lint scanner regression tests
93+
run: python3 -m unittest discover -s skills/ratatui/scripts -p 'test_*.py'
9294
- name: crate-versions smoke
9395
run: skills/ratatui/scripts/crate-versions.sh ratatui | grep -q 'ratatui'
9496

‎AGENTS.md‎

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,25 @@
1-
# Building ratatui apps
1+
# Building Ratatui applications
22

3-
For any Rust terminal UI task, follow `skills/ratatui/SKILL.md`. It is the
4-
full process; this file is the short version for agents that read `AGENTS.md`
5-
instead of loading skills.
3+
Use `skills/ratatui/SKILL.md` when creating, modifying, debugging, or reviewing a Rust terminal UI built with Ratatui.
64

7-
## Which workflow
5+
## Workflow
86

9-
- **New application:** follow steps 1-5 in full, including the design brief
10-
and the template.
11-
- **Existing application:** skip the design brief unless the layout archetype
12-
changes. Inspect the existing code first. Make the smallest change. Preserve
13-
existing dependencies and patterns. Do not copy the template.
7+
- Inspect the repository, manifest, lockfile, source, and tests first.
8+
- For a new application, choose an architecture that fits its complexity.
9+
- For an existing application, preserve established patterns and make a targeted change.
10+
- Use `skills/ratatui/templates/dirview/` as an example when its structure fits. It is not a mandatory starter.
11+
- Do not apply this guidance to non-Ratatui or non-TUI tasks.
1412

15-
## Before writing code
13+
## Engineering
1614

17-
1. **Research.** Run `$SKILL_DIR/scripts/crate-versions.sh <crates>` for the
18-
newest stable version and minimum Rust version of every dependency. Read the
19-
ratatui `CHANGELOG.md` and `BREAKING-CHANGES.md` for that version. Never
20-
write ratatui code, versions or feature flags from memory. If an API is
21-
uncertain, compile a ten-line program that calls it.
22-
2. **Design brief (new apps only).** State the layout archetype, one ANSI
23-
accent color, density, modes and keys, and what each empty, error and
24-
too-small state shows, justified from the app's data.
25-
26-
## Building
27-
28-
- New apps: start from `skills/ratatui/templates/dirview/` and copy its
29-
structure: `action`, `keymap`, `state` (no terminal types), `ui` (no side
30-
effects), `theme` (the only file naming colors). Rename the crate reference
31-
in `main.rs` to match your package name.
32-
- Existing apps: do not copy the template. Read the existing code first.
33-
- One key table drives input, footer hints and the `?` help.
34-
- Everything visible works. No fake data, decorative panels or dead keys.
35-
- Measure text with `unicode-width`, sanitize untrusted text, draw only visible
36-
rows.
37-
- Colors by role, 16 ANSI by default, respect `NO_COLOR`, no forced background,
38-
no emoji.
39-
- If handling terminal events directly, declare a compatible direct `crossterm` dependency and import from `crossterm::event`. Verify `cargo tree -d` has no duplicate versions.
40-
- No `.unwrap()` outside tests, no swallowed errors, no TODOs, comments say why.
15+
- Verify APIs against the Ratatui version resolved by the project.
16+
- Avoid unnecessary dependencies and version changes.
17+
- Keep rendering responsive; move genuinely expensive work out of the draw path.
18+
- Handle terminal resizing, input, and relevant empty or error states.
19+
- Prefer state and behavior tests; use `TestBackend` for relevant rendering checks.
20+
- Use PTY, VHS, Betamax, or equivalent integration tests when real terminal behavior is in scope.
21+
- Treat architecture and visual conventions as context-dependent unless correctness requires them.
4122

4223
## Done means
4324

44-
See `skills/ratatui/SKILL.md` section 4 (Verify) for the canonical checklist.
45-
Do not duplicate it here.
46-
47-
Also read the rendered screens as text at several sizes
48-
(`skills/ratatui/templates/dirview/examples/dump.rs`). Report what was built,
49-
the versions used, what passed, and anything you could not check.
50-
51-
More detail: `skills/ratatui/references/` (`research-checklist.md`,
52-
`ux-principles.md`, `slop-tells.md`).
25+
Run checks appropriate to the workspace and changed packages. Report exactly what ran, what passed, and what remains unverified. See `skills/ratatui/SKILL.md` for the detailed workflow and references.

‎README.md‎

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
<p align="center">
2121
<a href="#quick-start">Quick start</a> ·
22+
<a href="docs/agent-compatibility.md">Agent support</a> ·
2223
<a href="#what-changes">What changes</a> ·
2324
<a href="#how-it-works">How it works</a> ·
2425
<a href="#demo">Demo</a> ·
@@ -38,48 +39,61 @@
3839

3940
AI assistants write ratatui from memory. They reach for old APIs and wrong crate versions, then ship a UI that looks generated: neon defaults, decorative panels, keys that do nothing.
4041

41-
**ratatui-skill** replaces that with a fixed process and a tested template. The assistant looks up what is current, writes a design brief before any code (new apps only), builds from a working codebase, and proves the result before it says "done".
42+
**ratatui-skill** provides a practical workflow, version-aware research, a working reference template, and verification guidance. The assistant inspects the project, adapts the process to the task, and reports what it actually checked.
4243

4344
## Quick start
4445

45-
1. Copy the skill into your assistant's skills directory. For Claude Code:
46+
1. Copy the canonical skill directory into a discovery location supported by your agent. From the root of this repository:
47+
48+
**Codex, Cursor, Antigravity, and OpenCode:**
49+
50+
```bash
51+
mkdir -p /path/to/project/.agents/skills
52+
rm -rf /path/to/project/.agents/skills/ratatui
53+
cp -a skills/ratatui /path/to/project/.agents/skills/ratatui
54+
```
55+
56+
**Claude Code:**
4657

4758
```bash
48-
mkdir -p ~/.claude/skills && cp -r skills/ratatui ~/.claude/skills/ # all projects
49-
mkdir -p .claude/skills && cp -r skills/ratatui .claude/skills/ # one project
59+
mkdir -p /path/to/project/.claude/skills
60+
rm -rf /path/to/project/.claude/skills/ratatui
61+
cp -a skills/ratatui /path/to/project/.claude/skills/ratatui
5062
```
5163

64+
See [agent compatibility and installation](docs/agent-compatibility.md) for global installs and native alternatives.
65+
5266
2. Ask for a terminal UI:
5367

5468
```text
5569
Use the ratatui skill. Build a simple TUI in Rust: a todo list. Add items,
5670
mark them done, delete them, and save to a file so they're still there next time.
5771
```
5872

59-
3. Watch it research versions, write a brief, build, and run its own checks.
73+
3. Watch it inspect the project, choose a proportionate workflow, build, and run relevant checks.
6074

61-
Assistants that read `AGENTS.md` instead of loading skills can use the one at the repo root. It carries the same process in short form and points at the skill files.
75+
`AGENTS.md` is a concise fallback for agents that read repository instructions but do not discover skills. It does not install or auto-register the skill. See [agent compatibility](docs/agent-compatibility.md) for the supported discovery paths.
6276

6377
## What changes
6478

6579
| Without the skill | With it |
6680
|---|---|
67-
| Versions and APIs written from memory | Newest stable versions looked up and quoted, release notes read, uncertain calls compiled |
68-
| Design is whatever comes to mind first | A written brief: layout, one accent color, density, keys, every empty, error and too-small state |
81+
| Versions and APIs written from memory | Resolved versions and project constraints checked; release notes reviewed when versions or recent APIs change |
82+
| Design choices are implicit | Layout and interactions follow the requirements and displayed data; document decisions when complexity warrants it |
6983
| Decorative panels, fake data, dead keys | Everything visible works |
70-
| One long `main.rs` | State with no terminal types, rendering with no side effects, one key table |
71-
| "Done" with nothing run | fmt, clippy, tests, screen dumps, a real pseudo-terminal run, and a slop scan |
84+
| Structure chosen without considering scope | Clear state/rendering boundaries and shared key bindings where they reduce coupling or duplication |
85+
| "Done" with nothing run | Relevant fmt, Clippy and tests; render or terminal integration checks where behavior requires them; honest reporting |
7286
| Silent about what was skipped | A report that names anything it could not check |
7387

7488
## How it works
7589

7690
<details open>
7791
<summary><b>Five steps, in order</b></summary>
7892

79-
1. **Research.** Look up the newest stable version, minimum Rust version, and (when given a manifest) the version resolved by the project of every crate, read the release notes, confirm widget crates match the ratatui version, and compile anything uncertain.
80-
2. **Design brief.** Before any code: layout archetype, one accent color, density, keys, and what each empty or failed state shows, justified from the app's data.
81-
3. **Build** from a tested template with a strict split: state with no terminal types, rendering with no side effects, and one key table that drives input, footer hints and help.
82-
4. **Verify.** `cargo fmt --check`, clippy with warnings denied, tests, text dumps of the screen at several sizes, a run in a real pseudo-terminal, and a slop scan.
93+
1. **Research.** Check the newest stable and minimum supported versions alongside versions resolved by the project. Preserve existing constraints; review release notes when changing versions or relying on recently changed APIs. Confirm widget crates match the resolved Ratatui version and compile uncertain APIs.
94+
2. **Design.** For a non-trivial new interface, make the interaction model, layout, keyboard behavior, and relevant empty/error states explicit before implementation. Keep this lightweight for small tasks.
95+
3. **Build** with the simplest architecture that fits. Use the dirview template as a reference when its structure is relevant; preserve existing project conventions.
96+
4. **Verify.** Run relevant formatting, Clippy and test checks. Use TestBackend for rendering behavior and PTY or recording-based tests when real terminal interaction matters. Report anything not checked.
8397
5. **Report honestly,** including anything it could not check.
8498

8599
</details>
@@ -88,10 +102,10 @@ Assistants that read `AGENTS.md` instead of loading skills can use the one at th
88102
<summary><b>The rules it enforces</b></summary>
89103

90104
- Everything visible works. No fake data, decorative panels or dead keys.
91-
- One key table drives input, footer hints and the `?` help, so a documented key always works.
105+
- When input, footer hints, and help repeat the same bindings, keep them in sync through a shared source of truth.
92106
- Text is measured with `unicode-width`, untrusted text is sanitized, only visible rows are drawn.
93-
- Colors by role in one file, 16 ANSI colors by default, `NO_COLOR` respected, no forced background, no emoji.
94-
- No `.unwrap()` outside tests, no swallowed errors, no TODOs, comments say why.
107+
- Choose colors and visual conventions for the product and terminal environment; support monochrome output when required.
108+
- Handle errors deliberately and use compiler-visible Clippy lints where a project wants to prohibit specific patterns.
95109
- Destructive actions confirm. Slow work never blocks the draw loop.
96110

97111
</details>
@@ -109,15 +123,15 @@ cd todo
109123
TODO_THEME=catppuccin cargo run --bin todo
110124
```
111125

112-
The default uses the 16 ANSI colors from your terminal palette. `NO_COLOR` renders monochrome. Source, keys and the file format are in [`todo/README.md`](todo/README.md).
126+
The demo uses the terminal palette by default and supports `NO_COLOR` for monochrome output. Source, keys and the file format are in [`todo/README.md`](todo/README.md).
113127

114128
## What's inside
115129

116130
```text
117131
AGENTS.md the process in short form, for agents without skill support
118132
assets/ banner, demo, faq and sponsor images
119133
docs/ version-aware distribution proposal
120-
evals/ 10 evaluation tasks, harness, scoring rubric, results
134+
evals/ task suite, paired-run harness, scoring rubric, human-review records
121135
skills/ratatui/
122136
SKILL.md the process
123137
references/
@@ -163,11 +177,12 @@ cargo run -- .
163177
<summary><b>Does it only work with Claude Code?</b></summary>
164178
<br>
165179

166-
**No. Any assistant that can run commands works.**
180+
**No. The skill uses the open Agent Skills directory format.**
167181

168-
The skill format is read by assistants that support skills, and anything that
169-
reads `AGENTS.md` can use the short version at the repo root. The scripts and
170-
template are plain shell, Python and Rust.
182+
Codex, Claude Code, Cursor, Antigravity, and OpenCode document compatible
183+
skill discovery paths. Use the install location listed in
184+
[`docs/agent-compatibility.md`](docs/agent-compatibility.md). The repository
185+
has not yet been runtime-smoke-tested in every listed client.
171186

172187
</details>
173188

@@ -183,8 +198,8 @@ The versions in this repo are what the template was tested with, ratatui 0.30.2
183198
on its minimum supported Rust version, 1.88. They are not a promise about what is newest when you read this. The skill
184199
tells the assistant to:
185200

186-
1. Run `crate-versions.sh` for each dependency.
187-
2. Read the release notes for the version it returns.
201+
1. Run `crate-versions.sh` for relevant dependencies.
202+
2. Preserve project constraints and inspect release notes when changing versions or using recently changed APIs.
188203
3. Compile any API it is unsure about before using it.
189204

190205
</details>
@@ -195,11 +210,11 @@ tells the assistant to:
195210
<summary><b>Why a "slop scan"?</b></summary>
196211
<br>
197212

198-
**Generated UIs are recognizable, so the scanner fails CI on the mechanical tells.**
213+
**The scanner is deliberately narrow. It is a guardrail, not an AI-slop detector.**
199214

200-
Emoji icons, neon gradients, placeholder rows and comments that narrate the code
201-
are checked by [`lint-slop.sh`](skills/ratatui/scripts/lint-slop.sh). The rest are
202-
judgment calls listed in
215+
It checks a small set of mechanical source conventions. It cannot reliably
216+
judge visual hierarchy, fake data, unnecessary abstractions, or whether a design
217+
fits the product. Those require behavior tests and human review. See
203218
[`references/slop-tells.md`](skills/ratatui/references/slop-tells.md).
204219

205220
</details>

‎docs/agent-compatibility.md‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Agent compatibility
2+
3+
`skills/ratatui/` is the canonical skill source in this repository. It follows the open Agent Skills directory format: one directory containing `SKILL.md` and optional `references/`, `scripts/`, and template assets.
4+
5+
Do not maintain separate copies of the instructions for each agent. Install the same canonical directory at the discovery path for the client you use.
6+
7+
## Project-level discovery paths
8+
9+
| Agent | Project-level path | Notes |
10+
|---|---|---|
11+
| OpenAI Codex | `.agents/skills/ratatui/` | Codex also supports user-level `~/.agents/skills/ratatui/`. |
12+
| Claude Code | `.claude/skills/ratatui/` | Claude Code also supports `~/.claude/skills/ratatui/`. |
13+
| Cursor | `.agents/skills/ratatui/` or `.cursor/skills/ratatui/` | Cursor also recognizes Claude and Codex skill directories. |
14+
| Google Antigravity | `.agents/skills/ratatui/` | Shared workspace path for Antigravity IDE and CLI. |
15+
| OpenCode | `.opencode/skills/ratatui/` | OpenCode also discovers `.agents/skills/` and `.claude/skills/` as compatibility locations. |
16+
17+
The shared `.agents/skills/ratatui/` path is the simplest project-level choice when using Codex, Cursor, Antigravity, and OpenCode together. Claude Code currently uses its own `.claude/skills/` project path, so install a copy there as well when Claude Code is part of the workflow.
18+
19+
## Global discovery paths
20+
21+
| Agent | User-level path |
22+
|---|---|
23+
| OpenAI Codex | `~/.agents/skills/ratatui/` |
24+
| Claude Code | `~/.claude/skills/ratatui/` |
25+
| Cursor | `~/.agents/skills/ratatui/` or `~/.cursor/skills/ratatui/` |
26+
| Google Antigravity | `~/.gemini/config/skills/ratatui/` |
27+
| OpenCode | `~/.config/opencode/skills/ratatui/` |
28+
29+
OpenCode additionally accepts global compatibility directories `~/.agents/skills/` and `~/.claude/skills/`.
30+
31+
## Install from this repository
32+
33+
Run these commands from the root of the cloned `ratatui-skill` repository. Replace `/path/to/project` with the root of the project where you want the skill available.
34+
35+
### Shared location
36+
37+
For Codex, Cursor, Antigravity, and OpenCode:
38+
39+
```bash
40+
mkdir -p /path/to/project/.agents/skills
41+
rm -rf /path/to/project/.agents/skills/ratatui
42+
cp -a skills/ratatui /path/to/project/.agents/skills/ratatui
43+
```
44+
45+
### Claude Code
46+
47+
```bash
48+
mkdir -p /path/to/project/.claude/skills
49+
rm -rf /path/to/project/.claude/skills/ratatui
50+
cp -a skills/ratatui /path/to/project/.claude/skills/ratatui
51+
```
52+
53+
### OpenCode native location
54+
55+
```bash
56+
mkdir -p /path/to/project/.opencode/skills
57+
rm -rf /path/to/project/.opencode/skills/ratatui
58+
cp -a skills/ratatui /path/to/project/.opencode/skills/ratatui
59+
```
60+
61+
### Global install
62+
63+
For a user-level install, replace the project directory above with the global path from the tables. For example, Codex:
64+
65+
```bash
66+
mkdir -p ~/.agents/skills
67+
rm -rf ~/.agents/skills/ratatui
68+
cp -a skills/ratatui ~/.agents/skills/ratatui
69+
```
70+
71+
Avoid maintaining multiple copies of the same skill in overlapping discovery directories for one agent unless you intentionally want to test precedence or overrides. Some clients load more than one source and resolve duplicate skill names using product-specific precedence rules.
72+
73+
## What "compatible" means
74+
75+
There are separate levels of compatibility:
76+
77+
1. **Format-compatible:** the directory contains the standard `SKILL.md` frontmatter and supporting files.
78+
2. **Discovery-documented:** the agent's official documentation lists the installation path.
79+
3. **Runtime-tested:** the skill has been installed in that product and verified to appear, trigger, load references, and run its scripts.
80+
81+
This repository uses the standard skill directory format and documents the official discovery paths linked below. The paths are not a claim that every listed client has been smoke-tested with this repository. Live discovery, trigger behavior, reference loading, and script execution still need product-by-product validation.
82+
83+
The skill's portable content is shared. Product-specific features, invocation controls, and context-loading behavior may differ.
84+
85+
## Official documentation
86+
87+
- [OpenAI Codex skill locations and configuration](https://learn.chatgpt.com/docs/build-skills) and [OpenAI's skill-based OSS maintenance workflow](https://developers.openai.com/blog/skills-agents-sdk)
88+
- [Claude Code skills](https://code.claude.com/docs/en/skills)
89+
- [Cursor Agent Skills](https://cursor.com/docs/skills)
90+
- [Google Antigravity agent skills](https://antigravity.google/docs/skills)
91+
- [OpenCode skills](https://opencode.ai/docs/skills/)
92+
- [Agent Skills specification](https://agentskills.io/specification)

0 commit comments

Comments
 (0)