---
name: cli-skill-forge
description: Build or refresh an Anteroom skill for any existing CLI by discovering its command tree once, caching the results, and scaffolding a per-tool skill that avoids repeated --help calls.
---

# CLI Skill Forge

Use this skill when a team already has a real CLI for an internal system and you want Anteroom to use that CLI efficiently without rediscovering its syntax on every turn.

Good fit:
- internal CLIs for Jira, Confluence, Bitbucket, deploy, admin, or ticketing workflows
- a CLI with many subcommands and flags
- repeated wasted turns from `--help`, argument errors, and another `--help`
- building or refreshing a reusable per-tool Anteroom skill

## Goal

Produce a per-tool skill that:
- knows the CLI command tree up front
- preloads cached references with `resources:`
- avoids `--help` by default
- falls back to narrow help inspection only when a real usage mismatch occurs

## Workflow

### 1. Confirm the CLI entrypoint

Identify:
- binary name or absolute path
- any required global flags
- auth or profile env vars
- whether the CLI supports `--help`, `-h`, or `help`

Do a light preflight first:
- version or identity command if it exists
- one root help call only if the help style is unknown

### 2. Discover the command tree once

Run the discovery script:

```bash
python3 ~/.anteroom/skills/cli-skill-forge/scripts/discover_cli.py \
  --tool jira \
  --output-dir /tmp/jira-cli-discovery \
  -- jira
```

If the CLI needs a different help style, add options such as:

```bash
python3 ~/.anteroom/skills/cli-skill-forge/scripts/discover_cli.py \
  --tool confluence \
  --output-dir /tmp/confluence-cli-discovery \
  --help-style append-flag \
  --help-style prepend-help \
  --help-flag --help \
  --help-flag -h \
  -- confluence --profile corp
```

Discovery writes:
- `manifest.json` with the command tree, options, and captured help paths
- `summary.md` with a readable command map
- `help/` with raw captured help output per node

### 3. Sanity-check the discovery output

Inspect:
- root commands
- the subcommands you expect to use most
- whether options were extracted cleanly
- whether recursion went too wide into irrelevant helper commands

If needed, rerun with:
- smaller `--max-depth`
- smaller `--max-subcommands`
- a different help style or help flag

### 4. Scaffold the per-tool skill

Generate the skill:

```bash
python3 ~/.anteroom/skills/cli-skill-forge/scripts/scaffold_cli_skill.py \
  --tool-name jira \
  --binary jira \
  --manifest /tmp/jira-cli-discovery/manifest.json \
  --summary /tmp/jira-cli-discovery/summary.md \
  --output-dir ~/.anteroom/skills
```

This creates a skill directory such as `~/.anteroom/skills/jira-cli/`.

### 5. Tighten the generated skill

Open the generated `SKILL.md` and add:
- auth or profile expectations
- your team’s most common workflows
- concrete command examples
- any safety rules for destructive commands

Keep the generated rules intact:
- use cached references first
- do not call `--help` by default
- if a command fails with usage output, inspect only the narrowest relevant help and retry once

## Operating Rules

When using this skill:
- prefer the discovery scripts over manual copy and paste
- keep generated `SKILL.md` files short and store detail under `references/`
- treat the manifest as the primary syntax source
- refresh the manifest when the CLI changes instead of reteaching the model ad hoc

## Output Shape

The generated per-tool skill should contain:
- `SKILL.md`
- `references/cli-manifest.json`
- `references/command-summary.md` when available

The generated skill uses `resources:` so Anteroom preloads the cached manifest and summary before execution.
