57votes
2answers
5.3kviews

How do you stop a tool-use agent from calling the same function five times in a row?

I have a research agent with search, fetch, and a calculator tool. It gets into loops: searches, gets a mediocre result, searches again with a nearly identical query, and burns tokens/latency without
54votes
1answers
5.2kviews

Prompt for a Next.js email + OAuth auth flow with sessions that survive a refresh

Auth is where my "ship it" energy usually crashes. I asked for login and got a flow that stored a JWT in localStorage, had no CSRF thought, and logged the user out on every hard refresh because the se
6votes
0answers
1.2kviews

Endless runner prompt with procedural obstacles that stay fair as speed ramps

Made a Canabalt-style one-button endless runner and the procedural obstacle spawner kept generating impossible sequences: two gaps back to back with no room to land, or a wall the instant you couldn't
42votes
1answers
5.9kviews

Prompt to turn a rambling meeting transcript into decisions, owners, and open questions

I was drowning in transcript summaries that were just shorter transcripts. "The team discussed X. Then they discussed Y." No signal. I switched to a prompt that extracts only three things and forces a
21votes
1answers
2.9kviews

Getting a chatbot to say 'I don't know' instead of confidently making things up

The hardest moment for any assistant I build is the one where it should admit it doesn't know. Left alone, models fill silence with fluent nonsense, and one confident fabrication costs more trust than
10votes
0answers
1.3kviews

Touch bottom-sheet micro-interaction that feels native without a JS animation lib

Building a PWA and the bottom sheet is the make-or-break interaction. The generated versions animated height (janky), had no drag affordance, and snapped instantly instead of easing, so it felt like a
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
28votes
1answers
5.2kviews

GPU particle system in three.js: 100k points orbiting a strange attractor at 60fps

I wanted a big swirling particle cloud following a Lorenz/Thomas attractor. CPU-updating 100k positions per frame in JS was a slideshow. I knew I needed the integration to happen on the GPU but kept g
28votes
0answers
4.2kviews

One prompt for a polite, resumable web scraper that won't get me IP-banned

I needed to pull a few thousand product pages for a price-history side project. My first scraper hammered the site with 50 concurrent requests, got a 429, then kept retrying instantly and made it wors
23votes
2answers
2.7kviews

Real-time metrics dashboard with sparkline gauges over a websocket feed

I was building a live ops board that streams a few dozen metrics over a websocket, each shown as a number plus a rolling sparkline. The naive build re-rendered the entire React tree on every message a
23votes
2answers
4.2kviews

Support-agent system prompt with escalation rules that actually hand off cleanly

I build customer support bots and the recurring failure is the bot pretending it can do things it can't (issue refunds, change a subscription) and then dead-ending the user. Or the opposite: it escala
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
24votes
1answers
4.3kviews

Admin dashboard prompt that doesn't produce the same three gray shadcn cards

Every dashboard I one-shotted came out as the identical layout: three stat cards on top, a big line chart, a table. Technically fine, visually indistinguishable from every other AI dashboard on the in
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
14votes
2answers
2.3kviews

How do you prompt GPT for an editorial, type-driven landing hero (think magazine, not startup)?

I come from print. I want landing heroes that feel like the opening spread of a good magazine: a strong typographic idea, real hierarchy, confident negative space. What I keep getting from GPT is a co