CtrlK
BlogDocsLog inGet started
Tessl Logo

alonso-skills/cli-building

Skill for building TypeScript CLIs using citty, @clack/prompts, and @bomb.sh/tab

76

Quality

95%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

SKILL.md

name:
cli-building
description:
Use when building TypeScript CLIs. Guides command structure, interactive prompts, and tab completion using citty, `@clack/prompts`, and `@bomb.sh/tab` — and shipping them: CI gates, versioning (Changesets / release-please), and npm or single-binary release.

Citty CLI

Quick Start

npm install citty `@bomb.sh/tab` `@clack/prompts`

Minimal command:

import { defineCommand, runMain } from 'citty';

export default defineCommand({
    meta: { name: 'greet', description: 'Say hello' },
    args: { name: { type: 'string', description: 'Your name', required: true } },
    run({ args }) { console.log(`Hello, ${args.name}!`); },
});

Critical Rules

  1. Every command exports default defineCommand() — no exceptions
  2. Lazy-load subcommands() => import('./cmd').then(m => m.default)
  3. Check isCancel() after every @clack/prompts call — never skip
  4. Citty handles all arg parsing — no external parsers
  5. Architecture is opt-in — only suggest cli/ structure when the user asks for project layout or scaffolding. Single-file CLIs are valid.

Architecture (only when user asks for structure)

See architecture for the full cli/ layout with commands, prompts, and lib directories. Do not impose this structure unless the user explicitly asks for scaffolding or project organization.

Workflow

  1. Define commands — commands
  2. Add prompts if interactive — prompts
  3. Wire tab completion — tab-completion
  4. Scaffold cli/ if multi-command — architecture
  5. Configure bin entry — sidecar setup
  6. Verify — run with --help to confirm command registration
  7. Ship it — CI gates, versioning, npm or binary release — release

References

SKILL.md

tile.json