Techniques for writing better prompts themselves.
51votes
2answers
6.3kviews

A reusable system prompt for consistent design direction across a whole landing page

The hardest part of prompting UI isn't any single section, it's consistency. Ask for a hero, then a pricing block, then a footer in separate turns and you get three subtly different design languages:
25votes
2answers
4.5kviews

Guardrail prompt so my coding agent stops inventing files it never read

Building an autonomous coding agent and the scariest bug wasn't a crash, it was confident fabrication: it would "edit" config/settings.py describing lines that didn't exist, because it never actually
24votes
2answers
2.8kviews

Output contract that makes the model write code future-me won't hate

My gripe isn't that AI code is wrong, it's that it is unmaintainable: 80-line functions, clever one-liners, no seams for testing, magic numbers everywhere. It passes review by looking confident. I sto
20votes
2answers
3.1kviews

Prompt that turns a messy codebase into a README people actually finish reading

Our README was the usual wall: a paragraph of marketing, then npm install, then nothing. New hires bounced off it constantly. What finally worked was forcing the model to write for one specific reader
19votes
1answers
3.4kviews

Context-engineering trick to fit a 40-file module in one prompt cheaply

I kept blowing my context budget dumping a whole module into Claude for a cross-cutting change. Pasting all 40 files raw cost a fortune and buried the model in noise, so its edits drifted from the par
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
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
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
13votes
0answers
3.1kviews

Prompt for reviewing a diff with severity levels instead of vague nitpicks

Our AI code reviews were noise: a wall of "consider renaming this" and "you could add a comment" mixed in with the occasional actual security bug, all weighted the same. People started ignoring the bo
9votes
1answers
1.7kviews

Forcing the model to write the failing test first instead of the impl

I do strict TDD and I wanted the model to do it with me, not for me. Default behavior with GPT is: ask for a feature, get the implementation plus some tests it wrote to match the code it just wrote. T
5votes
1answers
964views

Prompt that rewrites a dense technical blog draft to a target reading level without dumbing it down

My drafts read like release notes: correct, unreadable. I wanted them accessible to a junior dev without stripping the actual substance, which most "simplify this" prompts do by deleting the interesti