adding-a-command

adding-a-command is a skill for Claude Code, Codex from caliber-ai-org/ai-setup. It costs 76 tokens per session (1,851 once invoked), scanned A, original, MIT.

A coding guide for adding new command-line commands to a TypeScript app that uses Commander.js, a library for building command-line tools.

In plain words
What is it for?
Use it when creating a command or subcommand, especially when adding a file under src/commands/.
Why use it?
It keeps new commands consistent with the app’s registration, options, error handling, and usage tracking rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { loadConfig } from '../llm/config.js';.

Good fit Use it when creating a command or subcommand, especially when adding a file under src/commands/.

Compare 6 skills from other repositories ↓
About the project

Caliber is a tool that generates and continuously updates AI context and configuration files for software repositories, including CLAUDE.md, AGENTS.md, and platform-specific rules. Development teams use it to keep coding agents aligned with the current codebase across tools such as Claude Code, Cursor, Codex, OpenCode, and GitHub Copilot. Its catalogue entries include skills, hooks, rules, instructions, and settings for configuring that workflow.

caliber-ai-org/ai-setup · 1,307 stars · on GitHub · trycaliber.ai

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/caliber-ai-org/ai-setup
agentmods
npx agentmods add skills/caliber-ai-org/ai-setup/adding-a-command

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for adding-a-command

README.md
[![agentmods](https://agentmods.dev/badge/skills/caliber-ai-org/ai-setup/adding-a-command/github.svg)](https://agentmods.dev/skills/caliber-ai-org/ai-setup/adding-a-command)
Your own site
<a href="https://agentmods.dev/skills/caliber-ai-org/ai-setup/adding-a-command"><img src="https://agentmods.dev/badge/skills/caliber-ai-org/ai-setup/adding-a-command/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for adding-a-command

Your own site · 80×15
<a href="https://agentmods.dev/skills/caliber-ai-org/ai-setup/adding-a-command"><img src="https://agentmods.dev/badge/skills/caliber-ai-org/ai-setup/adding-a-command.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,851 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00076 $0.01851
Opus 5.5 $0.00030 $0.00740
Sonnet 5.5 $0.00015 $0.00370
Haiku 4.5 $0.00008 $0.00185

Measured 1mo ago against content hash 73e93413cd36, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

adding-a-command scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/adding-a-command/SKILL.md · 181 lines

How it starts

The opening of the file, as written. The whole thing — 181 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Adding a Command

Critical

  • Export pattern: Command must export a named async function: export async function myCommand(options?: OptionType). Never use default exports.
  • Registration in cli.ts: Every command must be imported and registered with .command() chain in src/cli.ts, wrapped with tracked() for telemetry.
  • Error signaling: Use throw new Error('__exit__') to exit gracefully without printing the error message. Use chalk for user-facing messages.
  • Options typing: Commands receiving options must define a TypeScript interface for those options. Pass options as a destructured object parameter.

Instructions

  1. Create the command file at src/commands/{commandName}.ts with named async export.

    • Signature: export async function {commandName}Command(options?: { optionName?: optionType }) { ... }
    • Import only what you need (avoid kitchen-sink imports).
    • Return void (handle all output via console.log or chalk).
    • Verify the file follows the naming convention: camelCase function + "Command" suffix.
  2. Handle errors consistently: Wrap error-prone operations in try/catch. Distinguish between user errors and system errors:

    • User error (bad input): console.error(chalk.red('message')); throw new Error('__exit__');
    • System error (missing dependency): throw new Error('Detailed error message'); — this will print and exit with code 1.
    • Parse-like errors: Use ora spinner with .fail() before throwing.
    • This step prevents double error printing in bin.ts.
  3. Import and register in src/cli.ts in the correct location:

    • Add import at the top: import { {commandName}Command } from './commands/{commandName}.js';
    • Register the command in the appropriate section (main commands, or nested under a group like sources).
    • For main commands: .command('{kebab-name}').description('...').option(...).action(tracked('{kebab-name}', {commandName}Command))
    • For subcommands (like sources add): sources.command('add').description(...).action(tracked('sources:add', sourcesAddCommand))
    • Key: Wrap handler with tracked('{command-name}', handler) for automatic telemetry.
    • Verify the command name in tracked() uses kebab-case for main commands and colon-separated for subcommands.

Read the full file on GitHub · 181 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 181 lines · 76 tokens per session scan A 73e93413cd36

Subscribe to this mod's changes

adding-a-command is a skill published in the GitHub repository caliber-ai-org/ai-setup (1,307 stars, last pushed 23d ago), licensed MIT. It adds 76 tokens to every session and 1,851 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.