Skip to content
OpenSmartRoute
Skillv1.0.0

inquirer

Build interactive CLI prompts with Inquirer.js. Use when creating interactive terminal UIs, multi-step wizards, form-like CLI inputs, or configuration generators with user input.

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/inquirer/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill inquirer. Copyright stays with the author (Apache-2.0).

Inquirer.js

Overview

Inquirer provides interactive prompts for CLIs — text input, confirmations, lists, checkboxes, passwords, and editors. The v2 API is modular (import only what you use) and supports themes, validation, and transformations.

Instructions

Step 1: Prompts

import { input, select, confirm, checkbox, password } from '@inquirer/prompts'

// Text input with validation
const name = await input({
  message: 'Project name:',
  validate: (v) => v.length >= 2 || 'Name must be at least 2 characters',
})

// Single select
const framework = await select({
  message: 'Choose a framework:',
  choices: [
    { name: 'Next.js', value: 'nextjs', description: 'Full-stack React' },
    { name: 'Remix', value: 'remix', description: 'Web standards focused' },
    { name: 'Astro', value: 'astro', description: 'Content-first' },
  ],
})

// Multi-select
const features = await checkbox({
  message: 'Select features:',
  choices: [
    { name: 'TypeScript', value: 'typescript', checked: true },
    { name: 'ESLint', value: 'eslint', checked: true },
    { name: 'Tailwind CSS', value: 'tailwind' },
    { name: 'Database (Prisma)', value: 'prisma' },
    { name: 'Auth (NextAuth)', value: 'auth' },
  ],
})

// Confirmation
const proceed = await confirm({ message: 'Create project?', default: true })

// Password (masked)
const apiKey = await password({ message: 'Enter API key:', mask: '*' })

Step 2: Multi-Step Wizard

async function setupWizard() {
  console.log('🚀 Project Setup Wizard\n')

  const projectName = await input({ message: 'Project name:' })
  const template = await select({
    message: 'Template:',
    choices: [
      { name: 'SaaS Starter', value: 'saas' },
      { name: 'Blog', value: 'blog' },
      { name: 'E-commerce', value: 'ecommerce' },
    ],
  })

  const features = await checkbox({
    message: 'Features:',
    choices: getFeatureChoices(template),    // dynamic based on template
  })

  const useDocker = await confirm({ message: 'Add Docker?', default: false })

  console.log('\n📋 Summary:')
  console.log(`  Name: ${projectName}`)
  console.log(`  Template: ${template}`)
  console.log(`  Features: ${features.join(', ')}`)

  const ok = await confirm({ message: '\nProceed?', default: true })
  if (!ok) { console.log('Cancelled.'); process.exit(0) }

  return { projectName, template, features, useDocker }
}

Guidelines

  • Import individual prompts (@inquirer/prompts) not the legacy inquirer package.
  • Use validate for input validation — return true or error message string.
  • description in choices shows hint text below the option name.
  • For non-interactive environments (CI), accept config via flags and skip prompts.
  • Pair with Commander for argument parsing + Inquirer for interactive mode.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-inquirer/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-inquirer.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-inquirer",
  "kind": "skill",
  "name": "inquirer",
  "description": "Build interactive CLI prompts with Inquirer.js. Use when creating interactive terminal UIs, multi-step wizards, form-like CLI inputs, or configuration generators with user input.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "inquirer",
      "cli",
      "prompts",
      "interactive",
      "terminal",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Build interactive CLI prompts with Inquirer.js. Use when creating interactive terminal UIs, multi-step wizards, form-like CLI inputs, or configuration generators with user input."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/inquirer/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/inquirer/SKILL.md",
      "key": "terminalskills/skills/skills/inquirer/SKILL.md"
    },
    "compatibility": "Node.js 18+",
    "license": "Apache-2.0"
  },
  "instructions": "# Inquirer.js\n\n## Overview\n\nInquirer provides interactive prompts for CLIs — text input, confirmations, lists, checkboxes, passwords, and editors. The v2 API is modular (import only what you use) and supports themes, validation, and transformations.\n\n## Instructions\n\n### Step 1: Prompts\n\n```typescript\nimport { input, select, confirm, checkbox, password } from '@inquirer/prompts'\n\n// Text input with validation\nconst name = await input({\n  message: 'Project name:',\n  validate: (v) => v.length >= 2 || 'Name must be at least 2 characters',\n})\n\n// Single select\nconst framework = await select({\n  me",
  "cost": {
    "context_tokens": 705
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-inquirer/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.