test-cli-usability
/test-cli-usability
Pisze testy scenariuszowe sprawdzające, czy narzędzie CLI działa bez interakcji, z czytelnym wyjściem i bez zawieszania się na pytaniach.
- Autor
- langwatch ↗
- Repozytorium
- langwatch ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 27.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 27.10.2026, bez odwołań do wycofanych modeli i API.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
Co robi i kiedy
Pisze testy scenariuszowe sprawdzające, czy narzędzie CLI działa bez interakcji, z czytelnym wyjściem i bez zawieszania się na pytaniach.
Oryginalny opis (EN)
Write scenario tests that verify your CLI tool is usable by AI agents. Ensures commands work non-interactively, provide clear output, and don't hang on prompts. Use when you want to prove your CLI is agent-friendly.
Jak działa
- Prerequisites
- Step 1: Identify Your CLI Commands
- Step 2: Write Scenario Tests
- Step 3: Assert No Interactive Workarounds
- Step 4: Test Error Recovery
- Common Mistakes
Podgląd SKILL.md
---
name: test-cli-usability
description: Write scenario tests that verify your CLI tool is usable by AI agents. Ensures commands work non-interactively, provide clear output, and don't hang on prompts. Use when you want to prove your CLI is agent-friendly.
license: MIT
compatibility: Requires @langwatch/scenario. Works with Claude Code and similar coding agents.
metadata:
category: recipe
---
# Test Your CLI's Agent Usability
This recipe helps you write scenario tests that verify your CLI tool works well when operated by AI agents (Claude Code, Cursor, Codex, etc.). A CLI that's agent-friendly means:
- All commands can run non-interactively (no stdin prompts that hang)
- Output is parseable and informative
- Error messages are clear enough for an agent to self-correct
- Help text enables discovery (`--help` works on every subcommand)
## Prerequisites
Install the Scenario SDK:
```bash
npm install @langwatch/scenario vitest @ai-sdk/openai
# or: pip install langwatch-scenario pytest
```
## Step 1: Identify Your CLI Commands
List every command your CLI supports. For each, note:
- Does it require interactive input? (MUST have a non-interactive alternative)
- What flags/options does it accept?
- What does it output on success/failure?
## Step 2: Write Scenario Tests
For each command, write a scenario test where an AI agent discovers and uses it:
```typescript
import scenario, { type AgentAdapter, AgentRole } from "@langwatch/scenario";
import { openai } from "@ai-sdk/openai";
import { describe, expect, it } from "vitest";
const myAgent: AgentAdapter = {
role: AgentRole.AGENT,
call: async (input) => {
// Your Claude Code adapter here
},
};
describe("CLI agent usability", () => {
it("discovers and uses the command non-interactively", async () => {
const result = await scenario.run({
name: "CLI command discovery",
description: "Agent discovers and uses the CLI to accomplish a task",
agents: [
myAgent,
scenario.userSimulatorAgent({ model: openai("gpt-6-luna") }),
scenario.judgeAgent({
model: openai("gpt-6-luna"),
criteria: [
"Agent used the CLI command correctly",
"Agent did not get stuck on interactive prompts",
"Agent did not need to pipe 'yes' or use 'expect' scripting",
],
}),
],
});
expect(result.success).toBe(true);
});
});
```
## Step 3: Assert No Interactive Workarounds
Add this assertion to every test:
```typescript
function assertNoInteractiveWorkarounds(state) {
const output = state.messages
.map((m) => (typeof m.content === "string" ? m.content : JSON.stringify(m.content)))
.join("\n");
expect(output).not.toMatch(/echo\s+["']?[yY](?:es)?["']?\s*\|/);
expect(output).not.toMatch(/\byes\s*\|/);
expect(output).not.toMatch(/expect\s+-c/);
expect(output).not.toMatch(/printf\s+["']\\n["']\s*\|/);
}
```
If this assertion fails, your CLI has an interactivity bug -- add `--yes`, `--force`, or `--non-interactive` flags to the offending commands.
## Step 4: Test Error Recovery
Write scenarios where the agent makes a mistake and must recover:
- Wrong command name -> agent reads `--help` and self-corrects
- Missing required argument -> agent reads error message and retries
- Authentication failure -> agent follows instructions in error output
## Common Mistakes
- Do NOT make commands that require stdin for essential operations -- always provide flag alternatives
- Do NOT use interactive prompts for confirmation without a `--yes` or `--force` flag
- Do NOT output errors without actionable guidance (the agent needs to know how to fix it)
- DO make `--help` comprehensive on every subcommand
- DO use non-zero exit codes for failures (agents check exit codes)
- DO output structured information (the agent can parse it)
Wersje
W bazie nie ma innych skilli o nazwie test-cli-usability.
Identyczna treść występuje jeszcze w 1 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 45989e027d7c (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100cli-agent-friendly-audit
Audytuje narzędzie CLI według listy kontrolnej przyjazności dla agentów z tekstu Zbigniewa Sobieckiego „Building Agent-Friendly CLIs”, oceniając ergonomię dla agentów. - 95cli-for-agent
Projektuje lub przegląda CLI przyjazne agentom: flagi bez interakcji, pomoc z przykładami, potoki, czytelne błędy i tryb dry-run. - 95tarn-api-testing
Pisze i uruchamia testy API w Tarn, w plikach .tarn.yaml, a także generuje testy z OpenAPI lub poleceń curl. - 100write-tests
Pisze testy sprawdzające zachowanie produktu, bez zależności od szczegółów implementacji i wartości konfiguracji. - 100write-tests
Pisze testy sprawdzające zachowanie produktu, bez zależności od szczegółów implementacji i wartości konfiguracji. - 100agent-cli
Dodaje do skryptów CLI w Pythonie czytelne dla agentów wyjście --json w formacie NDJSON albo tworzy dla projektu pakiet pomocniczy cli_utils.