optimize-agentic-cli
Skill0 starsChanged 7 months agoApache-2.0View on GitHub
Guardrail for auditing and designing CLIs that agents can drive through pure data channels, semantic exit codes, noninteractive flows, and repairable errors.
In this repository57 other files it gives its agents.
- ai-app-integrationSkill
- anti-llm-frontend-designSkill
- aspnet-core-web-developmentSkill
- async-python-patternsSkill
- browser-game-foundationsSkill
- browser-local-qaSkill
- build-mcp-server-sdk-v2Skill
- canva-design-opsSkill
- check-completionSkill
- cli-tool-creatorSkill
- cloudflare-agents-mcpSkill
- cloudflare-durable-objectsSkill
- cloudflare-workers-platformSkill
- deployment-preview-workflowsSkill
- docx-document-artifactsSkill
- durable-workflow-orchestrationSkill
- dynamic-og-imagesSkill
- eval-auditSkill
- evaluate-ragSkill
- figma-design-to-code-rulesSkill
- fine-tuningSkill
- frontend-product-builderSkill
- game-asset-pipeline-expansionSkill
- game-ui-playtestSkill
- generate-synthetic-dataSkill
- github-pr-ci-opsSkill
- gmail-inbox-opsSkill
- golden-datasetSkill
- huggingface-llm-trainerSkill
- javascript-monorepo-buildsSkill
- linear-issue-managementSkill
- media-generation-transcriptionSkill
- millrace-rs-contract-paritySkill
- minecraft-mod-qa-automationSkill
- notion-workspace-flowsSkill
- openai-docsSkill
- pdf-artifact-workflowSkill
- phaser-2d-game-developmentSkill
- postgres-query-performanceSkill
- product-ui-polish-reviewSkill
- pydantic-v2-patternsSkill
- python-repo-refactoring-hygieneSkill
- rag-corpus-hygieneSkill
- react-next-performance-reviewSkill
- rust-best-practicesSkill
- shadcn-ui-compositionSkill
- skill-evaluation-harnessSkill
- tauri-desktopSkill
- tauri-mcp-cliSkill
- tauri-ptySkill
- tile-pixel-art-transitionsSkill
- train-sentence-transformersSkill
- typer-cli-patternsSkill
- using-dbt-for-analytics-engineeringSkill
- validate-evaluatorSkill
- visual-asset-pipelineSkill
- watchdog-file-watcher-patternsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
every failure exits with the same opaque code
- Very specific: line 41
Check whether a machine-readable mode exists, usually --json or --output json.
- Distinctive: line 42
Verify stdout is pure data and stderr carries progress, logs, and operator messages.
- Distinctive: line 74
Run safe read-only commands to inspect stdout/stderr separation.
- Distinctive: line 89
Start with the five core contract checks: pure machine output, stderr separation, semantic exits, noninteractive behavior, and structured …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Optimize Agentic CLI
Purpose
Help agents audit or design command-line tools that another agent can call safely without human babysitting. This skill is for CLI contract quality after the surface is known to be a CLI, not for deciding whether a workflow should be MCP, API, UI automation, or shell script.
Use When
- stdout mixes JSON with progress, banners, or prose
- every failure exits with the same opaque code
- commands hang on prompts in headless contexts
- a CLI needs stable JSON, structured errors, dry runs, or repair-loop output
- the user asks to make a CLI agent-friendly or LLM-friendly
Do Not Use When
- the surface decision between CLI, MCP, API, or direct library call is still open
- the task is generic shell scripting rather than a reusable CLI contract
- a vendor-specific CLI skill already owns the workflow
Quick Start
- Check whether a machine-readable mode exists, usually
--jsonor--output json. - Verify stdout is pure data and stderr carries progress, logs, and operator messages.
- Map exit codes for success, usage, auth, not found, conflict, validation, and retryable failures.
- Confirm headless commands never prompt unless an explicit interactive mode is requested.
- Require structured error bodies with stable codes, retryability, and next-action hints.
- For repairable generated artifacts, design an iterate-validate-repair loop.
Operating Constraints
- Stdout is the data channel; stderr is the operator channel; exit code is the machine status channel.
--jsonoutput must not include spinners, banners, warnings, or prose.- Destructive commands require
--dry-runand an explicit confirmation path such as--yesor--force. - Noninteractive runs must fail deterministically instead of blocking.
- Error fields must be stable enough for automation: class, code, message, retryable, and suggestion or next action.
- Long-running operations need job IDs, polling, timeout behavior, and resumable status.
- Pagination, filtering, and field selection must prevent unbounded output.
- Help text should document examples, output fields, and exit codes.
Inputs This Skill Expects
- The CLI name, target users, and main command families.
- Existing help output, command docs, or source files.
- Safe read-only commands that can be run for evidence.
- Known destructive paths that need confirmation or dry-run handling.
- Whether the workflow is one-shot, long-running, batch, or repairable.
Output Contract
- For audits, provide a severity-ranked report with command evidence, observed stdout/stderr/exit behavior, agent impact, and recommended fix.
- For designs, provide command grammar, JSON envelope, error schema, exit-code map, noninteractive policy, destructive-flow safety, and examples.
- For repair loops, provide phase names, validation response shape, retry budget,
next_action, and finalization criteria. - State verification commands that prove the contract.
Procedure
- Capture top-level and relevant subcommand help.
- Identify machine-readable flags, quiet flags, paging behavior, and config/auth discovery.
- Run safe read-only commands to inspect stdout/stderr separation.
- Exercise at least one success path and one validation or usage failure.
- Classify findings by whether agents cannot parse, cannot continue, may retry incorrectly, may block, or only lose convenience.
- Design or patch the CLI contract in this order: pure data output, structured errors, semantic exits, headless flags, destructive safeguards, repair loops, help docs.
- Re-run evidence commands and confirm the contract holds.
Pitfalls And Gotchas
- JSON printed after progress text is not machine-readable output.
- A single exit code
1forces brittle string parsing. - Hidden pagers, prompts, auth flows, and confirmations cause unattended runs to hang.
- Broad
fixorsynccommands can hide writes that should be explicit. - Raw request escape hatches become dangerous when treated as the primary interface.
- Human-friendly help can still be useless to agents if it omits field shapes and exit codes.
Progressive Disclosure
Start with the five core contract checks: pure machine output, stderr separation, semantic exits, noninteractive behavior, and structured errors. Load deeper async, pagination, auth, or repair-loop design only for commands that actually need those surfaces.
Verification Pattern
- Confirm
--jsonor equivalent output is parseable by a strict JSON parser. - Confirm progress and logs go to stderr.
- Confirm success, usage, auth, not-found, validation, conflict, and retryable failures have distinct machine signals.
- Confirm headless commands complete or fail without prompting.
- Confirm destructive commands support dry-run and explicit confirmation.
- Confirm repairable workflows return enough structured feedback for an agent to fix and retry.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

