18votes
2answers
3.1kviews

Prompt for a production-grade Python CLI with argparse, exit codes, and a self-check

Every weekend project starts with me asking a model for "a Python script that does X" and getting back a 20-line toy: no argument parsing, prints stack traces at users, returns 0 even when it failed.
18votes
0answers
2.0kviews

A reusable chain-of-thought scaffold as a system prompt, not inline rambling

I maintain a shared prompt library for my team and the biggest inconsistency was reasoning quality. People would tack "think step by step" onto the end and get mushy, unstructured chains that were har
18votes
1answers
2.2kviews

Prompt for docstrings that document the WHY and the gotchas, not just the params

Auto-generated docstrings are useless: they restate the function signature in English. def add(a, b): """Adds a and b.""". Thanks. I wrote a prompt that reads the function body and forces it to docume
17votes
1answers
2.4kviews

Safely refactoring a 600-line god-function CLI without changing its behavior

Inherited a single def run() that was 600 lines: arg parsing, file IO, business logic, and printing all tangled together. Management wanted features added but touching it was Russian roulette. Asking
17votes
1answers
2.5kviews

Canvas flow-field particles with trails that fade instead of piling into a smear

Flow-field particle trails on canvas always end up either as harsh solid lines or, when I try to fade them, a muddy gray wash because I clear with a semi-transparent black rectangle every frame and it
16votes
2answers
4.0kviews

LLM-as-judge rubric prompt for scoring agent answers without grade inflation

I needed automated evals for an agent and reached for LLM-as-judge. First attempt: "rate this answer 1-10." Everything got a 7 or 8, the scores didn't correlate with human labels, and a slightly longe
16votes
1answers
1.7kviews

Prompt for a CSV-to-chart tool that picks the chart type instead of me

I wanted an internal tool where an analyst pastes any CSV and gets a defensible chart without choosing a type. My first attempt just always drew a bar chart, which is nonsense for two numeric columns.
16votes
0answers
2.3kviews

Prompt for OrbitControls that auto-frames any loaded model and never lets you fly inside it

I load a lot of random glTF models and half of them arrived either microscopic or filling the whole viewport. I kept manually tweaking camera distance per model like an animal. So I wrote a prompt tha
16votes
2answers
3.1kviews

Canvas candlestick chart that survives a code review at 50k OHLC bars

Our desk needed an intraday candlestick view that stays at 60fps when someone scrolls a full year of 1-minute bars. The obvious SVG version from the model died around 8k nodes, and the first canvas at
16votes
1answers
5.3kviews

Prompt that makes Claude generate a playable Snake game with juice and screen shake

Most snake-game prompts give you a joyless gray grid. I wanted arcade feel: particles, screen shake, an actual difficulty curve. After a lot of trial and error the prompt below consistently produces a
16votes
1answers
1.9kviews

Prompt for commit messages that explain WHY, generated from a diff

My commit history was a graveyard of "fix", "update", "wip". Reviewing my own PRs a month later was archaeology. I wired a prompt into a pre-commit hook that reads the staged diff and drafts a Convent
16votes
2answers
2.7kviews

Structured root-cause prompt that turns a stack trace into a ranked fix list

When I paste a raw stack trace, models tend to fixate on the deepest frame and suggest a fix right there, even when the real cause is three frames up where a bad value was created. The topmost error i
15votes
0answers
1.8kviews

Prompt for React CRUD with optimistic updates and rollback that doesn't corrupt the cache

Systems guy dabbling in web here. Optimistic UI kept biting me: the happy path looked instant, but a failed delete left a ghost row, or two rapid edits raced and the cache ended up in a state that mat
15votes
1answers
1.7kviews

Prompt for a Sokoban with guaranteed-solvable procedural puzzles

Sokoban is easy to render and brutal to generate: random box/goal placement gives you puzzles that are either trivial or literally unsolvable (a box shoved into a corner it can never leave). I wanted
15votes
1answers
2.5kviews

Turning a paragraph of requirements into a Postgres schema with RLS and a migration

I wanted to describe a multi-tenant app in plain English and get back a schema that respects tenancy at the database layer, not just in the app code where one forgotten where orgid = leaks everyone's