en un clic
cli-development
This skill should be used when the user asks to 'add a command', 'parse arguments', 'improve CLI output', or 'add interactive features'. Covers command routing, argument parsing, and stdio handling.
Menu
This skill should be used when the user asks to 'add a command', 'parse arguments', 'improve CLI output', or 'add interactive features'. Covers command routing, argument parsing, and stdio handling.
This skill should be used when the user asks to 'create an agent', 'add tool calling', 'build workflows', or 'orchestrate AI tasks'. Guides agentic AI patterns and multi-step reasoning.
This skill should be used when the user asks to 'integrate an API', 'handle streaming responses', 'add authentication', or 'manage API calls'. Covers Claude API integration and streaming patterns.
This skill should be used when the user asks to 'scan directories', 'read files', 'parse JSON or Markdown', or 'traverse the file system'. Guides safe file I/O patterns and recursive directory operations.
This skill should be used when the user asks to 'generate Markdown', 'create documentation', 'structure content', or 'format skill definitions'. Covers Markdown generation and structured documentation patterns.
This skill should be used when the user asks to 'create a CLI tool', 'handle file system operations', 'manage processes', or 'configure runtime behavior'. Guides Node.js 20.x patterns and native APIs.
This skill should be used when the user asks to 'add types', 'fix type errors', 'create interfaces', 'improve type safety', or 'configure TypeScript'. Provides TypeScript strict mode patterns and ESM configuration for Node.js projects.
| name | cli-development |
| description | This skill should be used when the user asks to 'add a command', 'parse arguments', 'improve CLI output', or 'add interactive features'. Covers command routing, argument parsing, and stdio handling. |
| version | 1.0.0 |
| metadata | {"internal":false} |
Command-line interface patterns for rumpleskill, built on native Node.js without external CLI frameworks.
process.argv and dispatch to generator functions--verbose manuallyagents)--verbose)ANTHROPIC_API_KEY)// src/index.ts
const args = process.argv.slice(2);
const command = args[0];
const flags = args.slice(1);
if (command === "agents") {
await generateClaudeMd();
} else {
console.error(`Unknown command: ${command}`);
process.exit(1);
}
When to use: Entry point for all CLI commands. Keep routing logic in src/index.ts.
const verbose = args.includes("--verbose");
if (verbose) {
// Enable stream-json output with inherited stdio
await callClaude(prompt, context, { stream: true });
} else {
// Buffer and return complete response
const result = await callClaude(prompt, context);
console.log(result);
}
When to use: For boolean flags. Extract before passing to generators.
// src/utils/claude.ts
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
});
const stream = await anthropic.messages.create({
model: "claude-sonnet-4-5-20250929",
max_tokens: 16000,
messages: [{ role: "user", content: prompt }],
stream: true,
});
for await (const chunk of stream) {
if (chunk.type === "content_block_delta") {
process.stdout.write(chunk.delta.text);
}
}
When to use: For real-time feedback during long-running API calls. Users see progress immediately.
try {
const result = await generateClaudeMd();
console.log(result);
} catch (error) {
console.error("Error:", error.message);
process.exit(1);
}
When to use: Wrap all command execution. Always exit with code 1 on failure.
src/index.ts minimal - Only routing logic, delegate to generators--verbose before calling generatorsANTHROPIC_API_KEY exists before API callsprocess.exit(1) for errors, 0 for success.slice(2): process.argv includes node and script path - always sliceconsole.log() inside stream loops, use process.stdout.write()Add command to router in src/index.ts:
if (command === "my-command") {
await generateMyCommand();
}
Create generator in src/generators/my-command.ts:
export async function generateMyCommand(): Promise<string> {
const context = await scanDirectory(process.cwd());
return await callClaude(MY_COMMAND_PROMPT, context);
}
Test with dev script:
npm run dev -- my-command
process.argv docs: https://nodejs.org/api/process.html#processargv