29 free prompts · all verified

Python prompts

Python prompts across the real day-to-day — scripts, data wrangling, FastAPI services, tests — written with type hints and error handling in the ask, not bolted on after.

Every prompt lists the exact tool and version it was tested against.

Turn a plain-English function spec into fully type-hinted PythonA prompt that converts a rough description of what a function should do into PEP 484-typed Python with explicit edge-case handling, a real docstring, and a typed return object — instead of untyped happy-path code that only handles the example in the spec.ChatGPT (GPT-5.2)Claude (Sonnet 4.6)2026-07-20Scaffold a FastAPI endpoint with real validation and status codesA prompt that turns an endpoint requirement into a complete FastAPI route with Pydantic v2 models, correct HTTP status codes, and dependency-injected services, instead of a bare route stub returning a dict.GitHub Copilot ChatCursor 2.12026-07-21Generate a pytest suite that tests behavior, not implementationA test-generation prompt that requires parametrized cases, isolated external dependencies, and named edge-case coverage, instead of a handful of near-duplicate happy-path tests that break on any refactor.Claude CodeGitHub Copilot Chat2026-07-22Turn a messy DataFrame into a documented, reproducible cleaning pipelineA prompt for building a pandas cleaning pipeline as small, named, chainable functions with logged row drops and a schema check at the end, instead of one long unexplained block of reassignments.ChatGPT (GPT-5.1)Claude (Sonnet 4.6)2026-07-23Turn a one-off Python script into a proper CLI toolA prompt that converts a script with hardcoded values or manual sys.argv indexing into a Typer or Click CLI with real help text, validation, safe defaults for destructive actions, and an installable entry point.Claude CodeChatGPT (GPT-5.1)2026-07-23Refactor blocking Python code to async without breaking it silentlyA prompt for converting synchronous I/O-bound code to async/await that separates what genuinely benefits from async, wraps unavoidable blocking calls correctly, and checks every caller — instead of prefixing every function with async def and calling it done.Claude CodeChatGPT (GPT-5.1)2026-07-24Design Pydantic v2 models that validate a real domain, not just shapesA prompt for designing Pydantic v2 models with field constraints, cross-field validators, and deliberate optional/required decisions from a description of real-world business rules, instead of models that just describe field names and types.Claude CodeChatGPT (GPT-5.1)2026-07-25Diagnose a Python dependency or virtual environment conflict systematicallyA structured diagnostic prompt for dependency and venv breakage that requires a stated root-cause hypothesis and cited evidence before proposing a fix, instead of jumping straight to pip install --upgrade.ChatGPT (GPT-5.1)Claude (Sonnet 4.6)2026-07-26Find out why Python code is actually slow before optimizing itA profiling-first prompt that requires naming the real bottleneck category with a specific tool and command before suggesting any optimization, instead of guessing at generic speedups that may not touch the actual problem.Claude CodeChatGPT (GPT-5.1)2026-07-27Package a Python project for real distribution with pyproject.tomlA prompt for producing a complete, modern src-layout package with a real pyproject.toml, dev/test dependency groups, and a verified build step, instead of a bare setup.py or an incomplete pyproject stub.Claude CodeChatGPT (GPT-5.1)2026-07-27Build a data validation pipeline that quarantines bad records instead of crashing on themA prompt for a validation layer on an ingestion pipeline that separates "reject the whole batch" from "quarantine the bad row and keep going," backed by one named schema instead of scattered ad hoc checks.ChatGPT (GPT-5.1)Claude (Sonnet 4.6)2026-07-28Get Python code reviewed for idiomaticity, not just correctnessA review prompt that separates "is this correct" from "is this how an experienced Python developer would write it," with a closed set of idiom categories so the review surfaces real foot-guns instead of restating the code.Claude CodeChatGPT (GPT-5.1)2026-07-29Diagnose and fix a circular import without just moving the problem aroundA prompt for tracing exactly which two modules import each other and why, then choosing a real structural fix (restructuring, a local import, a shared interface module) instead of papering over it with a same-file workaround that resurfaces later.Claude CodeChatGPT (GPT-5.1)2026-07-30Write a retry-with-backoff decorator that preserves the wrapped function correctlyA prompt for a generic retry decorator (sync and async variants) that preserves signatures and docstrings with functools.wraps, distinguishes retryable from fatal exceptions, and caps total wait time — instead of a naive while-loop that retries everything forever.Claude CodeChatGPT (GPT-5.1)2026-07-31Convert a hand-rolled class to a dataclass without changing its equality semantics by accidentA prompt for converting a manually-written __init__/__eq__/__repr__ class into a dataclass (or attrs class) with the right frozen, eq, and hashability settings for how instances are actually used, instead of a default dataclass conversion that silently breaks set or dict membership.Claude CodeChatGPT (GPT-5.1)2026-07-31Replace print() debugging with structured logging that survives productionA prompt for migrating print-based debugging to the logging module with correct levels, structured context fields, and no logger-configuration surprises at import time — instead of a find-and-replace of print with logging.info that keeps every other bad habit.Claude CodeChatGPT (GPT-5.1)2026-08-01Design SQLAlchemy 2.0 ORM models that avoid N+1 queries by constructionA prompt for declarative SQLAlchemy 2.0 models using Mapped/mapped_column typing, with relationship loading strategies chosen deliberately per access pattern, instead of default lazy loading that quietly produces an N+1 query storm the first time a list view renders.Claude CodeChatGPT (GPT-5.1)2026-08-02Parallelize a CPU-bound batch job across cores without a pickling errorA prompt for converting a slow single-process CPU-bound loop into a multiprocessing.Pool-based job, with chunk sizing, picklability checked up front, and a documented reason it is multiprocessing and not threading — instead of a naive Pool.map that crashes on an unpicklable argument.Claude CodeChatGPT (GPT-5.1)2026-08-02Write property-based tests with Hypothesis for a function with a large input spaceA prompt for designing Hypothesis strategies and invariant properties for a function whose bugs live in inputs nobody thought to write an example test for, instead of a handful of manually chosen example-based test cases that only cover what the author already imagined.Claude CodeChatGPT (GPT-5.1)2026-08-03Build a pydantic-settings config loader with real local/staging/production profilesA prompt for a pydantic-settings BaseSettings hierarchy with per-environment overrides, fail-fast validation on missing secrets, and a clear precedence order between env vars and .env files, instead of an ad hoc os.environ.get scattered across the codebase with silent string defaults.Claude CodeChatGPT (GPT-5.1)2026-08-04Design a custom exception hierarchy callers can actually catch selectivelyA prompt for a library-level exception hierarchy with a single common base, semantically distinct subclasses, and preserved exception chaining, instead of one flat CustomError class that forces every caller into the same broad except block regardless of what actually went wrong.Claude CodeChatGPT (GPT-5.1)2026-08-05Process a file too large to load into memory, without silently truncating itA prompt for streaming/chunked processing of a large CSV, JSONL, or log file with a bounded, stated memory footprint and a resumability plan for a mid-run crash, instead of a pandas.read_csv() or json.load() that works in dev on a sample file and OOM-kills the process on the real one.Claude CodeChatGPT (GPT-5.1)2026-08-06Build a web scraper that respects rate limits and fails predictablyA prompt for a scraping script that checks robots.txt, paces requests deliberately, retries transient failures without hammering the target, and extracts data into a validated structured schema — instead of a tight fetch loop that gets the IP blocked on day one.Claude CodeChatGPT (GPT-5.1)2026-08-07Turn a plain-English analytics question into a parameterized Postgres query that won't get you paged for a table scanWrites a parameterized (never string-formatted) Postgres query for a specific analytics question, plus the EXPLAIN-based check to run before it goes anywhere near production data.ChatGPT2026-08-08Design a normalized table schema for a new feature without breaking the tables already in productionProduces a normalized schema for a new feature plus a phased migration plan against your existing tables, so the design doesn't just look right on a whiteboard but actually ships without a destructive rewrite.ChatGPT2026-08-09Scaffold a Python CLI tool whose flags, config file, and environment variables don't silently fight each otherBuilds a Click-based CLI with subcommands, a clearly defined config-precedence order, and exit codes a shell script can actually branch on — not just a toy argparse demo.ChatGPT2026-08-10Write a one-off Python cleanup script that won't need a second one to undo itProduces a one-off data cleanup or migration script with a mandatory dry-run mode and idempotency built in, for the kind of throwaway script that quietly becomes load-bearing the moment it touches real data.ChatGPT2026-08-11Write a FastAPI endpoint whose 422 and 401 responses actually tell the caller what went wrongBuilds one FastAPI endpoint with Pydantic request/response models, an auth dependency, and distinct, informative error responses — the version that survives a frontend integrating against it, not just a Swagger demo.ChatGPT2026-08-12Design a Python exception hierarchy that tells your retry logic which failures are worth retryingProduces a custom exception hierarchy and error-handling strategy for a service module that distinguishes retryable failures from fatal ones, instead of one flat except-Exception block deciding everything the same way.ChatGPT2026-08-13

Other prompt categories

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY