/rtk-output-design:rtk-output-designfrom rtk-output-design
Design compact, failure-first CLI/skill/hook output for agents. Use when implementing or reviewing agent-facing output.
Ships in rtk-output-design. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill to make CLI, skill, hook, and script output useful to an agent without flooding its context. Treat output as a contract: preserve the signal needed for the next action, make compression explicit, and keep raw detail available on demand.
Design every command around this shape:
status: success | partial | failure
summary: one sentence with the important result
stats: counts, durations, paths, bytes, token estimates, or changed totals
items: only the highest-value errors, warnings, changed files, matches, or rows
omitted: what was hidden and why, with counts when possible
next_actions: concrete commands or fixes when the result is not done
provenance: command, mode, input scope, and source paths when relevant
For human output, render this shape as compact sections. For automation, expose it as stable JSON.
Provide these modes when the tool has non-trivial output:
| Mode | Purpose | Rules |
|---|---|---|
| Default | Agent-readable terminal output | Compact summary first, failures before successes, bounded examples. |
--json | Script and agent automation | Print one valid JSON object to stdout. Put non-JSON diagnostics on stderr. |
--verbose / -v | Debugging | Add raw command, matched rules, and timing. Keep the default concise. |
--raw | Escape hatch | Show unfiltered upstream output for audits, parser bugs, or human inspection. |
--dry-run | Preview changes | Show planned writes or hook edits without mutating files. |
Preserve upstream exit codes unless the wrapper itself fails. If filtering fails, prefer raw output plus a short filter warning over hiding command results.
Choose the cheapest strategy that preserves the next useful action:
| Input Shape | Strategy | Keep |
|---|---|---|
| Successful build/test/install logs | Progress filtering | Final status, duration, warnings, changed artifacts. |
| Failed build/test/lint runs | Failure focus | Error blocks, failing test names, stack heads, file:line, repro command. |
| Repeated log lines | Deduplication | Unique message, count, first/last timestamp or location. |
| Search output | Group by pattern | Match counts by file or rule, then representative matches. |
| Large diffs or status | Stats extraction | File counts, additions/deletions, changed paths, conflict state. |
| Directory listings | Tree compression | Top-level structure, important files, counts for hidden children. |
| JSON or structured text | Structure-only or summarized JSON | Keys, types, counts, selected values needed for the task. |
| Language source dumps | Code filtering | Signatures, exports, imports, failing region, omitted body counts. |
| Streamed test output | State-machine parsing | Suite lifecycle, failures, skipped count, slow tests. |
| NDJSON or event streams | Streaming aggregation | Counts by event type plus the most actionable events. |
Never compress away:
Use this layout for CLI output that an agent will read:
<STATUS>: <one-sentence summary>
Stats:
- <count or metric>
- <duration or scope>
Findings:
- <file:line or id> <message>
- <group> <count> occurrences, example: <short sample>
Omitted:
- <count> low-signal lines hidden; use --raw or --verbose for details
Next:
- <single best next command or action>
Omit empty sections. Keep the default output small enough to scan in one screen; for broad commands, prefer the top 10 to 20 actionable items plus counts.
For --json, use one object with stable keys:
{
"status": "success",
"summary": "3 files changed, no failures",
"command": {
"argv": ["tool", "check"],
"cwd": "/repo",
"exit_code": 0,
"duration_ms": 1234
},
"stats": {
"files": 3,
"warnings": 0,
"errors": 0,
"omitted_lines": 248
},
"items": [
{
"kind": "change",
"path": "src/main.rs",
"line": 42,
"message": "updated parser"
}
],
"omitted": [
{
"kind": "progress",
"count": 248,
"reason": "progress and success lines hidden"
}
],
"next_actions": ["run cargo test"],
"meta": {
"schema": "rtk-output-design.v1",
"raw_available": true
}
}
Rules:
null only when absence is meaningful; otherwise omit optional keys.schema when downstream agents or tests may depend on the shape.For skills, prompts, and hooks:
Example hook message:
RTK: rewrite suggested
original: pytest -q
rewrite: rtk pytest -q
reason: filter passing tests; preserve failures and exit code
Before shipping a CLI, skill helper, or script:
--json schema before implementation.--raw or an equivalent debug path for compressed output.A tool follows this guide when an agent can answer these questions from default output alone:
If any answer requires scanning raw logs, redesign the output or add a focused summary path.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub karlorz/agent-skills --plugin rtk-output-design