adding-a-command
Skill1.3k starsChanged 7 months agoMITView on GitHub
Creates a new CLI command following the Commander.js pattern in src/commands/. Handles command registration in src/cli.ts, telemetry tracking via tracked() wrapper, and option parsing. Use when user says add command, new CLI command, create subcommand, or adds files to src/commands/. Do NOT use for modifying existing commands or fixing bugs in existing commands.
Trending
Less talk lately.about the whole repository
Who's talking about caliber-ai-org/ai-setup
- sudosubin/agents.nix“agent-skills.github.caliber-ai-org.ai-setup: 1.55.1 → 1.55.2”GitHub · Oct 3, 2026
- FlorianBruniaux/claude-code-ultimate-guide“Broken links detected in guide markdown”GitHub · Oct 1, 2026
- sudosubin/agents.nix“agent-skills.github.caliber-ai-org.ai-setup: init at 1.55.1”GitHub · Sep 26, 2026
- FlorianBruniaux/claude-code-ultimate-guide“Broken links detected in guide markdown”GitHub · Sep 2, 2026
- FlorianBruniaux/claude-code-ultimate-guide“Broken links detected in guide markdown”GitHub · Sep 1, 2026
The biggest 5 of 22 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 22
Talked about on GitHub (22 times).
On GitHub · 22
- Oct 3, 2026agent-skills.github.caliber-ai-org.ai-setup: 1.55.1 → 1.55.2 — sudosubin/agents.nix0 reactions
- Oct 1, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions
- Sep 26, 2026agent-skills.github.caliber-ai-org.ai-setup: init at 1.55.1 — sudosubin/agents.nix0 reactions
- Sep 2, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- Sep 1, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
17 more on GitHub
- Sep 1, 2026Broken links detected in guide markdown — AMusso19/CUSTOM-claude-code-ultimate-guide-Florian0 reactions
- Sep 1, 2026Broken links detected in guide markdown — alexica00/claude-code-ultimate-guide0 reactions
- Aug 1, 2026Broken links detected in guide markdown — AMusso19/CUSTOM-claude-code-ultimate-guide-Florian0 reactions
- Aug 1, 2026Broken links detected in guide markdown — alexica00/claude-code-ultimate-guide0 reactions
- Aug 1, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- Jul 1, 2026Broken links detected in guide markdown — AMusso19/CUSTOM-claude-code-ultimate-guide-Florian0 reactions
- Jul 1, 2026Broken links detected in guide markdown — alexica00/claude-code-ultimate-guide0 reactions
- Jul 1, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- Jun 1, 2026Broken links detected in guide markdown — alexica00/claude-code-ultimate-guide0 reactions
- Jun 1, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- May 18, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- May 18, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- May 18, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- May 18, 2026Broken links detected in guide markdown — FlorianBruniaux/claude-code-ultimate-guide0 reactions · 1 comment
- Apr 18, 2026Audit candidate: caliber-ai-org/ai-setup — xiaolai/nlpm0 reactions · 4 comments
- Mar 28, 2026Add Caliber — AI config generation & sync CLI — roboco-io/awesome-vibecoding0 reactions · 1 comment
- Mar 26, 2026feat: charter score — zero-install AI-readiness audit for any repo — Stackbilt-dev/charter0 reactions · 1 comment
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/caliber-conventions.mdcCursor rule
- .cursor/rules/caliber-learnings.mdcCursor rule
- .cursor/rules/caliber-pre-commit.mdcCursor rule
- .cursor/rules/llm-layer.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- adding-a-commandSkill
- caliber-testingSkill
- find-skillsSkill
- llm-providerSkill
- save-learningSkill
- scoring-checksSkill
- setup-caliberSkill
- writers-patternSkill
- adding-a-commandSkill
- caliber-testingSkill
- find-skillsSkill
- llm-providerSkill
- save-learningSkill
- scoring-checksSkill
- setup-caliberSkill
- writers-patternSkill
- adding-a-commandSkill
- caliber-testingSkill
- find-skillsSkill
- llm-providerSkill
- save-learningSkill
- scoring-checksSkill
- setup-caliberSkill
- writers-patternSkill
- caliber-testingSkill
- find-skillsSkill
- llm-providerSkill
- save-learningSkill
- scoring-checksSkill
- setup-caliberSkill
- writers-patternSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 4 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Registration in cli.ts: Every command must be imported and registered with .command() chain in src/cli.ts, wrapped with tracked() for …
- Very specific: line 14
Error signaling: Use throw new Error('__exit__') to exit gracefully without printing the error message.
- Distinctive: line 21
Import only what you need (avoid kitchen-sink imports).
- Distinctive: line 23
Verify the file follows the naming convention: camelCase function + "Command" suffix.
- Very specific: line 32
Add import at the top: import { {commandName}Command } from './commands/{commandName}.js'.
- Distinctive: line 37
Verify the command name in tracked() uses kebab-case for main commands and colon-separated for subcommands.
- Very specific: line 40
Add .option() chains before .action(): .option('--flag', 'Description') or .option('--opt <value>', 'Description')
- Distinctive: line 44
Verify option names use camelCase (Commander converts kebab-case flags to camelCase).
- Very specific: line 59
Create src/commands/status.ts with statusCommand() export
- Very specific: line 60
Import and register in src/cli.ts with tracked() wrapper
- Very specific: line 99
Create src/commands/sources.ts with sourcesAddCommand() export
- Very specific: line 134
Create parseAgentOption() parser in src/cli.ts
- Very specific: line 135
Create src/commands/init.ts with initCommand(options)
- Very specific: line 160
Fix: Use export async function myCommand(...) (not export default).
- Very specific: line 164
Fix: Verify import name matches function export.
- Very specific: line 168
Fix: Use console.error(chalk.red('message')).
- Very specific: line 172
Fix: Add .option('--dry-run', 'Description') and ensure options interface has dryRun?: boolean.
- Very specific: line 180
Fix: Ensure .action(tracked('{kebab-case}', handler)) wraps handler.
- Very specific: line 184
Fix: Always use .js extension: import { x } from '../lib/file.js' (required for ESM).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 insrc/cli.ts, wrapped withtracked()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
- Create the command file at
src/commands/{commandName}.tswith 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.
- Signature:
- 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.
- User error (bad input):
- 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.
- Add import at the top:
- Define options (if needed):
- Add
.option()chains before.action():.option('--flag', 'Description')or.option('--opt <value>', 'Description') - For parsed options (like comma-separated agents), add a parse function:
.option('--opt <value>', 'Description', parseFunction) - Pass options to handler:
.action(tracked('name', (opts) => command(opts))) - Define TypeScript interface for the options object.
- Verify option names use camelCase (Commander converts kebab-case flags to camelCase).
- Add
- Verify before proceeding:
- Function exports correctly and is imported in cli.ts.
- Command is registered with tracked() wrapper.
- Output uses chalk for colors, not plain console.log.
- Error paths throw
new Error('__exit__')for user errors.
Examples
Example 1: Simple command (status)
User says: "Add a command to show config status"
Actions taken:
- Create src/commands/status.ts with statusCommand() export
- Import and register in src/cli.ts with tracked() wrapper
Result: caliber status displays config status; caliber status --json outputs JSON.
Code example:
import chalk from 'chalk';
import { loadConfig } from '../llm/config.js';
export async function statusCommand(options?: { json?: boolean }) {
const config = loadConfig();
if (options?.json) {
console.log(JSON.stringify({ configured: !!config }, null, 2));
return;
}
console.log(chalk.bold('Status'));
console.log(` LLM: ${chalk.green(config?.provider || 'Not configured')}`);
}Registration in src/cli.ts:
import { statusCommand } from './commands/status.js';
program
.command('status')
.description('Show config status')
.option('--json', 'Output as JSON')
.action(tracked('status', statusCommand));Example 2: Subcommand with arguments
User says: "Add a sources add subcommand"
Actions taken:
- Create src/commands/sources.ts with sourcesAddCommand() export
- Register under sources group with tracked('sources:add', ...)
Result: caliber sources add ../lib adds a source.
Code example:
export async function sourcesAddCommand(sourcePath: string) {
if (!fs.existsSync(sourcePath)) {
console.log(chalk.red(`Path not found: ${sourcePath}`));
throw new Error('__exit__');
}
const existing = loadSourcesConfig(process.cwd());
existing.push({ type: 'repo', path: sourcePath });
writeSourcesConfig(process.cwd(), existing);
console.log(chalk.green(`Added ${sourcePath}`));
}Registration:
const sources = program.command('sources');
sources
.command('add')
.argument('<path>', 'Path to add')
.action(tracked('sources:add', sourcesAddCommand));Example 3: Command with option parsing
User says: "Add init with --agent flag supporting comma-separated values"
Actions taken:
- Create parseAgentOption() parser in src/cli.ts
- Create src/commands/init.ts with initCommand(options)
- Register with custom parser
Result: caliber init --agent claude,cursor passes parsed array to handler.
Parser code:
function parseAgentOption(value: string) {
const agents = value.split(',').map(s => s.trim().toLowerCase());
if (agents.length === 0) {
console.error('Invalid agent');
process.exit(1);
}
return agents;
}
program.command('init')
.option('--agent <type>', 'Agents (comma-separated)', parseAgentOption)
.action(tracked('init', initCommand));Common Issues
Issue: "SyntaxError: The requested module does not provide an export named 'myCommand'"
- Cause: Function not exported or exported as default instead of named.
- Fix: Use
export async function myCommand(...)(notexport default).
Issue: Command appears in help but crashes when run
- Cause: Handler not wrapped with
tracked()or function import mismatch. - Fix: Verify import name matches function export. Wrap with
tracked('command-name', handler).
Issue: "Error: exit" appears in output for user errors
- Cause: Throwing generic error instead of using error exit pattern.
- Fix: Use
console.error(chalk.red('message')); throw new Error('__exit__');for user-facing errors.
Issue: --dry-run flag not recognized
- Cause: Option not declared with
.option()or wrong camelCase in interface. - Fix: Add
.option('--dry-run', 'Description')and ensure options interface hasdryRun?: boolean.
Issue: Subcommand crashes but parent command works
- Cause: Using
program.command()instead ofgroupVar.command()for subcommands. - Fix: Register on group:
const sources = program.command('sources'); sources.command('add')...
Issue: Telemetry not appearing
- Cause: Handler not wrapped with
tracked()or wrong command name. - Fix: Ensure
.action(tracked('{kebab-case}', handler))wraps handler. Use colon for subcommands like 'sources:add'.
Issue: "Cannot find module" with relative imports
- Cause: Using
.tsextension in imports. - Fix: Always use
.jsextension:import { x } from '../lib/file.js'(required for ESM).
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
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.

