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

Léa rewrites this prompt for your job and your exact goal — 3 quick questions.

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.

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Ajoute un flag `--json` pour la sortie machine-readable (stdout) : utile pour chaîner le CLI avec d'autres outils ou le consommer en script. Place la logique de formatage dans un module dédié, séparé de l’affichage coloré.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

💻DeveloppementAdvancedAll AIs

Analyze and Optimize Algorithmic Complexity

Analyze the Big O complexity of your algorithms and optimize them with appropriate data structures and more efficient algorithms.

40697
💻DeveloppementAdvancedAll AIs

Kubernetes Backup Strategy

Kubernetes Disaster Recovery Plan

0312
💻DeveloppementIntermediateAll AIs

Stable Diffusion Prompt to Generate a Database Schema

Stable Diffusion, primarily known for artistic image generation, can also be used creatively to produce visual representations of database schemas. By crafting precise prompts, you can generate entity-relationship diagrams, conceptual models, or architectural visualizations of data structures. This approach is particularly useful during brainstorming, technical documentation, or when presenting to non-technical stakeholders. Instead of manually drawing your schemas or using conventional tools like dbdiagram.io, Stable Diffusion allows you to create aesthetically pleasing and professional visual representations of your data models. The resulting outputs can serve as illustrations for documentation, technical blog posts, or training materials. It is important to note that Stable Diffusion generates images and not directly usable SQL code. The goal is therefore to produce clear, readable visuals representing the tables, columns, primary keys, relationships, and cardinalities of your database. With the right settings and a well-structured prompt, you will obtain schemas that are both informative and visually attractive.

0380
💻DeveloppementIntermediateAll AIs

Automate Your Git Commits with AI

This prompt analyzes a Git diff and automatically generates structured commit messages following project conventions, with atomic splitting if needed.

0617