P
💻DeveloppementIntermediateAll AIs

Create a Professional Node.js CLI Tool from A to Z

A prompt to generate a complete Node.js command-line tool, from architecture to npm deployment, with argument handling, colors and configuration.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un développeur Node.js senior spécialisé dans la création d'outils en ligne de commande. Crée un CLI complet en Node.js pour [DESCRIPTION DE L'OUTIL ET SON OBJECTIF PRINCIPAL].

Spécifications techniques :

  • Nom du CLI : [NOM DU CLI]
  • Runtime : Node.js (version 18+)
  • Langage : [javascript|typescript]
  • Gestionnaire de paquets : [npm|pnpm|yarn]

Fonctionnalités attendues :

  1. Parsing des arguments et options avec une librairie moderne (commander, yargs ou meow)
  2. Sous-commandes organisées logiquement selon les cas d'usage
  3. Aide intégrée (--help) auto-générée pour chaque commande
  4. Gestion des couleurs et du formatage terminal (chalk/picocolors)
  5. Indicateurs de progression pour les opérations longues (ora/cli-progress)
  6. Fichier de configuration (.rc ou .config.json) avec résolution hiérarchique
  7. Gestion d'erreurs propre avec codes de sortie appropriés
  8. Mode verbose/debug activable par flag

Livre les éléments suivants :

  • Structure complète du projet avec arborescence des fichiers
  • package.json configuré avec le champ "bin" et les métadonnées npm
  • Code source de chaque fichier avec commentaires explicatifs
  • Fichier README.md avec exemples d'utilisation
  • Tests unitaires pour les commandes principales
  • Instructions pour le développement local (npm link) et la publication npm

Respecte ces bonnes pratiques :

  • Shebang #!/usr/bin/env node en tête du point d'entrée
  • Séparation claire entre parsing CLI et logique métier
  • Messages d'erreur explicites dirigés vers stderr
  • Support des signaux (SIGINT/SIGTERM) pour un arrêt propre
  • Code ESM (import/export) avec type: module dans package.json

Personalize this prompt with Léa

Answer 3 questions and Léa tailors the prompt to your situation.

Why this prompt works

<p>This prompt guides the AI to produce a professional, publish-ready Node.js CLI. By specifying the <strong>tool description</strong> and its <strong>name</strong>, you get a structured project with argument parsing, subcommands, color handling and configuration file — all the standards expected of a good terminal tool.</p><p>The strength of this prompt lies in the separation it enforces between <strong>CLI parsing</strong> (arguments, options, help) and <strong>business logic</strong>. This architecture makes the code testable and maintainable. The required unit tests ensure each command works correctly before publishing.</p><p>Adapt the variables to your needs: choose <strong>TypeScript</strong> for a robust project with autocompletion, or <strong>JavaScript</strong> for quick prototyping. The prompt also covers often-forgotten steps like <ul><li>Configuring the <strong>bin</strong> field in package.json</li><li>Local development with <strong>npm link</strong></li><li>Proper <strong>system signal</strong> handling to avoid zombie processes</li></ul></p>

Use Cases

Create a scaffolding tool to generate projects from templatesDevelop an internal deployment CLI to automate production releasesBuild a data migration tool between databases or APIs

Expected Output

A complete Node.js CLI project with file tree, commented source code, configured package.json, unit tests and npm publishing instructions. The code is modular, follows ESM conventions and includes error handling and system signal management.

Learn more

Check the full skill on Prompt Guide to master this technique from A to Z.

View on Prompt Guide

Comments

Be the first to comment on this prompt.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Similar Prompts

💻DeveloppementIntermediateChatGPT

Write Integration Tests for an API

Create complete API integration tests with database setup, authentication, CRUD, and end-to-end scenarios.

29243
💻DeveloppementAdvancedClaude

Set Up Application Observability

Implement the three pillars of observability (logs, metrics, traces) with OpenTelemetry, Prometheus, and Grafana dashboards.

44239
💻DeveloppementIntermediateAll AIs

Generate Precise Regular Expressions with AI

This prompt generates precise and documented regular expressions, tailored to your programming language, with detailed explanations and built-in tests.

0172
💻DeveloppementIntermediateAll AIs

DALL-E Prompt to Generate JavaScript Code

DALL-E, the image generation model developed by OpenAI, is not designed to produce executable JavaScript code. However, it can play a valuable complementary role in a JavaScript developer's workflow. DALL-E excels at creating visuals related to development: user interface mockups, architecture diagrams, data flow schemas, or illustrations to document your code. By crafting precise prompts, you can obtain visual representations of complex JavaScript concepts like closures, the event loop, or design patterns. These visuals then serve as references for implementing your code, creating attractive technical documentation, or designing educational materials. The approach is to use DALL-E as a rapid visual prototyping tool: generate a UI mockup, then translate it into JavaScript components. This method accelerates the design phase and reduces back-and-forth between designers and developers. In this guide, we offer optimized prompts to get the most out of DALL-E in your JavaScript development process, from UI prototyping to visual documentation of your code.

018