Skip to content

Ben Toms

Technical Lead — Solution Architect

Sixteen years in web engineering. Technical Lead at fusefabric, a Shopify Platinum Partner — I design the systems, steer the projects and lead the teams, and still build the quiet tooling that keeps it all fast and maintainable.

Shopify architect, mentor, builder.

01 — Work

Selected
work

By day I lead enterprise Shopify builds at fusefabric — solution design, architecture and delivery for fashion and lifestyle brands. Before that I led front-end engineering at MISSOMA and Dr. Martens, and agency teams in London.

Outside client work I build developer tools: Shopify theme asset compressors, Node CLI and config libraries, AI agent skills, and the occasional game.

Brands I've built for

  • MISSOMA
  • Topshop
  • Dr. Martens
  • Samsung
  • Spotify
  • Tesco
  • Cafédirect
  • ExxonMobil
  • Hitachi
  • London Real

Node.js

CLI Geniev2.0.0MIT

Easily create interactive command-line interfaces (CLIs) with a genie-style interface

$ npm i cli-genie
Last 30 days
264 downloads
Published
3 Nov 2026
Unpacked
175.2 KB
Commands
cli-genie
Dependencies
1
  1. ![CLI Genie logo](https://i.ibb.co/pbdjT80/cli-genie.png)
  2. # CLI Genie
  3. [![npm](https://img.shields.io/npm/v/cli-genie)](https://www.npmjs.com/package/cli-genie)
  4. [![CI](https://github.com/bentoms-dev/cli-genie/actions/workflows/ci.yml/badge.svg)](https://github.com/bentoms-dev/cli-genie/actions/workflows/ci.yml)
  5. [![license](https://img.shields.io/npm/l/cli-genie)](./LICENSE)
  6. Build guided, genie-style command-line wizards in a few lines. CLI Genie wraps
  7. [Inquirer](https://github.com/SBoudrias/Inquirer.js) with what most wizards need:
  8. - 🧞 10 prompt types: text, password, number, confirm, select, rawlist, checkbox, expand, search, editor
  9. - 🔀 Conditional and dynamic steps: when, message, default and choices can depend on earlier answers
  10. - 📋 Review screen where users can check and change any answer before finishing
  11. - 🤖 Non-interactive mode for CI and scripts: answers from flags, env vars or code, with type coercion and validation
  12. - 🪝 Hooks: transform, onAnswer, onComplete, onCancel
  13. - 📄 JSON wizards and a cli-genie command, so no code is needed
  14. - 🎨 Genie theme, progress counter, clean Ctrl+C handling
  15. - 🟦 Written in TypeScript, ships ESM + CommonJS with type definitions
  16. Requires Node.js 22.13+ or 24+.
  17. ## Installation
  18. ```bash
  19. npm install cli-genie
  20. ```
  21. ## Quick start
  22. ```js
  23. import { CliGenie, confirm, select, text } from 'cli-genie';
  24. // or: const { CliGenie, confirm, select, text } = require('cli-genie');
  25. const genie = new CliGenie({
  26. title: 'Welcome to CLI Genie',
  27. summary: true,
  28. steps: [
  29. text({ name: 'name', message: 'What is your name?', required: true }),
  30. confirm({ name: 'chooseColor', message: 'Do you want to choose a colour?' }),
  31. select({
  32. name: 'color',
  33. message: (answers) => `Pick a colour, ${answers.name}:`,
  34. choices: ['Red', 'Green', 'Blue'],
  35. when: (answers) => answers.chooseColor,
  36. }),
  37. ],
  38. });
  39. const answers = await genie.run();
  40. // { name: 'Ben', chooseColor: true, color: 'Green' }
  41. ```
  42. There are more examples in [examples/](./examples).
  43. ## Steps
  44. Each step builder takes the matching [Inquirer prompt options](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/prompts#prompts)
  45. plus these CLI Genie options:
  46. | Option | Type | Description |
  47. | ----------- | ------------------------------------ | ------------------------------------------------------------ |
  48. | `name` | `string` | **Required.** Key the answer is stored under. |
  49. | `message` | `string \| (answers) => string` | **Required.** The question. |
  50. | `default` | `value \| (answers) => value` | Default answer (also used in non-interactive mode). |
  51. | `when` | `(answers) => boolean` | Only ask when this returns `true`. |
  52. | `validate` | `(value, answers) => true \| string` | Return `true` or an error message. Receives earlier answers. |
  53. | `transform` | `(value, answers) => any` | Change the answer before it is stored. |
  54. | `label` | `string` | Label for the review screen (defaults to the message). |
  55. | `theme` | `object` | Per-step Inquirer theme overrides. |
  56. | Builder | Answer type | Notes |
  57. | ------------ | ----------- | ------------------------------------------------------------------------ |
  58. | `text()` | `string` | `required: true` rejects empty input. |
  59. | `password()` | `string` | `mask: true` shows `*` characters. |
  60. | `number()` | `number` | `min`, `max`, `step`. |
  61. | `confirm()` | `boolean` | |
  62. | `select()` | choice | `choices` may be a function of the answers. Supports `Separator`. |
  63. | `rawlist()` | choice | Numbered list. |
  64. | `checkbox()` | `array` | `default` is the list of pre-checked values. `validate` gets the values. |
  65. | `expand()` | choice | Choices have a `key`; `default` is a key. |
  66. | `search()` | choice | `source(term, { signal, answers })` returns choices. |
  67. | `editor()` | `string` | Opens `$EDITOR`. |
  68. ## Options
  69. ```ts
  70. new CliGenie({
  71. steps, // Step[]
  72. title, // banner shown before the first question
  73. progress: true, // show "(2/5)" before each question
  74. summary: false, // true | { title?, allowEdit?, format?(value, step) }
  75. theme: 'genie', // 'genie' | 'plain' | custom Inquirer theme object
  76. initialAnswers: {}, // pre-filled answers; matching steps are skipped
  77. interactive: 'auto', // true | false | 'auto' (prompt only when stdin is a TTY)
  78. hooks: { onAnswer, onComplete, onCancel },
  79. context: { input, output, signal }, // passed to every prompt
  80. });
  81. ```
  82. ### Review screen
  83. With summary: true, the genie lists every answer at the end. The user can confirm,
  84. change any answer or start over. When an answer changes, steps that depend on it
  85. are asked or removed automatically.
  86. ### Non-interactive mode and pre-filled answers
  87. ```js
  88. import { CliGenie, fromArgv, fromEnv } from 'cli-genie';
  89. const genie = new CliGenie({
  90. steps,
  91. // `--first-name=Ben`, `--no-git`, `GENIE_FIRST_NAME=Ben` all match a step named `firstName`
  92. initialAnswers: { ...fromEnv('GENIE_'), ...fromArgv() },
  93. });
  94. ```
  95. Supplied answers are converted to the step's type ("42" → 42, "yes" → true,
  96. "a,b" → ['a', 'b'], and a choice's name or value → its value) and then validated.
  97. When there's no TTY (CI, piped input) or interactive: false is set, any step without
  98. a supplied answer uses its default. If it has no default, a MissingAnswerError is thrown.
  99. ### Cancelling
  100. Pressing Ctrl+C (or aborting context.signal) rejects run() with a GenieCancelledError
  101. that contains the answers collected so far:
  102. ```js
  103. import { isCancelled } from 'cli-genie';
  104. try {
  105. await genie.run();
  106. } catch (error) {
  107. if (isCancelled(error)) process.exit(130);
  108. throw error;
  109. }
  110. ```
  111. Other errors: MissingAnswerError and InvalidAnswerError, both subclasses of GenieError.
  112. ### TypeScript
  113. ```ts
  114. interface Order {
  115. size: 'small' | 'large';
  116. extras: string[];
  117. }
  118. const order = await genie.run<Order>();
  119. ```
  120. ## JSON wizards and the `cli-genie` command
  121. Define a wizard as JSON. Functions are replaced by declarative options:
  122. ```json
  123. {
  124. "title": "Pizza order",
  125. "summary": true,
  126. "steps": [
  127. {
  128. "type": "text",
  129. "name": "email",
  130. "message": "Email",
  131. "pattern": "@",
  132. "patternMessage": "Invalid email"
  133. },
  134. { "type": "select", "name": "size", "message": "Size", "choices": ["small", "large"] },
  135. { "type": "confirm", "name": "delivery", "message": "Delivery?" },
  136. { "type": "text", "name": "address", "message": "Address", "when": { "delivery": true } }
  137. ]
  138. }
  139. ```
  140. when matches when every listed answer is equal; an array value means "any of".
  141. search steps aren't available in JSON because they need a function.
  142. Run it from code with await loadWizard('wizard.json') or defineWizard(object), or from the shell:
  143. ```bash
  144. npx cli-genie wizard.json # prompts on stderr, answers as JSON on stdout
  145. npx cli-genie wizard.json --size=large # pre-fill answers
  146. npx cli-genie wizard.json --non-interactive # never prompt (CI)
  147. ORDER=$(npx cli-genie wizard.json) # capture the answers
  148. ```
  149. ## Migrating from v1
  150. v1 code still works, with deprecation warnings in your editor:
  151. ```js
  152. const { CliGenie, textInputPrompt, listPrompt } = require('cli-genie');
  153. new CliGenie([textInputPrompt('Name?', 'name'), listPrompt('Colour?', 'color', ['Red'])]).run();
  154. ```
  155. Breaking changes in 2.0:
  156. - Node.js 22.13+ is required.
  157. - run() resolves with the answers and no longer prints them.
  158. - Errors are thrown (as GenieError subclasses) instead of being logged with process.exitCode = 1.
  159. - when now receives the earlier answers. In v1 it always received {}, so conditional questions never appeared.
  160. - styling is merged into the Inquirer theme. promptLibrary is ignored.
  161. ## Contributing
  162. See [CONTRIBUTING.md](./CONTRIBUTING.md).
  163. ## License
  164. MIT, see [LICENSE](./LICENSE).
5 itemsgithub.com/bentoms-dev ↗

02 — About

Part architect.Part problem-solver.Part mentor.

I've spent over sixteen years in web development and now work as a Technical Lead and eCommerce architect at fusefabric, a Shopify Platinum Partner — designing solutions, steering projects and leading teams to deliver work we can all be proud of.

When I get hands-on, it's usually Node-based tools, apps and backend processes, often for Shopify stores: the things that quietly power the front end and make a real difference to performance, maintainability and developer experience.

Working with

  • Shopify Plus / Liquid
  • Hydrogen & headless
  • Node.js
  • JavaScript / TypeScript
  • React / Next.js
  • Vue
  • PostgreSQL
  • WebGL
Years in the industry
16+
Projects
50+
Teams led
6
Users reached
1M+

03 — AI agent skills

Teach your
agent

Free SKILL.md files distilled from sixteen years of shipping. Drop them into GitHub Copilot, Claude Code or any agent that supports skills, and it works the way a senior Shopify, web or mobile engineer would.

Shopify

Shopify Theme Architect

Build and review Online Store 2.0 themes: Liquid sections, theme blocks, settings, performance and accessibility.

  1. ---
  2. name: shopify-theme-architect
  3. description: Build, refactor and review Shopify Online Store 2.0 themes. Use when creating or editing Liquid sections, blocks, snippets, templates, theme settings, locales, or theme CSS/JS, and when reviewing a theme for performance, accessibility or merchant editability.
  4. ---
  5. # Shopify Theme Architect
  6. You are a senior Shopify theme engineer. You build Online Store 2.0 themes that are fast, accessible and easy for merchants to customise in the theme editor.
  7. ## Before writing code
  8. 1. Inspect the theme structure: layout/, templates/ (JSON), sections/, blocks/, snippets/, assets/, config/, locales/.
  9. 2. Find an existing section or snippet that solves a similar problem and follow its conventions (naming, CSS approach, JS pattern).
  10. 3. Confirm which templates the change affects and whether it must work in the theme editor (it almost always must).
  11. ## Liquid rules
  12. - Use {% render 'snippet', var: value %}. Never use the deprecated {% include %}.
  13. - Every section and theme block has a valid {% schema %} with name, settings, and presets where it should be addable in the editor.
  14. - Prefer theme blocks (blocks/ folder) and {% content_for 'blocks' %} for composable layouts on themes that support them.
  15. - Output images with image_url + image_tag, always passing widths, sizes and a meaningful alt. Never hard-code CDN URLs.
  16. - Use {{ 'key' | t }} for every customer-facing string and add keys to locales/en.default.json. Schema labels go in *.schema.json locale files.
  17. - Escape untrusted output (| escape) when building attributes from merchant or customer input.
  18. - Keep {{ content_for_header }} and {{ content_for_layout }} in layout/theme.liquid.
  19. - Avoid expensive loops: do not iterate collections or all_products; paginate with {% paginate %} and keep limits small.
  20. ## Settings design
  21. - Expose only settings a merchant will genuinely change. Use sensible defaults so a newly added section looks finished.
  22. - Use the right input type: image_picker, video, collection, product, richtext, inline_richtext, color_scheme, range with min/max/step/unit.
  23. - Use visible_if to hide irrelevant settings instead of explaining them in info text.
  24. - Add {{ block.shopify_attributes }} to block wrappers so the editor can select them.
  25. ## CSS
  26. - Scope styles to the section (#shopify-section-{{ section.id }} or a section-specific class) to prevent leaks.
  27. - Mobile-first, using the theme's existing custom properties for spacing, colour schemes and typography.
  28. - Use {% stylesheet %} for small section CSS or a dedicated asset loaded only where needed. Do not load CSS globally for one section.
  29. ## JavaScript
  30. - Vanilla JS with custom elements (class Foo extends HTMLElement). No jQuery.
  31. - Load with defer or type="module". Never block rendering.
  32. - Re-initialise correctly in the editor: listen for shopify:section:load, shopify:section:unload, shopify:block:select.
  33. - Use the Section Rendering API (?sections= or ?section_id=) to refresh HTML after cart or filter changes instead of rebuilding markup in JS.
  34. - Use the Cart AJAX API (/cart/add.js, /cart/change.js, /cart.js) with routes.* URLs for locale-aware paths.
  35. ## Performance checklist
  36. - The LCP image is not lazy-loaded and uses fetchpriority="high"; everything below the fold uses loading="lazy".
  37. - No render-blocking third-party scripts in <head>. App embeds load only where used.
  38. - Fonts use font_url + font-display: swap and are preloaded only when above the fold.
  39. - Minify and compress theme assets before deploying (for example with the shopify-compressor npm package).
  40. - Run shopify theme check and fix every error before handing off.
  41. ## Accessibility checklist
  42. - Semantic landmarks, one <h1> per page, logical heading order.
  43. - All interactive elements are reachable and operable by keyboard with a visible focus style.
  44. - Drawers and modals trap focus, close on Escape and return focus to the trigger.
  45. - Colour contrast meets WCAG 2.2 AA in every colour scheme.
  46. - Announce cart updates with an aria-live region.
  47. ## Workflow
  48. 1. shopify theme dev --store <store> to preview locally.
  49. 2. Make the change, keeping diffs small and following existing patterns.
  50. 3. Test in the theme editor: add, reorder, remove the section/blocks; change every setting.
  51. 4. Test mobile, keyboard-only, and with a screen reader for interactive components.
  52. 5. shopify theme check, then push to an unpublished theme for review.
  53. ## Output
  54. When you finish, summarise: files changed, new settings added (with defaults), translation keys added, and anything the merchant must configure.
19 itemsbentoms-dev/skills ↗

04 — Contact

Get in
touch

For Shopify builds, technical leadership, collaborations, or just to talk shop.