Skip to content

shadcn-labs/termcn / .agents/skills/ink

Comprehensive Ink skill for building CLI applications with React. Covers components (Text, Box, Static, Transform), hooks (useInput, useApp, useFocus), Flexbox layout, testing, and accessibility.

rules/RULES.md

View on GitHub
# Ink Best Practices

Best practices extracted from deep analysis of the Ink source code, tests, and examples.

## Rule Files

| File | Topic |
|------|-------|
| [performance.md](./performance.md) | FPS tuning, Static, memoization, incremental rendering |
| [components.md](./components.md) | Box, Text, Static, Transform, Newline, Spacer |
| [hooks.md](./hooks.md) | useInput, useApp, useFocus, useFocusManager, useCursor |
| [core.md](./core.md) | render(), renderToString(), error handling, environment behavior |

## Critical Rules (Always Apply)

1. **ALL text must be inside `<Text>`** — raw strings in `<Box>` throw runtime errors
2. **`<Text>` is a leaf** — cannot contain `<Box>` or structural components
3. **`<Box>` is always flexbox** — cannot disable `display: flex`
4. **NEVER use `process.exit()`** — use `useApp().exit()` for proper cleanup
5. **Tab/Shift+Tab are reserved** — intercepted by the focus system, not received by `useInput`
6. **Ctrl+C is intercepted** — by default it exits the app; set `exitOnCtrlC: false` to handle it yourself
7. **`<Static>` items are immutable** — only append new items; mutations to existing items are ignored
8. **Always `key` in `<Static>`** — each rendered element needs a stable, unique `key`
9. **Check `isRawModeSupported`** — raw mode is unavailable in CI and piped input scenarios
10. **Yoga units are characters/lines** — not pixels; `padding={1}` = 1 character horizontally, 1 line vertically
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall