You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8aa5c8a
Browse filesBrowse the repository at this point in the historyBrowse files
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.
6
4
7
-
## Which workflow
5
+
## Workflow
8
6
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.
14
12
15
-
## Before writing code
13
+
## Engineering
16
14
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.
41
22
42
23
## Done means
43
24
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.
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.
40
41
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.
42
43
43
44
## Quick start
44
45
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
cp -a skills/ratatui /path/to/project/.claude/skills/ratatui
50
62
```
51
63
64
+
See [agent compatibility and installation](docs/agent-compatibility.md) for global installs and native alternatives.
65
+
52
66
2. Ask for a terminal UI:
53
67
54
68
```text
55
69
Use the ratatui skill. Build a simple TUI in Rust: a todo list. Add items,
56
70
mark them done, delete them, and save to a file so they're still there next time.
57
71
```
58
72
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.
60
74
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.
62
76
63
77
## What changes
64
78
65
79
| Without the skill | With it |
66
80
|---|---|
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|
69
83
| 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|
72
86
| Silent about what was skipped | A report that names anything it could not check |
73
87
74
88
## How it works
75
89
76
90
<detailsopen>
77
91
<summary><b>Five steps, in order</b></summary>
78
92
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.
83
97
5.**Report honestly,** including anything it could not check.
84
98
85
99
</details>
@@ -88,10 +102,10 @@ Assistants that read `AGENTS.md` instead of loading skills can use the one at th
88
102
<summary><b>The rules it enforces</b></summary>
89
103
90
104
- 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.
92
106
- 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.
95
109
- Destructive actions confirm. Slow work never blocks the draw loop.
96
110
97
111
</details>
@@ -109,15 +123,15 @@ cd todo
109
123
TODO_THEME=catppuccin cargo run --bin todo
110
124
```
111
125
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).
113
127
114
128
## What's inside
115
129
116
130
```text
117
131
AGENTS.md the process in short form, for agents without skill support
`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)
0 commit comments