agentleFS
jpeakaijpeakai/skills/skills/cli/SKILL.md

cli

Skill0 starsChanged 3 months agoMITView on GitHub

Playbook for building and extending project-local developer CLIs and the recurring assets they generate, so the same patterns are never re-derived from scratch. Use when: scaffolding or adding a subcommand to a repo CLI (argparse/Typer, project-root discovery, packaged assets); generating a STATIC HTML single-page viewer (client-side SPA routing, collapsible sidebar, light/dark + rebrandable design-tokens theming, Cytoscape graph or Plotly chart, generate/serve, --inline single-file, --archive zip); templating GitHub Actions workflows from a base template (create/update/validate, trigger-path glob distillation, reusable composite-action assets); using git worktrees to act on another branch/ref safely; autogenerating SVG/PNG diagrams from a stencil pack; or automating sticky PR comments and embedding a CI-run artifact image in a PR comment. Skip for non-CLI app code, or one-off scripts with no reuse. Invoke as /cli or when the user names one of these patterns.

14 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every pattern here is distilled from working implementations.

    line 12
  2. Very specific:

    When a task spans several (e.g.

    line 26
  3. Very specific:

    Re-skin instead of rebuild: if a viewer already exists, you almost never fork the JS/HTML — edit design-tokens.json (palette/fonts/brand) …

    line 59

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “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

Building project CLIs (and the assets they generate)

A field guide to the patterns that recur across project-local developer CLIs, so you implement each once, well and re-skin/re-use it rather than re-deriving it. Every pattern here is distilled from working implementations; the depth (with copy-pasteable skeletons) lives in resources/ — load the one you need.

Route by intent

You are about to…Reach forResource
Scaffold a CLI / add a subcommand; find the project root; ship data filesthe shared CLI skeletonresources/cli-foundations.md
Generate a static HTML viewer (SPA, sidebar, themes, Cytoscape/Plotly, serve, inline, archive)the static-SPA-viewer patternresources/static-spa-viewer.md
Create/update/validate a GitHub Actions workflow from a template; derive trigger pathsthe GHA-templating patternresources/gha-templating.md
Build an artifact from another branch/ref without disturbing the work treethe git-worktree patternresources/git-worktrees.md
Autogenerate SVG + PNG diagrams from a stencil icon packthe stencil-diagram patternresources/svg-diagrams.md
Post/upsert a PR comment; embed a CI-run image artifact in a PR commentthe PR-comment patternresources/pr-comments.md

When a task spans several (e.g. "a CLI that generates a viewer and posts it to the PR"), start at cli-foundations.md for the skeleton, then pull each feature resource in turn.

Non-negotiable conventions (apply to every pattern)

These hold across all the resources; they are the house contract a new CLI inherits.

  • Fail loud, never degrade. A missing dependency, unresolved project root, or absent artifact raises with a clear message — never a silent skip or a fallback to a weaker path. (Optional features that are genuinely environmental — e.g. a best-effort metadata field — say so explicitly.)
  • Discover the project root; never assume cwd. Explicit --project-dir/flag → env var → walk up for a sentinel file → fail loud. Resolve once, store it, pass it.
  • Ship data files as package data, resolved via importlib.resources / Path(__file__).parent, never a cwd- or repo-relative path — so assets resolve identically from source and as an installed tool.
  • Output discipline: human/log lines → stderr; the machine payload (--json, a resolved path) → stdout only. So tool … --json | jq and X=$(tool print-path) are always safe.
  • Temp/cache under the project's tmp/, never the system /tmp, so artifacts are auditable and git clean-able.
  • app.py/entrypoint is wiring only — no business logic; handlers live in commands/. Read-only subcommands use status/validate/analyse; generators use create/generate/update; destructive ones use imperative verbs.

Quickstart

  • In Claude: /cli viewer (or gha, worktree, diagrams, pr-comments) — or describe the goal ("add a generate/serve viewer to my CLI") and the matching resource is loaded and applied.
  • Direct: open the resource for the pattern, copy its reference skeleton, adapt the generic names to your tool, and wire it per cli-foundations.md.
  • Re-skin instead of rebuild: if a viewer already exists, you almost never fork the JS/HTML — edit design-tokens.json (palette/fonts/brand) and re-serve. See static-spa-viewer.md §theming.

Maintaining this skill

See CLAUDE.md for the decision lenses (why each pattern is shaped this way) and the extension checklist. Keep every file ≤ 500 lines and brand-agnostic.

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.