citty

Define and dispatch TypeScript-first CLIs with argument parsing and subcommands.

7|4|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/nklisch/skills --skill citty
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: citty
Source: https://github.com/nklisch/skills/tree/main/.agents/skills/citty
Command: npx skills add https://github.com/nklisch/skills --skill citty

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a compact, TypeScript-first framework for defining and running command-line interfaces so developers can avoid boilerplate argument parsing, subcommand wiring, and lifecycle management while keeping zero runtime dependencies.

Core Features & Use Cases

  • Declarative command definitions: defineCommand expresses metadata, arguments, subcommands, and lifecycle hooks in a single typed object.
  • Flexible dispatch modes: runMain handles real processes with help/version handling and exits, while runCommand supports programmatic invocation for testing.
  • Lazy and async subcommands: load heavy command implementations on demand via functions or dynamic imports to speed startup.
  • Use Case: Create installer or developer tooling CLIs that require positional and boolean options, nested subcommands, consistent help output, and safe cleanup hooks.

Quick Start

Declare your command with defineCommand including args and subCommands, then invoke runMain(main) to parse argv and dispatch.

Frequently Asked Questions about citty

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a TypeScript CLI with subcommands without adding heavy dependencies?

Use a TypeScript-first command-line framework to define commands and subcommands in a single typed object. This provides argument parsing, boolean options, and lifecycle hooks with zero runtime dependencies, avoiding heavy boilerplate.

What is the best way to parse kebab-case command-line arguments into camelCase in Node.js?

Use a TypeScript-first CLI framework that automatically applies kebab-to-camel parsing for arguments. This ensures typed, consistent variable names in your code without manual string transformation or external parsing libraries.

Can I load subcommands dynamically or asynchronously in a Node.js CLI?

Yes, you can load subcommands on demand via functions or dynamic imports. This lazy and async subcommand loading speeds up startup time for installer or developer tooling CLIs by fetching heavy implementations only when needed.

Does this CLI framework support programmatic invocation for testing without exiting the process?

Yes, the framework supports programmatic invocation via runCommand, which parses arguments and dispatches logic without forcing a process exit. This allows safe testing, while runMain handles real processes with automatic exit.

How do I add setup and cleanup lifecycle hooks to a command-line application?

Define lifecycle hooks for setup and cleanup directly within the declarative command object using defineCommand. These hooks execute safely around your CLI's dispatch process, ensuring proper resource management for developer tooling.

Are automatic help and version flags included when defining a TypeScript CLI?

Yes, automatic help and version flags are generated when you invoke runMain. The framework handles consistent help output and version display natively, reducing boilerplate for your Node.js command-line applications.