Structuring context, examples, and constraints to steer outputs.
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
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
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
26votes
2answers
5.3kviews

System prompt for a docs chatbot that says "I don't know" instead of confidently making things up

We shipped a docs assistant and the failure mode wasn't rudeness or refusals, it was fluent, confident answers about features that don't exist. Worse than useless because people trusted it. The fix wa
27votes
1answers
4.6kviews

RAG chatbot system prompt that refuses to answer beyond the retrieved context

Building a docs assistant over our internal knowledge base. The naive version blended retrieved chunks with the model's prior knowledge, so it would answer questions our docs never covered and sometim
44votes
1answers
4.5kviews

How do I prompt for landing copy that sounds like a person, not a pitch deck?

Every draft came back in the same LinkedIn-influencer cadence: "Unlock. Empower. Transform." It read like six other startups. I got somewhere by giving the model a real voice sample and a hard banned-
36votes
2answers
3.4kviews

Prompt for a typed third-party API client with real retry and error handling, not fetch soup

Every "integrate the Stripe/Notion/whatever API" answer I got was a bare fetch with no timeout, no retry, and a catch (e) { console.log(e) } that swallowed everything. Then it fell over the first time
35votes
1answers
3.4kviews

Context-engineering prompt for compacting an agent's long history without losing the thread

Long-running agents blow the context window. Naive truncation drops the early decisions that explain why the code looks the way it does, so the agent re-litigates settled choices. Summarizing the whol
22votes
0answers
2.3kviews

Planning-loop prompt that makes an agent decompose before it touches any tools

Our agents were too eager. Given a task they'd immediately start editing files, then discover halfway through that the approach was wrong and thrash. Latency and token cost ballooned from all the back
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.
12votes
0answers
1.9kviews

Deterministic triage prompt for classifying inbound tickets into fixed buckets

I needed to route thousands of support tickets into a small set of categories for a dashboard. My first prompt was "classify this ticket" and it happily invented new categories every few hundred rows
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
13votes
0answers
1.3kviews

Chart theming as design tokens so every chart in the app matches

We had six charts built by four people and they all looked slightly different: different grays for gridlines, different fonts, three shades of the same 'brand blue'. I wanted the model to generate a s
18votes
2answers
1.6kviews

Prompt for a dedup + latest-record SQL query using window functions with a self-check

Reporting handed me an events table with duplicate rows per entity (late-arriving data, at-least-once delivery) and I needed exactly the latest row per key. The naive GROUP BY + MAX(updatedat) approac
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