Consolidate one-off scripts into a single CLI with subcommands
Category: Tooling · Updated 2026-09-22 · Tools: Codex
Use this once a project has accumulated a handful of “script I wrote once to fix something urgent” files, each with its own inconsistent way of taking input (some hardcoded, some argv, some prompted). Consolidating them makes each one discoverable and reusable instead of getting lost in a scripts/ folder nobody fully remembers. Medium to large usage, depending on how many scripts are being merged.
Full prompt
Consolidate <list of script file paths> into a single CLI tool, where each original script becomes its own subcommand. Every subcommand should take its parameters via command-line arguments (not require editing the code to change behavior) and have basic argument validation plus a --help description. While consolidating, don't change the core logic of any individual script — only change how it's invoked and structured. Show me the proposed directory structure and subcommand list first and wait for my confirmation before implementing. Once approved, implement one subcommand at a time, running it with a representative set of arguments after each one to confirm it still works as expected. Do all of this on a new branch, and don't push.
Tips
- Confirming the subcommand list before implementation avoids finding out halfway through that two scripts don't map cleanly onto the CLI shape you had in mind
- The "don't change core logic" constraint keeps this a structural refactor rather than accidentally rewriting behavior you were relying on
- Testing each subcommand with real arguments as it's built catches argument-passing mistakes much earlier than reading the code alone would
Still waiting on a reset? See what to do when you hit the limit, or check Codex / Claude time since last reset.
Back to the prompt library · Subscribe: all-products feed