I used to treat ChatGPT like a vending machine. Need a React hook? Drop a coin. Need a PR summary? Drop another. Every ask started from zero — stack, conventions, what “done” meant — and every reply drifted a little from how we actually ship.
The waste wasn’t the tokens. It was re-explaining our frontend rules every single time, then cleaning up the same mistakes.
So I stopped pasting one-offs and started treating prompts like code: named, versioned, and checked into the repo.
One-off asks don’t compound
A throwaway chat is fine for a throwaway question. Frontend work rarely is throwaway:
- “Write a Modal” without our focus-trap / Escape / return-focus rules
- “Add loading states” without our skeleton vs spinner convention
- “Review this PR” without what AI should skip vs what a human owns
- “Refactor this form” without our form library and error-message pattern
You get something that compiles. You don’t get something that matches the last three PRs. The next person (or the next you) pays the tax again.
What belongs in a prompt library
I keep a small folder — prompts/frontend/ — not a novel. Each file is one job, one outcome shape.
Mine look like this:
prompts/frontend/
pr-review-ai.md # what the model checks vs leaves for humans
new-component.md # scaffold + a11y buckets + token rules
design-token-change.md # changelog / RFC checklist before merge
test-plan.md # real coverage vs fake green
agent-ui-diff.md # component boundaries, no random token edits
accessible-react.md # roles / keyboard / contrast report required
If a prompt isn’t reused at least twice a month, it doesn’t earn a file. Sticky notes in chat stay sticky notes.
The shape every prompt gets
Same skeleton so humans and agents know where to look:
# <job name>
## When to use
One sentence. If it doesn’t match, don’t force it.
## Context to paste
- Framework / router / form lib (or “read from repo”)
- Design tokens source of truth
- Related golden files (paths)
## Hard rules
Bullet list the model must not violate.
Prefer native HTML, keep tokens, no drive-by refactors, etc.
## Output format
Numbered sections the reply must include.
Missing a section = reject the turn.
## Done looks like
Concrete acceptance — not “looks good.”
The “output format” line is the whole game. Models fill schemas. They invent vibes when you don’t give one.
From ChatGPT paste to agent / editor default
Once the files exist, wire them where work actually happens:
-
Cursor / Copilot / Claude project instructions — point at
prompts/frontend/or inline the two you use daily. -
PR bot / agent — load
pr-review-ai.mdas the system brief; humans still own product judgment. -
Slash or snippet —
@new-componentexpands the scaffold prompt so nobody retypes it. - CI-ish habit — if the agent reply skips a required section, treat it like a failed check and re-run with the same file.
You don’t need a fancy prompt CMS. Markdown in git is enough. Review prompt changes in PRs the same way you’d review eslint config.
A tiny migration story
Week 1 I had twelve ChatGPT threads titled “modal again.” Week 3 I had six files and deleted half the threads.
What changed in practice:
- New Button / Modal / Combobox asks started from the same a11y report shape
- Token edits stopped sneaking hex literals into components
- AI PR comments stopped arguing about naming when the prompt said “leave naming to humans”
Same models. Less re-prompting. The library held the team memory the chat UI kept forgetting.
What not to put in the library
- Product pitches and marketing copy (keep prompts about shipping UI)
- One-shot debug sessions that will never recur
- Entire style guides pasted twice — link the real doc instead
- Secrets, private URLs, or customer data as “examples”
A prompt library is DX infrastructure. If it reads like a blog draft, move it to the blog.
Start with three, not thirty
Tonight, pick the three asks you keep repeating. Write each as one markdown file with When / Rules / Output / Done. Drop them in the repo. Point your editor agent at that folder.
Next time you open a blank ChatGPT box for a frontend task, open the matching file instead. Paste once. Reuse forever. That’s the whole upgrade — from one-off asks to a library your future self (and your agents) can actually find.
Top comments (0)