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.

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

💻DeveloppementIntermediateGemini

Gemini Prompt for Generating SQL Queries

Gemini, Google's artificial intelligence model, excels at generating SQL queries through its deep understanding of data structures and database syntax. Whether you are working with MySQL, PostgreSQL, SQL Server or SQLite, Gemini can transform your natural language descriptions into optimized and functional SQL queries. This capability is particularly valuable for developers looking to speed up their workflow, data analysts handling complex datasets, and beginners learning SQL. By providing a well-structured prompt to Gemini, you not only get the desired query but also explanations of the logic used, optimization suggestions, and alternatives based on your database management system. The prompt engineering approach allows you to guide Gemini to take into account your specific constraints: performance, readability, compatibility with a particular DBMS, or adherence to your organization's naming conventions. Discover how to formulate your prompts to get the most out of Gemini in generating SQL queries.

0272
💻DeveloppementIntermediateAll AIs

Perplexity Prompt for Generating Python Code

Perplexity AI stands out from other AI assistants with its unique ability to combine real-time web search and code generation. When it comes to producing Python code, this advantage is significant: Perplexity can rely on the latest official documentation, current best practices, and up-to-date libraries to generate reliable and modern code. Unlike a classic LLM whose knowledge is frozen at a cutoff date, Perplexity verifies its sources in real time, drastically reducing the risk of obsolete code or deprecated functions. Whether you are a developer looking to speed up your workflow, a data scientist wanting to prototype quickly, or a beginner learning Python, a well-structured prompt turns Perplexity into a true development assistant. The key lies in the precision of your request: by specifying the technical context, constraints, and expected output format, you get production-ready code rather than a generic snippet. This guide offers optimized prompts to get the most out of Perplexity in your Python projects.

0185
💻DeveloppementIntermediateClaude

Prompt Claude for Generating Python Code

Claude, developed by Anthropic, is one of the most powerful AI assistants for generating Python code. With its deep understanding of programming paradigms, best practices, and popular libraries, Claude can produce clean, documented, and functional code in seconds. Whether you are a beginner developer looking to learn by example, or a professional wanting to speed up your workflow, knowing how to formulate an effective prompt makes all the difference between a generic snippet and production-ready code. The challenge is not simply to ask "write Python code", but to provide enough context — objective, constraints, style, error handling — so that Claude generates exactly what you need. A well-structured prompt yields code that follows PEP 8 conventions, includes type hints, handles edge cases, and integrates naturally into your existing project. In this guide, you will find an optimized main prompt as well as variants tailored to each expertise level to get the most out of Claude in your Python projects.

0322
💻DeveloppementIntermediateGemini

Gemini Prompt to Create a REST API

Creating a REST API is a fundamental skill in modern development, but it involves many architectural decisions: choice of framework, endpoint structure, authentication management, data validation, and documentation. Google Gemini excels at generating structured code and can guide you through each step of this process. Using a well-crafted prompt, you not only get the skeleton of your API but also best practices built in from the start: proper HTTP codes, centralized error handling, security middleware, and layered architecture. Whether you're building a microservice for a personal project or an enterprise API designed to handle thousands of requests, Gemini adapts its response to the requested complexity level. The main benefit is time savings during the scaffolding phase: instead of spending hours manually configuring each component, you get a solid, coherent foundation in seconds, which you can then customize to your specific business needs.

0229