control-cli
Skill1 starsChanged 16 days agoMITView on GitHub
Build or adapt a local harness to drive, inspect, and profile an interactive CLI or TUI without external services. Use for CLI UX checks, startup regressions, memory leaks, hangs, prompt flows, or terminal demos.
We split this skill into the rules it gives an agent
10 rules. 0 are common, 8 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use a repeatable local harness to exercise an interactive CLI instead of poking at it manually.
- Distinctive: line 22
If no harness exists, launch the CLI in an isolated terminal session with deterministic env vars.
- Distinctive: line 25
Wait for a concrete screen pattern or prompt before the next action.
- Distinctive: line 54
Read the terminal output to find the inspector URL, then use Chrome DevTools-compatible tooling if profiling is needed.
- Distinctive: line 58
Use a PTY script when you need deterministic waits in a repo that does not have tmux or a demo harness.
- Very specific: line 94
If the CLI needs richer terminal control, use pty.fork() or an existing PTY library.
- Distinctive: line 105
Prefer deterministic waits over sleeps.
- Distinctive: line 106
Do not send credentials or destructive commands into a controlled session.
- Very specific: line 107
Keep the harness in /tmp unless the repo already has a testing/demo harness.
- Distinctive: line 108
Do not hard-code paths from another repository.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Control CLI
Use a repeatable local harness to exercise an interactive CLI instead of poking at it manually. First reuse the repo's own test/demo harness if it exists; otherwise assemble a temporary harness from standard local tools.
What It Is Used For
- Reproducing CLI/TUI bugs with deterministic input.
- Verifying keyboard flows, prompts, interrupts, resize behavior, and terminal layout.
- Capturing before/after transcripts for bug fixes.
- Profiling startup time, slow operations, hangs, or memory growth.
- Recording a short terminal demo when output is easier to show than explain.
Harness Loop
- Identify the command under test and the smallest reproducible workspace.
- Discover existing local harnesses: package scripts, e2e tests, demo recorders, expect scripts, or PTY helpers.
- If no harness exists, launch the CLI in an isolated terminal session with deterministic env vars.
- Capture the current screen before interacting.
- Send one action at a time: text, Enter, arrows, Escape, Ctrl-C, resize.
- Wait for a concrete screen pattern or prompt before the next action.
- Save the transcript and any profile artifacts.
- Kill the session cleanly.
Harness Options
- Repo-native harness: prefer checked-in scripts because they know the app's startup, env, and prompts.
tmux: managed sessions,capture-pane,send-keys, attach/detach.- PTY probe: use a short Python, Node, or Expect script when tmux is unavailable.
- Runtime inspector: use Node or Bun inspector for CPU profiles, heap snapshots, and live evaluation.
- Terminal recorder: use repo-local demo tools or asciinema-compatible tools when the user asks for a demo.
Minimal tmux Harness
SESSION="cli-harness-$(date +%s)"
tmux new-session -d -s "$SESSION" -- <command-under-test>
tmux capture-pane -pt "$SESSION"
tmux send-keys -t "$SESSION" "help" Enter
tmux capture-pane -pt "$SESSION"
tmux kill-session -t "$SESSION"For Node CLIs:
NODE_OPTIONS="--inspect=127.0.0.1:0" tmux new-session -d -s "$SESSION" -- <node-cli-command>Read the terminal output to find the inspector URL, then use Chrome DevTools-compatible tooling if profiling is needed.
Minimal PTY Harness
Use a PTY script when you need deterministic waits in a repo that does not have tmux or a demo harness. Keep it temporary unless the user asks to add a reusable test.
import os
import pty
import select
import subprocess
import time
master_fd, slave_fd = pty.openpty()
proc = subprocess.Popen(
["<command>", "<arg>"],
stdin=slave_fd,
stdout=slave_fd,
stderr=slave_fd,
close_fds=True,
)
os.close(slave_fd)
deadline = time.time() + 30
buffer = b""
while time.time() < deadline:
ready, _, _ = select.select([master_fd], [], [], 0.25)
if not ready:
continue
chunk = os.read(master_fd, 4096)
buffer += chunk
if b"<ready text>" in buffer:
os.write(master_fd, b"help\n")
break
print(buffer.decode(errors="replace"))
proc.terminate()
os.close(master_fd)If the CLI needs richer terminal control, use pty.fork() or an existing PTY library.
Profiling Recipes
- Startup regression: capture baseline and treatment startup timings under the same machine, env, and command.
- Slow operation: start a CPU profile, perform the operation, stop the profile, and compare top self-time functions.
- Memory leak: force GC if available, take a heap snapshot, perform the operation repeatedly, force GC again, and take another snapshot.
- Hang: capture the screen, active handles/resources, and a stack/CPU sample before interrupting.
Guardrails
- Prefer deterministic waits over sleeps. If you must sleep, explain why.
- Do not send credentials or destructive commands into a controlled session.
- Keep the harness in
/tmpunless the repo already has a testing/demo harness. - Do not hard-code paths from another repository. Adapt commands to the current repo's scripts and runtime.
- Clean up tmux sessions, temp dirs, inspector processes, and demo artifacts unless the user asks to keep them.
Other versions7 projects use a version of this.
Word for word · 3
- anis-dr/skills★ 3100% same
- ElyzeSolutions/skills★ 1100% same
- ArchitektApx/cursor-skills-for-claude★ 0100% same
Edited · 2
- EvanBatten/pstack-for-cc★ 294% same
- ngcto/oh-my-pstack★ 135% same
Wrote their own version · 2
- AnastasiyaW/codex-claude-code-config★ 212same name
- AnastasiyaW/claude-code-config★ 209same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- verify-herdr-orchestratorSkill
- architectSkill
- arenaSkill
- automate-meSkill
- benchmark-checklistSkill
- blast-radiusSkill
- broSkill
- control-uiSkill
- correctSkill
- create-formal-verification-skillSkill
- create-verification-skillSkill
- deslopSkill
- figure-it-outSkill
- herdr-orchestratorSkill
- howSkill
- interrogateSkill
- in-your-own-wordsSkill
- ketchupSkill
- maintain-formal-verification-skillSkill
- maintain-verification-skillSkill
- no-commentsSkill
- poteto-modeSkill
- principle-attack-the-premiseSkill
- principle-boundary-disciplineSkill
- principle-build-the-leverSkill
- principle-encode-lessons-in-structureSkill
- principle-exhaust-the-design-spaceSkill
- principle-experience-firstSkill
- principle-explain-the-numberSkill
- principle-fix-root-causesSkill
- principle-foundational-thinkingSkill
- principle-guard-the-context-windowSkill
- principle-laziness-protocolSkill
- principle-make-operations-idempotentSkill
- principle-migrate-callers-then-delete-legacy-apisSkill
- principle-minimize-reader-loadSkill
- principle-model-the-domainSkill
- principle-never-block-on-the-humanSkill
- principle-outcome-oriented-executionSkill
- principle-prove-it-worksSkill
- principle-redesign-from-first-principlesSkill
- principle-separate-before-serializing-shared-stateSkill
- principle-sequence-verifiable-unitsSkill
- principle-subtract-before-you-addSkill
- principle-test-behavior-not-implementationSkill
- principle-type-system-disciplineSkill
- pstack-herdrSkill
- recallSkill
- reflectSkill
- sharpenSkill
- show-me-your-workSkill
- swarmSkill
- tddSkill
- teachSkill
- technical-writingSkill
- typescript-best-practicesSkill
- unslopSkill
- whySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

