PromptFork

Codex CLI script builder — describe the automation, get the script

Tell Codex what you want to automate in plain English and it writes the complete script — with argument parsing, error handling, progress output, and dry-run mode — ready to run without cleanup.

Open in Studio
Prompt
Paste into the Codex CLI:

'Write a [bash / Python / Node.js] script that does the following:

TASK: [DESCRIBE THE AUTOMATION IN PLAIN ENGLISH]

INPUTS: [What the script takes — files, directories, API keys, user arguments]
OUTPUTS: [What it produces — files, API calls, stdout, exit codes]
Environment: [OS, any dependencies already installed, credentials available as env vars]

The script must include:

1. ARGUMENT PARSING:
   - Named flags for every configurable option (e.g. --input, --output, --verbose)
   - A --help flag that prints usage
   - A --dry-run flag that logs what WOULD happen without making changes

2. INPUT VALIDATION:
   - Check that required arguments are provided before doing any work
   - Validate file paths exist before reading; validate directories before writing
   - Exit with a non-zero code and a clear error message on any validation failure

3. PROGRESS OUTPUT:
   - Print what the script is doing at each major step
   - For batch operations, show progress (e.g. "Processing 3/47: filename.csv")
   - In --verbose mode, print additional detail

4. ERROR HANDLING:
   - Catch errors from external calls (API, file I/O, subprocess)
   - On error: print the specific failure, clean up any partial output, exit with code 1
   - Never silently swallow an error

5. IDEMPOTENCY:
   - The script should be safe to run twice on the same input without corrupting output
   - Skip or overwrite (with a logged warning) rather than duplicating or crashing

Output only the script — no explanation, no markdown code block, just runnable code.'

Tip: start by describing the task in one messy sentence — Codex handles ambiguity better than most engineers expect; then refine by saying 'add a --filter flag that only processes files matching [pattern]' to iterate on the spec without rewriting from scratch.
Source
promptfork seed
License
CC-BY-4.0
Published
6/22/2026

More prompts you might like

Editor’s pickCoding & DevelopmentSeed

Codex API scaffolder — REST endpoint from a plain-English spec

Describe your endpoint in plain English and Codex builds the full implementation: route handler, request validation, error responses, and a usage example — no boilerplate writing required.

New

Codex code explainer and refactor — read, diagnose, rewrite clean

Paste any function and Codex returns a plain-English explanation, a list of specific problems, and a refactored version with notes on every change — so you understand what changed and why.

New

Codex test suite generator — unit and edge-case tests from your code

Point Codex at any function and it writes the full test suite: happy path, edge cases, error conditions, and the mocks — covering what you'd write manually but in a fraction of the time.

New

Codex bug hunter — root cause, not just a patch

Paste the buggy code and the error, and Codex diagnoses the root cause, explains why the obvious fix won't work, and gives you the correct fix with a regression test so the bug can never come back silently.

New

Next.js 15 App Router page with streaming, caching, and server data

Scaffold a production App Router page: Server Component data fetching, Suspense streaming for instant TTFB, correct cache strategy (fetch cache vs unstable_cache vs revalidatePath), loading/error boundaries, and generateMetadata — with the non-obvious patterns most tutorials skip.

New

Tailwind analytics dashboard with animated stat cards, dark mode, and skeleton loading

Production-grade dashboard layout: KPI cards with counting animations and trend sparklines, a chart area, activity table — all with dark mode, skeleton loading states, and responsive breakpoints defined to the pixel.

New