30 Claude Prompts That Write Scripts
Describe the task in plain English and Claude returns a runnable, fully commented script you can paste and execute: bash, Python, or Node picked per job. Prompts for file operations, data cleaning, web scraping, backups, cron jobs, and API calls.
In short: This page contains 30 copy-paste ready prompts, organized into 6 categories with a description and pro tip for each. The first 15 prompts are free instantly โ no signup needed. Hand-curated and tested by the AI Academy team.
File Operations
5 promptsBulk File Renamer
1/30You are a shell scripting expert who writes safe, portable automation. <context> I need a single, self-contained script that batch-renames files in a folder following a pattern, returned as a ready-to-run, commented code artifact. It must be safe: dry-run by default and never silently overwrite. </context> <inputs> - Target folder: [PATH] - Current naming pattern: [E.G. IMG_1234.JPG, MESSY SPACES, MIXED CASE] - Desired output pattern: [E.G. 2026-01-15_event_001.jpg] - Language preference: [BASH / PYTHON / AUTO] - Recurse into subfolders?: [YES / NO] - Collision handling: [SKIP / APPEND SUFFIX / ERROR] </inputs> <task> Write a script that scans the folder, computes the new name for each file from the pattern, prints a table of old -> new in dry-run mode, and only renames when passed a --apply flag. Handle spaces, special characters, sequential numbering with zero-padding, and case normalization. </task> <constraints> - One self-contained file, correct and valid syntax, runnable as-is. - Dry-run is the default; --apply performs the rename. Never overwrite without honoring the collision rule. - Comment each block; exit non-zero on error; handle empty folders gracefully. </constraints> <format> Return the full script as a code block, then a short note on how to run the dry-run, then apply, plus how to change the pattern. </format>
Produces a safe, dry-run-first bulk file renamer script ready to use.
Pro tip: Paste 5-6 real example filenames so Claude infers the exact regex and zero-padding you need.
Auto-Organize Folder by Type & Date
2/30You are a Python automation engineer who writes clean, dependency-light utilities. <context> I want a script that sorts a messy download or media folder into organized subfolders, returned as a runnable, commented artifact. It should be idempotent and safe to run repeatedly. </context> <inputs> - Source folder: [PATH] - Sort by: [EXTENSION / FILE TYPE GROUP / MODIFIED DATE / BOTH] - Destination root: [PATH OR SAME FOLDER] - Date bucket format: [YYYY / YYYY-MM / YYYY-MM-DD] - On duplicate names: [SKIP / RENAME / OVERWRITE] - Dry-run first?: [YES / NO] </inputs> <task> Write a script that walks the source folder, groups files (images, docs, video, audio, archives, other), builds destination paths from the chosen scheme, and moves files into place. Print a summary of how many files moved per bucket. Support a --dry-run flag that only prints the plan. </task> <constraints> - Standard library only (pathlib, shutil, os); no third-party installs. - Idempotent: re-running does nothing harmful. Honor the duplicate rule exactly. - Comment every function; guard against moving the script into itself. </constraints> <format> Return the full Python script as a code block, then a two-line note on running dry-run vs. live and how to add a new file-type group. </format>
Generates an idempotent folder-organizer script that sorts files by type and date, ready to run.
Pro tip: Ask Claude to add a rollback log so you can undo a run if the sort scheme wasn't what you expected.
Duplicate File Finder & Remover
3/30You are a systems programmer who writes reliable file-dedup tooling. <context> I need a script that finds duplicate files by content (not just name) across a directory tree and helps me delete them safely, returned as a runnable, commented artifact. </context> <inputs> - Root directory to scan: [PATH] - Match by: [HASH ONLY / SIZE THEN HASH] - Hash algorithm: [MD5 / SHA-256] - Keep which copy: [OLDEST / NEWEST / SHORTEST PATH / FIRST FOUND] - Action: [REPORT ONLY / MOVE DUPES TO QUARANTINE / DELETE] - Language: [PYTHON / AUTO] </inputs> <task> Write a script that walks the tree, groups files by size, hashes only same-size candidates for efficiency, and reports each duplicate set with total reclaimable space. In report mode it prints a table; in quarantine/delete mode it acts only after a --confirm flag, always keeping one copy per the chosen rule. </task> <constraints> - Standard library only; read files in chunks so large files don't blow memory. - Never delete the last remaining copy of a set; require --confirm for any destructive action. - Comment the hashing and grouping logic clearly. </constraints> <format> Return the full script as a code block, then a short note on running it in report mode first and interpreting the reclaimable-space output. </format>
Creates a content-based duplicate finder and safe remover script, ready to use.
Pro tip: Run it in report mode across your whole drive first; the reclaimable-space total tells you if a cleanup is even worth it.
Batch Image Resize & Convert
4/30You are a Python developer who builds media-processing utilities. <context> I need a script that batch-resizes and converts a folder of images, returned as a runnable, commented artifact, so I can prep assets for the web in one command. </context> <inputs> - Input folder: [PATH] - Output folder: [PATH] - Target dimensions: [E.G. MAX 1600px WIDE, KEEP ASPECT] - Output format: [WEBP / JPG / PNG] - Quality/compression: [E.G. 82] - Also generate thumbnails?: [YES SIZE / NO] </inputs> <task> Write a script using Pillow that reads every image in the input folder, resizes within the max dimensions while preserving aspect ratio, converts to the target format, writes to the output folder, and optionally emits a thumbnail set. Print per-file before/after sizes and a total-bytes-saved summary at the end. </task> <constraints> - Use Pillow; include the pip install line as a comment at the top. - Preserve aspect ratio; skip non-image files without crashing; handle EXIF orientation. - Comment each step; create the output folder if missing; leave originals untouched. </constraints> <format> Return the full Python script as a code block, then a note on installing Pillow and tuning quality vs. file size. </format>
Builds a batch image resize-and-convert script with size reporting, ready to run.
Pro tip: Tell Claude your real target (web hero, thumbnails, email) and it will pick sensible default dimensions and quality for that use.
Recursive Find & Replace in Files
5/30You are a shell tooling expert focused on safe text transformations. <context> I need a script that finds and replaces text across many files in a project tree, returned as a runnable, commented artifact. It must preview changes before touching anything. </context> <inputs> - Root directory: [PATH] - Find (literal or regex): [STRING OR PATTERN] - Replace with: [STRING] - File filter: [E.G. *.js, *.md, ALL TEXT FILES] - Match mode: [LITERAL / REGEX] - Make backups?: [YES .bak / NO] </inputs> <task> Write a script that recursively finds matching files, shows a diff-style preview of every line that would change with file paths and match counts, and applies changes only with an --apply flag. Skip binary files automatically and optionally write .bak backups before editing. </task> <constraints> - One self-contained script; correct escaping for regex vs. literal mode. - Dry-run preview is the default; --apply performs edits. Skip binaries; never corrupt encoding. - Comment the matching, preview, and backup logic. </constraints> <format> Return the full script as a code block, then a short note on previewing first, running with --apply, and restoring from .bak files. </format>
Generates a preview-first recursive find-and-replace script for codebases, ready to use.
Pro tip: Always run the preview and eyeball the match count first; a too-broad regex is the fastest way to wreck a repo.
XML tags are just the start. Learn the full Claude workflow.
A growing library of 300+ hands-on AI tutorials covering Claude, ChatGPT, and 50+ tools. New tutorials added every week.
Data Cleaning & Conversion
5 promptsCSV to JSON Converter with Cleaning
6/30You are a data engineer who writes robust ETL utilities. <context> I need a script that converts a CSV into clean JSON, returned as a runnable, commented artifact. It should tidy the data during conversion, not just reformat it. </context> <inputs> - Input CSV path: [PATH] - Output JSON path: [PATH] - Column names/types: [E.G. id:int, price:float, active:bool, name:string] - Trim/normalize rules: [E.G. STRIP WHITESPACE, LOWERCASE EMAILS] - Output shape: [ARRAY OF OBJECTS / KEYED BY id] - Language: [PYTHON / NODE / AUTO] </inputs> <task> Write a script that reads the CSV, coerces each column to its declared type, applies the normalization rules, drops or flags rows that fail type coercion, and writes pretty-printed JSON in the chosen shape. Print a summary: rows read, rows written, rows skipped with reasons. </task> <constraints> - Standard library only (csv/json); stream large files rather than loading all into memory where possible. - Fail-safe on bad rows: collect errors, don't crash on the first one. - Comment the type-coercion and normalization logic. </constraints> <format> Return the full script as a code block, then a short note on defining the column schema and reading the skipped-rows report. </format>
Produces a CSV-to-JSON converter that cleans and type-coerces during conversion, ready to run.
Pro tip: Paste your CSV header row plus two sample rows so Claude infers the right types and catches the messy columns.
Deduplicate & Normalize a CSV
7/30You are a data-quality engineer who writes deterministic cleaning scripts. <context> I have a messy contact or product CSV with duplicates and inconsistent formatting. I need a script that dedupes and normalizes it, returned as a runnable, commented artifact. </context> <inputs> - Input CSV: [PATH] - Dedupe key column(s): [E.G. email, OR name+phone] - Normalization: [LOWERCASE EMAILS, TRIM, TITLE-CASE NAMES, STRIP PHONE FORMATTING] - On duplicate: [KEEP FIRST / KEEP MOST COMPLETE ROW] - Output CSV: [PATH] - Also emit a rejects file?: [YES / NO] </inputs> <task> Write a script that loads the CSV, normalizes each configured column, deduplicates on the key using the chosen keep rule, and writes a clean CSV plus an optional rejects file listing removed duplicates. Print counts: input rows, unique rows kept, duplicates removed. </task> <constraints> - Standard library only; preserve original column order and header. - Deterministic output: same input always yields the same result. - Comment the normalization and dedup-key logic; handle empty/missing key values. </constraints> <format> Return the full script as a code block, then a note on choosing the keep rule and using the rejects file to audit removals. </format>
Creates a deterministic CSV dedupe-and-normalize script with a rejects audit file, ready to use.
Pro tip: Use 'keep most complete row' when merging lists from different sources so you don't lose filled-in fields.
Merge Many CSVs Into One
8/30You are a data engineer who writes reliable file-merge tooling. <context> I have a folder of CSV exports that I need combined into one master file, returned as a runnable, commented script artifact. The files may have slightly different columns. </context> <inputs> - Folder of CSVs: [PATH] - Filename glob: [E.G. sales_*.csv] - Column handling: [UNION ALL COLUMNS / INTERSECTION ONLY] - Add source-file column?: [YES / NO] - Output file: [PATH] - Skip header-only or empty files?: [YES / NO] </inputs> <task> Write a script that discovers matching CSVs, reads each, reconciles columns per the chosen mode (filling missing cells for union), optionally tags each row with its source filename, and writes a single combined CSV. Print a per-file row count and the final total. </task> <constraints> - Standard library only; handle differing column orders and mismatched headers correctly. - Do not duplicate the header row; process files in sorted order for reproducibility. - Comment the column-reconciliation logic; skip unreadable files with a warning, not a crash. </constraints> <format> Return the full script as a code block, then a note on union vs. intersection mode and verifying the row-count math. </format>
Generates a multi-CSV merge script that reconciles mismatched columns, ready to run.
Pro tip: Turn on the source-file column so you can always trace a row back to which export it came from.
Excel (XLSX) to CSV Batch Converter
9/30You are a Python developer who builds spreadsheet-processing utilities. <context> I have Excel workbooks I need flattened into CSVs, returned as a runnable, commented script artifact. Some workbooks have multiple sheets. </context> <inputs> - Input folder or file: [PATH] - Sheets to export: [ALL / NAMED LIST / FIRST ONLY] - Output folder: [PATH] - Naming: [WORKBOOK_SHEET.csv] - Handle merged cells / formulas: [VALUES ONLY / KEEP FORMULAS AS TEXT] - Delimiter: [COMMA / SEMICOLON / TAB] </inputs> <task> Write a script using openpyxl that opens each .xlsx, exports the selected sheets to CSV with the chosen delimiter and naming scheme, resolves formula cells to their computed values, and skips fully empty sheets. Print a table of workbook -> sheet -> rows exported. </task> <constraints> - Use openpyxl (data_only for values); include the pip install line as a comment. - Preserve cell order and headers; handle dates and numbers without mangling them. - Comment the sheet-selection and delimiter logic; create the output folder if missing. </constraints> <format> Return the full Python script as a code block, then a note on installing openpyxl and the data_only caveat for formula values. </format>
Builds a batch XLSX-to-CSV converter that handles multiple sheets and formulas, ready to use.
Pro tip: If formula cells come out blank, tell Claude the workbook was never opened in Excel so it adds a fallback recompute note.
Clean & Validate a Contact List
10/30You are a data-quality engineer who writes validation pipelines. <context> I have a raw list of contacts with emails and phone numbers that need validating and standardizing, returned as a runnable, commented script artifact. </context> <inputs> - Input file (CSV): [PATH] - Email column: [NAME] - Phone column: [NAME] - Phone target format: [E.G. E.164, +1XXXXXXXXXX] - Default country code: [E.G. US / +1] - Output: [CLEAN FILE + INVALID FILE / SINGLE FILE WITH status COLUMN] </inputs> <task> Write a script that validates each email with a sensible regex, normalizes each phone to the target format, flags rows that fail either check, and outputs clean vs. invalid records per the chosen mode. Print a summary: total, valid emails, valid phones, rows moved to invalid with reasons. </task> <constraints> - Standard library only (re, csv); document the exact validation rules in comments. - Never silently drop a row: every rejected row lands in the invalid output with a reason. - Handle empty cells and obvious junk (extensions, letters in phone) gracefully. </constraints> <format> Return the full script as a code block, then a note on tightening the email regex and adjusting the phone format for your region. </format>
Creates an email-and-phone validation script that separates clean from invalid records with reasons, ready to run.
Pro tip: Ask Claude to keep the original raw value alongside the normalized one so you can spot-check any suspicious conversions.
Web Scraping
5 promptsScrape an HTML Table to CSV
11/30You are a Python developer who writes polite, resilient web scrapers. <context> I need a script that pulls a data table from a public web page into a CSV, returned as a runnable, commented artifact. It should be robust to minor layout quirks. </context> <inputs> - Page URL: [URL] - Which table: [E.G. FIRST TABLE / TABLE WITH id="prices" / NTH TABLE] - Columns to keep: [ALL / NAMED LIST] - Output CSV: [PATH] - Custom User-Agent: [STRING OR DEFAULT] - Handle pagination?: [NO / YES, NEXT-PAGE SELECTOR] </inputs> <task> Write a script using requests and BeautifulSoup that fetches the page, locates the target table, extracts headers and rows, cleans whitespace and nested tags out of cells, and writes a CSV. If pagination is enabled, follow next-page links until none remain. Print rows scraped per page and the total. </task> <constraints> - Use requests + beautifulsoup4; include the pip install line as a comment. - Set a User-Agent and a polite delay between requests; time out and retry on transient errors. - Comment the table-selection and cell-cleaning logic; fail with a clear message if the table isn't found. </constraints> <format> Return the full Python script as a code block, then a note on installing deps, respecting robots.txt, and adjusting the table selector. </format>
Produces a resilient HTML-table-to-CSV scraper with optional pagination, ready to run.
Pro tip: Paste the exact table's surrounding HTML so Claude writes a precise selector instead of guessing 'first table'.
Scrape Product Listings to JSON
12/30You are a web-scraping engineer who builds structured-data extractors. <context> I need a script that scrapes a listing/category page into structured product records (title, price, URL, image), returned as a runnable, commented artifact. </context> <inputs> - Listing page URL: [URL] - CSS selector for each product card: [SELECTOR] - Field selectors: [TITLE: sel, PRICE: sel, LINK: sel, IMAGE: sel] - Number of pages / next-page selector: [DETAILS] - Output JSON: [PATH] - Rate limit (seconds between requests): [E.G. 2] </inputs> <task> Write a script using requests and BeautifulSoup that loops over listing pages, selects each product card, extracts the configured fields, normalizes price to a number, resolves relative URLs to absolute, and writes an array of product objects to JSON. Deduplicate by product URL. Print products scraped per page and the total. </task> <constraints> - Use requests + beautifulsoup4; include the pip install comment; set a User-Agent and honor the rate limit. - Skip cards missing required fields, logging a warning; never crash on one bad card. - Comment each selector's purpose so I can retarget it to another site. </constraints> <format> Return the full Python script as a code block, then a note on finding CSS selectors in DevTools and staying within the site's terms. </format>
Generates a product-listing scraper that outputs clean, deduplicated JSON records, ready to use.
Pro tip: Give Claude one product card's raw HTML and it will fill in every field selector for you accurately.
Page Change / Price-Drop Monitor
13/30You are an automation engineer who writes lightweight monitoring scripts. <context> I want a script that checks a web page on each run and tells me when a target value changes (like a price or 'in stock' status), returned as a runnable, commented artifact designed to be run on a schedule. </context> <inputs> - Page URL: [URL] - What to watch: [CSS SELECTOR OR REGEX FOR THE VALUE] - Trigger: [ANY CHANGE / DROPS BELOW N / TEXT APPEARS] - State file location: [PATH] - Notify via: [PRINT / WEBHOOK URL / LOG FILE] - Language: [PYTHON / NODE / AUTO] </inputs> <task> Write a script that fetches the page, extracts the watched value, compares it against the last value stored in a state file, and fires the notification only when the trigger condition is met. Persist the new value for next time. Print old vs. new value and whether it triggered. Make it safe to run every N minutes from cron. </task> <constraints> - Store state in a small JSON file next to the script; create it on first run. - Handle network errors and missing selectors without corrupting the state file. - Comment the compare/trigger logic; set a User-Agent and a request timeout. </constraints> <format> Return the full script as a code block, then a note on the state file, adding a cron entry, and wiring the webhook notification. </format>
Creates a stateful page-monitor script that alerts on price or status changes, ready to schedule.
Pro tip: Point the webhook at a Slack or Discord incoming URL so change alerts land straight in a channel.
Download All Files From a Page
14/30You are a Python developer who writes safe bulk-download utilities. <context> I need a script that finds and downloads all files of a given type linked from a page (images, PDFs, etc.), returned as a runnable, commented artifact. </context> <inputs> - Page URL: [URL] - File types to grab: [E.G. .pdf, .jpg, .png] - Also follow one level of links?: [YES / NO] - Output folder: [PATH] - Max files / max total size: [LIMIT OR NONE] - Rate limit (seconds): [E.G. 1] </inputs> <task> Write a script using requests and BeautifulSoup that parses the page for links to the target file types, resolves relative URLs, downloads each file into the output folder with its original name (deduplicating collisions), and respects the max-file and rate-limit settings. Stream downloads to disk. Print a per-file status line and a final count and total size. </task> <constraints> - Use requests + beautifulsoup4; include the pip install comment; set a User-Agent and honor the rate limit. - Stream large files in chunks; skip already-downloaded files; never overwrite blindly. - Comment the link-discovery and download logic; handle 404s and timeouts gracefully. </constraints> <format> Return the full Python script as a code block, then a note on choosing file types, the follow-links option, and respecting robots.txt. </format>
Builds a bulk file-downloader script that streams linked files with limits, ready to run.
Pro tip: Set a max-total-size cap before running on an unfamiliar page so a link farm can't fill your disk.
Sitemap / Link Crawler to URL List
15/30You are a web-crawling engineer who writes bounded, well-behaved crawlers. <context> I need a script that crawls a site starting from a URL and collects every internal page URL into a file, returned as a runnable, commented artifact. It must stay within one domain and never loop forever. </context> <inputs> - Start URL: [URL] - Stay on domain?: [YES, SAME HOST ONLY] - Max pages / max depth: [E.G. 500 / DEPTH 3] - Also parse sitemap.xml if present?: [YES / NO] - Output file: [PATH, ONE URL PER LINE] - Rate limit (seconds): [E.G. 1] </inputs> <task> Write a script using requests and BeautifulSoup that does a breadth-first crawl from the start URL, following only same-host links, tracking visited URLs to avoid revisits, respecting the max-page and max-depth caps, and optionally seeding from sitemap.xml. Write the discovered URLs sorted and deduplicated to the output file. Print progress and the final count. </task> <constraints> - Use requests + beautifulsoup4; include the pip install comment; set a User-Agent and honor the rate limit. - Enforce the caps strictly; skip non-HTML resources and mailto/tel/anchor links. - Comment the queue, visited-set, and domain-filter logic; handle errors without stopping the crawl. </constraints> <format> Return the full Python script as a code block, then a note on the caps, adding a robots.txt check, and using the output as a scrape seed list. </format>
Generates a bounded same-domain crawler that outputs a deduplicated URL list, ready to run.
Pro tip: Start with a low max-pages cap to sanity-check the crawl stays on-domain before letting it run wide.
Backups & Sync
5 promptsIncremental Folder Backup with Rotation
16/30You are a systems engineer who writes dependable backup scripts. <context> I need a script that backs up a folder into timestamped archives and keeps only the last N, returned as a runnable, commented artifact suitable for daily cron runs. </context> <inputs> - Source folder: [PATH] - Backup destination: [PATH] - Archive format: [tar.gz / zip] - Exclude patterns: [E.G. node_modules, *.log, .cache] - Retention: [KEEP LAST N BACKUPS, E.G. 7] - Verify archive after creating?: [YES / NO] </inputs> <task> Write a bash script that creates a timestamped archive of the source (honoring exclude patterns), writes it to the destination, optionally verifies the archive integrity, then prunes old backups beyond the retention count. Log each step with timestamps to a log file and print a final summary (archive name, size, backups now retained). </task> <constraints> - One self-contained bash script; set -euo pipefail; correct handling of paths with spaces. - Retention prune deletes only this script's own timestamped archives, never anything else in the destination. - Comment each block; exit non-zero and log on any failure so cron can detect it. </constraints> <format> Return the full bash script as a code block, then a note on adding it to cron and testing the retention prune safely. </format>
Produces a timestamped incremental backup script with safe retention rotation, ready to schedule.
Pro tip: Do a first dry run into an empty test destination to confirm the prune only touches its own archive names.
Database Dump Backup (Postgres/MySQL)
17/30You are a database reliability engineer who writes safe dump-and-rotate scripts. <context> I need a script that dumps my database to a compressed, timestamped file and rotates old dumps, returned as a runnable, commented artifact for scheduled backups. </context> <inputs> - Database type: [POSTGRES / MYSQL] - Connection: [HOST, PORT, DB NAME, USER] - Password source: [ENV VAR NAME / .pgpass or .my.cnf] - Backup folder: [PATH] - Retention: [KEEP LAST N / KEEP DAYS] - Compress with: [gzip / zstd] </inputs> <task> Write a bash script that runs pg_dump or mysqldump (per the chosen type) into a timestamped, compressed file, checks the dump exit code and non-zero file size before considering it successful, prunes dumps beyond the retention rule, and logs each step. Print the dump filename, size, and dumps retained. </task> <constraints> - One self-contained bash script; set -euo pipefail; never hardcode the password (read from env or a credentials file). - Treat an empty or zero-byte dump as a failure and do NOT prune old backups in that case. - Comment the dump, verify, and prune steps; exit non-zero on any failure. </constraints> <format> Return the full bash script as a code block, then a note on supplying credentials securely and adding it to cron with output logging. </format>
Generates a Postgres/MySQL dump-and-rotate backup script that verifies before pruning, ready to schedule.
Pro tip: The 'don't prune on a failed dump' rule is the whole point; ask Claude to also email you when a dump fails.
Sync Local Folder to S3 / Cloud
18/30You are a DevOps engineer who writes reliable cloud-sync automation. <context> I need a script that syncs a local folder to an S3-compatible bucket, returned as a runnable, commented artifact I can run manually or on a schedule. </context> <inputs> - Local folder: [PATH] - Bucket + prefix: [s3://bucket/prefix] - Provider: [AWS S3 / S3-COMPATIBLE ENDPOINT URL] - Credentials source: [ENV VARS / AWS PROFILE] - Delete remote files not present locally?: [YES / NO] - Exclude patterns: [E.G. *.tmp, .DS_Store] </inputs> <task> Write a bash script that wraps the AWS CLI to sync the local folder to the bucket, applying exclude patterns and the chosen delete/mirror behavior. Do a --dryrun preview first when passed --preview, print a summary of files uploaded/updated/deleted, and log the run. Verify the AWS CLI and credentials are present before starting. </task> <constraints> - One self-contained bash script; set -euo pipefail; do not print secrets. - Preflight check that the CLI exists and credentials resolve; fail clearly if not. - Guard the delete/mirror option behind an explicit flag so it can't wipe the remote by accident. - Comment each step. </constraints> <format> Return the full bash script as a code block, then a note on setting credentials, using --preview, and enabling mirror mode safely. </format>
Builds an S3-compatible folder-sync script with dry-run and guarded mirror mode, ready to run.
Pro tip: Always run --preview before your first real mirror; the delete flag is unforgiving on a mistyped prefix.
Compress + Encrypt Backup Archive
19/30You are a security-minded engineer who writes encrypted-backup scripts. <context> I need a script that archives a folder, compresses it, and encrypts it so I can store it safely off-site, returned as a runnable, commented artifact. It should also be able to decrypt/restore. </context> <inputs> - Source folder: [PATH] - Output archive path: [PATH] - Encryption tool: [gpg SYMMETRIC / openssl AES-256] - Passphrase source: [ENV VAR NAME / PROMPT] - Exclude patterns: [OPTIONAL] - Mode: [BACKUP / RESTORE] </inputs> <task> Write a bash script with a backup mode (tar + compress + encrypt to a single output file) and a restore mode (decrypt + extract to a target folder). Verify the passphrase is available, never echo it, and confirm the encrypted output exists and is non-empty. Print the output path and size on backup, and the restored path on restore. </task> <constraints> - One self-contained bash script; set -euo pipefail; read the passphrase from env or a secure prompt, never a CLI arg. - Use a widely available tool (gpg or openssl); state which in a comment and check it is installed. - Comment the pipeline; on restore, refuse to overwrite an existing target unless --force is passed. </constraints> <format> Return the full bash script as a code block, then a note on supplying the passphrase securely and testing a round-trip backup then restore. </format>
Creates a compress-and-encrypt backup script with a matching restore mode, ready to use.
Pro tip: Test a full backup-then-restore round-trip on a throwaway folder before trusting it with real data.
Two-Folder Mirror with rsync
20/30You are a systems administrator who writes safe rsync-based sync scripts. <context> I need a script that mirrors one directory to another (local or over SSH) using rsync, returned as a runnable, commented artifact with logging and a dry-run mode. </context> <inputs> - Source path: [LOCAL PATH] - Destination: [LOCAL PATH OR user@host:/path] - Direction: [ONE-WAY MIRROR / UPDATE-ONLY (NO DELETE)] - Exclude patterns: [E.G. .git, node_modules, *.tmp] - Bandwidth limit: [OPTIONAL, E.G. 5000 KB/s] - Log file: [PATH] </inputs> <task> Write a bash script that builds the correct rsync command for the chosen direction (archive, compress-in-transit for remote, delete only in mirror mode), applies excludes and any bandwidth limit, runs a --dry-run when passed --preview, and appends a timestamped summary to the log. Print files transferred and bytes moved. </task> <constraints> - One self-contained bash script; set -euo pipefail; correct handling of trailing slashes so rsync doesn't nest folders. - The --delete flag is only ever used in explicit mirror mode; update-only mode never deletes. - Verify rsync (and ssh for remote) exist; comment the flag choices. </constraints> <format> Return the full bash script as a code block, then a note on the trailing-slash gotcha, using --preview, and setting up SSH keys for remote sync. </format>
Produces a safe rsync mirror script with dry-run, excludes, and logging, ready to run.
Pro tip: The trailing-slash rule on the source path is the classic rsync footgun; keep --preview on until the paths look right.
Scheduled & Cron Jobs
5 promptsLog Cleanup & Rotation Script
21/30You are a systems engineer who writes disk-hygiene automation. <context> I need a cron-ready script that cleans up and rotates old log files so a folder never fills the disk, returned as a runnable, commented artifact. </context> <inputs> - Log directory: [PATH] - File pattern: [E.G. *.log] - Compress logs older than: [E.G. 7 DAYS] - Delete logs older than: [E.G. 30 DAYS] - Also truncate huge active logs over: [SIZE, E.G. 500MB] - Dry-run first?: [YES / NO] </inputs> <task> Write a bash script that finds matching logs, gzips ones past the compress age, deletes ones past the delete age, and optionally truncates oversized active logs safely (without breaking a process holding the file open). Support --dry-run that only reports actions. Log what it did with timestamps and print bytes reclaimed. </task> <constraints> - One self-contained bash script; set -euo pipefail; operate ONLY inside the given log directory. - Never delete or truncate files outside the pattern; dry-run is default until --apply is passed. - Comment the age and size logic; make it idempotent and safe to run hourly. </constraints> <format> Return the full bash script as a code block, then a note on adding a cron entry and confirming the paths are scoped correctly. </format>
Generates a cron-ready log cleanup and rotation script with dry-run, ready to schedule.
Pro tip: Truncate rather than delete active logs a process is still writing to, or you'll leak the disk space until restart.
Disk Space Monitor with Alert
22/30You are an SRE who writes lightweight monitoring scripts. <context> I need a cron-ready script that checks disk usage and alerts me when a mount crosses a threshold, returned as a runnable, commented artifact. </context> <inputs> - Mounts to watch: [E.G. / , /data] - Warn threshold: [E.G. 80%] - Critical threshold: [E.G. 90%] - Alert channel: [PRINT / WEBHOOK URL / EMAIL COMMAND] - Only alert on state change?: [YES / NO] - State file: [PATH] </inputs> <task> Write a bash script that reads usage for each watched mount, compares against warn/critical thresholds, and sends an alert with the mount, percent used, and free space. If 'only on change' is set, store last state and alert only when the level changes (ok -> warn -> critical). Exit code reflects the worst level found so cron can flag failures. Print a one-line status per mount. </task> <constraints> - One self-contained bash script; set -euo pipefail; use df in a portable way and parse safely. - Never crash on a missing mount; report it as an error line instead. - Comment the threshold and state-change logic; keep the alert payload compact. </constraints> <format> Return the full bash script as a code block, then a note on the exit-code convention, wiring the webhook, and scheduling it every 15 minutes. </format>
Creates a disk-usage monitor script with thresholds and change-only alerts, ready to schedule.
Pro tip: Turn on 'only alert on change' so cron doesn't spam you every 15 minutes while a disk sits at 85%.
Daily Summary Report Generator
23/30You are an automation engineer who builds scheduled reporting scripts. <context> I need a cron-ready script that gathers a few metrics each day and produces a formatted summary report, returned as a runnable, commented artifact. </context> <inputs> - Data sources: [E.G. A LOG FILE, A CSV, A SHELL COMMAND OUTPUT] - Metrics to compute: [E.G. TOTAL EVENTS, ERROR COUNT, TOP 5 ITEMS] - Report format: [PLAIN TEXT / MARKDOWN / HTML] - Output: [WRITE TO FILE PATH / PRINT / PIPE TO EMAIL COMMAND] - Date range: [TODAY / LAST 24H] - Language: [PYTHON / BASH / AUTO] </inputs> <task> Write a script that reads the configured sources, computes the requested metrics for the date range, and renders a clean report in the chosen format with a title, a timestamp, a metrics summary section, and a top-items table. Write it to the output target. Print a confirmation line with the report path or a short preview. </task> <constraints> - Prefer standard library; if a data source is missing, note it in the report rather than crashing. - Deterministic formatting; numbers aligned; timestamps in ISO format. - Comment the parsing and aggregation logic so I can add a new metric. </constraints> <format> Return the full script as a code block, then a note on adding a metric, choosing the output target, and scheduling it daily via cron. </format>
Builds a scheduled daily-report generator that aggregates metrics into a formatted summary, ready to run.
Pro tip: Have it output Markdown, then pipe that into an email or Slack step so the report reads well in either.
Scheduled Uptime / Health-Check Pinger
24/30You are an SRE who writes endpoint monitoring scripts. <context> I need a cron-ready script that checks whether a list of URLs or services is healthy and alerts on failures, returned as a runnable, commented artifact. </context> <inputs> - Targets to check: [LIST OF URLs OR host:port] - Success criteria: [HTTP 200-399 / EXPECTED TEXT IN BODY / TCP CONNECT] - Timeout per check: [SECONDS] - Retries before failing: [E.G. 2] - Alert channel: [PRINT / WEBHOOK URL / LOG] - Alert on recovery too?: [YES / NO] </inputs> <task> Write a script that checks each target against its success criteria with the configured timeout and retries, records status, and sends an alert when a target goes down (and optionally when it recovers). Track state between runs so it doesn't re-alert on an already-down target. Print a status table and set the exit code to non-zero if anything is down. </task> <constraints> - Prefer standard library / curl; store per-target state in a small JSON file. - Handle DNS/connection errors as 'down', not as script crashes; respect the timeout strictly. - Comment the check, retry, and state-transition logic. </constraints> <format> Return the full script as a code block, then a note on the state file, the exit-code convention, and scheduling it every few minutes via cron. </format>
Generates a health-check pinger that alerts on down/recovery with state tracking, ready to schedule.
Pro tip: Enable recovery alerts so you get the 'back up' message too, not just silence after an outage.
Crashed-Service Watchdog
25/30You are a systems engineer who writes process-supervision scripts. <context> I need a cron-ready watchdog script that checks whether a process or service is running and restarts it if it has died, returned as a runnable, commented artifact. </context> <inputs> - Service identifier: [PROCESS NAME / PID FILE / systemd UNIT / PORT] - How to detect it: [pgrep / PID FILE / port CHECK / systemctl is-active] - Restart command: [E.G. systemctl restart X / A SHELL COMMAND] - Max restarts per window: [E.G. 3 IN 10 MIN] - Log file: [PATH] - Notify on restart?: [PRINT / WEBHOOK] </inputs> <task> Write a bash script that detects whether the service is alive using the chosen method, and if not, runs the restart command, logs the event with a timestamp, and optionally notifies. Implement a restart-rate limit: if it has restarted more than N times in the window, stop trying and log a 'flapping' alert instead of looping forever. Print the current state and any action taken. </task> <constraints> - One self-contained bash script; set -euo pipefail; track restart timestamps in a small state file. - Never spawn duplicate instances; respect the rate limit so a broken service can't be restart-looped. - Comment the detection, restart, and flap-guard logic. </constraints> <format> Return the full bash script as a code block, then a note on the detection method, the flap guard, and scheduling it every minute via cron. </format>
Creates a service watchdog script that restarts dead processes with a flap-protection guard, ready to schedule.
Pro tip: The rate limit is essential; without it a service that dies on startup will get restart-looped forever and spam alerts.
Most people use 10% of Claude. Tutorials unlock the rest.
AI Academy: 300+ hands-on tutorials on Claude, ChatGPT, Midjourney, and 50+ AI tools. New tutorials added every week.
API Calls
5 promptsAPI Fetch with Pagination to CSV
26/30You are a backend engineer who writes robust API client scripts. <context> I need a script that pulls all records from a paginated REST API and writes them to a CSV, returned as a runnable, commented artifact. </context> <inputs> - Base endpoint: [URL] - Auth: [NONE / BEARER TOKEN (ENV VAR) / API KEY HEADER] - Pagination style: [PAGE NUMBER / offset+limit / CURSOR IN RESPONSE] - Fields to keep: [LIST OF JSON PATHS] - Output CSV: [PATH] - Language: [PYTHON / NODE / AUTO] </inputs> <task> Write a script that requests each page following the pagination style, accumulates records until there are no more, flattens the chosen fields out of each JSON object, and writes them to a CSV with a header. Read the token/key from an environment variable. Retry transient errors (429, 5xx) with exponential backoff and honor a Retry-After header. Print pages fetched and total rows. </task> <constraints> - Prefer standard library (or requests); never hardcode the token; document the env var in a comment. - Correct backoff-and-retry on 429/5xx; stop cleanly at the last page. - Comment the pagination and field-flattening logic; handle an empty result set. </constraints> <format> Return the full script as a code block, then a note on setting the auth env var, adjusting the pagination style, and mapping fields. </format>
Produces a paginated API-to-CSV fetch script with backoff and retries, ready to run.
Pro tip: Paste one page of the real JSON response so Claude nails the pagination style and exact field paths.
Post Data to a Webhook / API
27/30You are a backend engineer who writes reliable API integration scripts. <context> I need a script that reads records from a file and POSTs each to an API or webhook, returned as a runnable, commented artifact, with proper error handling. </context> <inputs> - Source file: [CSV OR JSON PATH] - Target endpoint: [URL] - Auth: [BEARER (ENV VAR) / API KEY HEADER / HMAC SIGNATURE] - Body mapping: [WHICH COLUMNS/FIELDS -> WHICH JSON KEYS] - On failure: [RETRY N TIMES / LOG AND SKIP / STOP] - Rate limit (requests/sec): [E.G. 5] </inputs> <task> Write a script that reads each record, maps it to the request body, and POSTs it with the configured auth and content-type. Honor the rate limit, retry failures with backoff per the chosen policy, and write a results log (record id, status code, response summary) plus a failures file for anything that didn't succeed. Print totals: sent, succeeded, failed. </task> <constraints> - Prefer standard library (or requests); read secrets from env vars, never inline. - Idempotency-friendly: log each result so a re-run can skip already-sent records if an id is available. - Comment the mapping, auth, and retry logic; validate the endpoint responds before bulk-sending. </constraints> <format> Return the full script as a code block, then a note on the body mapping, supplying auth via env, and re-running only the failures file. </format>
Generates a file-to-API POST script with rate limiting, retries, and a failures log, ready to run.
Pro tip: Ask Claude to make it re-runnable from the failures file so a partial run is trivial to resume.
Scheduled API Poll to Data Store
28/30You are a data engineer who writes scheduled ingestion scripts. <context> I need a cron-ready script that polls an API on a schedule and appends new results to a local store (CSV or SQLite), returned as a runnable, commented artifact that only records new records. </context> <inputs> - Endpoint: [URL] - Auth: [NONE / BEARER (ENV VAR)] - Unique record key: [FIELD USED TO DEDUPE] - Store: [APPEND CSV / SQLITE TABLE] - Store path: [PATH] - Incremental param: [E.G. since=LAST_TIMESTAMP, OR NONE] </inputs> <task> Write a script that fetches the endpoint (using the incremental 'since' param when supported), parses the records, deduplicates against what is already stored using the unique key, and appends only new rows to the store. Persist the latest timestamp/cursor for the next run. Print records fetched, new records added, and duplicates skipped. </task> <constraints> - Prefer standard library (csv/sqlite3); create the store/table on first run. - Deduplicate reliably by the unique key; never insert a duplicate; handle an empty response. - Comment the incremental and dedup logic; read auth from env; retry transient errors. </constraints> <format> Return the full script as a code block, then a note on the dedup key, the incremental cursor, and scheduling it via cron. </format>
Creates a scheduled API-poll ingestion script that appends only new records to CSV or SQLite, ready to run.
Pro tip: Use the API's 'since' parameter when it has one; it turns a full re-pull into a cheap incremental fetch.
Concurrent Bulk API Requests
29/30You are a backend engineer who writes high-throughput, well-behaved API clients. <context> I have a list of IDs or URLs to enrich by calling an API for each, and I need it done fast but safely, returned as a runnable, commented script artifact. </context> <inputs> - Input list: [FILE OF IDs/URLs] - Endpoint template: [E.G. https://api.x.com/items/{id}] - Auth: [BEARER (ENV VAR) / API KEY / NONE] - Concurrency: [E.G. 10 PARALLEL] - Global rate limit: [E.G. 20 REQUESTS/SEC] - Output: [JSONL / CSV PATH] </inputs> <task> Write a script that fires requests concurrently up to the concurrency cap while enforcing the global rate limit, collects each response (or error), and writes results streaming to the output file so a crash doesn't lose progress. Retry transient failures with backoff, and record failures separately. Print a live-ish progress count and final totals. </task> <constraints> - Use a concurrency primitive appropriate to the language (asyncio/aiohttp for Python, Promise pool for Node); state the choice in a comment. - Enforce BOTH the concurrency cap and the rate limit; never exceed either; back off on 429. - Stream output so progress survives interruption; comment the concurrency and rate-limit logic. </constraints> <format> Return the full script as a code block, then a note on tuning concurrency vs. rate limit and resuming from partial output. </format>
Builds a concurrent bulk-request script with a rate limiter and streaming output, ready to run.
Pro tip: Set the rate limit to the API's documented ceiling first; raising concurrency past that just earns you 429s.
API Response Cache Wrapper
30/30You are a backend engineer who writes caching utilities for API-heavy scripts. <context> I keep hitting the same API endpoints repeatedly during development and want a script/module that caches responses to disk to save time and quota, returned as a runnable, commented artifact. </context> <inputs> - Language: [PYTHON / NODE] - Cache location: [FOLDER PATH] - Cache TTL: [E.G. 1 HOUR, OR PER-CALL] - Key by: [FULL URL / URL + BODY] - Auth header handling: [EXCLUDE FROM CACHE KEY] - Max cache size / entries: [OPTIONAL] </inputs> <task> Write a small module with a cached_get/cached_request function that builds a cache key from the request (excluding auth headers), returns a fresh on-disk cached response when it exists and is within TTL, otherwise performs the real request, stores the response with a timestamp, and returns it. Include a --clear option to purge expired entries and a demo call at the bottom. Print cache hit vs. miss for each call. </task> <constraints> - Prefer standard library; store cache entries as files named by a hash of the key; never cache non-2xx responses. - Respect the TTL exactly; exclude Authorization from the key so tokens don't fragment the cache. - Comment the key-building, TTL, and eviction logic. </constraints> <format> Return the full module as a code block with a usage example, then a note on invalidating the cache and setting per-call TTLs. </format>
Generates a disk-backed API response cache module with TTL and hit/miss logging, ready to use.
Pro tip: Excluding the auth header from the cache key is what lets the cache survive a token refresh without going stale.
Frequently Asked Questions
Prompts are the starting line. Tutorials are the finish.
A growing library of 300+ hands-on tutorials on ChatGPT, Claude, Midjourney, and 50+ AI tools. New tutorials added every week.
7-day free trial. Cancel anytime.