agentleFS
gh-xjgh-xj/agent-repo-kit/skills/skill-cli-authoring/SKILL.md

skill-cli-authoring

Skill0 starsChanged 6 months agoMITView on GitHub

Use when creating, refactoring, or promoting a CLI that lives inside an agent skill, especially a skill-local cli/ tool with agent-friendly JSON output, safe write commands, dry-run behavior, exit codes, Taskfile smoke tests, or a companion SKILL.md routing contract. Triggers on 'build a CLI inside a skill', 'skill-local CLI', 'agent-friendly CLI', 'add cli/ to a skill', 'promote skill script to CLI', 'JSON output contract for a skill tool', or 'CLI for agents to use from a skill'.

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 7 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 20
  2. Distinctive:

    Do not use for:

    line 30
  3. Distinctive:

    Reads and writes stay distinct: Read commands should be safe, parseable, and composable.

    line 46
  4. Very specific:

    Define the command contract: Write concrete examples first.

    line 68
  5. Very specific:

    Wire verification: Add smoke tests, fixtures, schema checks, and Taskfile wrappers using references/verification.md and taskfile-authoring.

    line 76
  6. Very specific:

    Update the parent skill: Keep SKILL.md as the router: command examples, when to run the CLI, and what output proves success.

    line 78
  7. Distinctive:

    Prefer subcommands with explicit nouns and verbs:

    line 83
  8. Distinctive:

    When shaping a skill-local CLI, return:

    line 122
  9. Distinctive:

    Do not hide complex workflow policy inside a CLI just because it is easier than writing a clear skill.

    line 134
  10. Distinctive:

    Do not make the CLI depend on a hosted service unless that is the domain it wraps and offline failure is explicit.

    line 136
  11. Very specific:

    Do not duplicate implementation boilerplate from go-scripting.

    line 138
  12. Very specific:

    Do not duplicate Taskfile recipes from taskfile-authoring.

    line 139

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill CLI Authoring

Canonical source: skill-cli-authoring/SKILL.md in the agent-repo-kit repository. All references/... links below resolve from that path. If you are reading this in an adapter mirror (adapters/claude-code/, adapters/codex/, adapters/cursor/), open the canonical file to reach the references.

Design and build small CLIs that live inside skills. The goal is not a clever terminal product; it is a deterministic tool surface an agent can discover, run, parse, retry, and verify.

When To Use

Use this skill when:

  • A skill repeatedly asks agents to perform deterministic shell steps.
  • A skill needs a local cli/ tool instead of fragile prose or ad hoc scripts.
  • A skill-local script has grown into multiple commands, flags, or data shapes.
  • A command contract needs --json, --ndjson, exit codes, or output schemas.
  • A mutating skill operation needs --dry-run, --yes, idempotency, or audit output.
  • A skill's SKILL.md needs to route agents to a companion CLI.

Do not use for:

  • General Go CLI implementation details — use go-scripting.
  • Taskfile mechanics, build caching, or task ci design — use taskfile-authoring.
  • Deciding whether knowledge belongs in a skill at all — use skill-builder or harness-router.
  • One-off shell glue under ~30 lines with no stable contract — keep it as a script.

Core Principles

  1. CLI only after repetition. Build a CLI when the same deterministic operation is being re-derived, mis-run, or copied across sessions.
  2. Contracts beat prose. Stable flags, JSON fields, exit codes, and smoke checks are easier for agents to honor than long instructions.
  3. Reads and writes stay distinct. Read commands should be safe, parseable, and composable. Write commands should be explicit, auditable, and guarded.
  4. Human text is secondary. Plain output can be friendly, but machine output is the durable contract.
  5. Skill prose routes, CLI executes. SKILL.md should say when and why to use the CLI. The CLI should own deterministic behavior.

Quality Notes

  • Evidence basis: composed from skill-builder, go-scripting, taskfile-authoring, current agent-tooling docs, and repeated local need for skill-owned CLIs.
  • Risk tier: high. This skill designs tools that may run shell commands or mutate files, so command contracts, safety classes, and verification are required before implementation.
  • Procedural burden: medium. Keep judgment in references and deterministic behavior in the CLI once the pattern stabilizes.

Workflow

  1. Classify the extraction. Choose script, skill-local CLI, or repo-owned CLI using references/layout-and-routing.md.
  2. Define the command contract. Write concrete examples first; then specify flags, JSON/NDJSON shape, exit codes, and no-op behavior. Use references/command-contract.md.
  3. Design safety for writes. Mark each command read-only, additive, idempotent, destructive, or open-world. Add --dry-run, --yes, or explicit target flags where needed. Use references/safety-and-mutations.md.
  4. Choose implementation stack. For Go CLIs, hand off implementation style to go-scripting. Keep this skill focused on the agent-facing contract.
  5. Wire verification. Add smoke tests, fixtures, schema checks, and Taskfile wrappers using references/verification.md and taskfile-authoring.
  6. Update the parent skill. Keep SKILL.md as the router: command examples, when to run the CLI, and what output proves success.

Default Command Shape

Prefer subcommands with explicit nouns and verbs:

skill-tool search --query "..." --json
skill-tool show ITEM-ID --json
skill-tool plan --source input.json --json
skill-tool apply PLAN-ID --dry-run --json
skill-tool apply PLAN-ID --yes --json

For machine output:

{
  "schema_version": "v1",
  "ok": true,
  "command": "apply",
  "changed": false,
  "result": {}
}

References

FileUse For
references/core-principles.mdProduct stance and AI-era CLI principles
references/layout-and-routing.mdScript vs skill-local CLI vs repo-owned CLI decisions
references/command-contract.mdCommand grammar, JSON/NDJSON, errors, exit codes
references/safety-and-mutations.mdDry-run, destructive gates, idempotency, audit output
references/verification.mdSmoke tests, schemas, fixtures, Taskfile wiring
references/research.mdExternal references and comparable project patterns
references/evals.mdTrigger and output eval cases for maintaining the skill
references/templates/CLI_CONTRACT.mdStarter contract for a skill-local cli/CONTRACT.md
references/templates/README.skill-cli.mdStarter cli/README.md for agent-facing commands
references/templates/Taskfile.skill-cli-smoke.ymlThin smoke-test Taskfile fragment

Output Shape

When shaping a skill-local CLI, return:

  • command examples
  • contract decisions
  • safety model
  • layout and ownership
  • verification plan
  • parent SKILL.md routing text
  • open gaps or promotion triggers

Boundaries

  • Do not hide complex workflow policy inside a CLI just because it is easier than writing a clear skill.
  • Do not make the CLI depend on a hosted service unless that is the domain it wraps and offline failure is explicit.
  • Do not duplicate implementation boilerplate from go-scripting; reference it.
  • Do not duplicate Taskfile recipes from taskfile-authoring; reference it.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.