TL;DR — The era of hand-writing prompts isn't ending, but on its own it no longer suffices. The biggest shift I see in the field is this: instead of polishing prompts one by one by hand, you define a metric and a small evaluation (eval) set, then hand the optimization over to the machine. Frameworks like DSPy let you use an LLM by programming it rather than by hand-writing prompts: you declare behavior with a Signature, compose with Modules, and compile the prompt against a metric over a small dataset with an optimizer. Meta-prompting, in turn, is the act of having an LLM write, critique, and improve another prompt. As Gartner summarized in July 2025, "prompt engineering out, context engineering in" — meaning the skill isn't disappearing, it's maturing. In this piece I explain why hand-prompting doesn't scale, DSPy's core concepts in plain language, how to build an eval set, when automation is worth it and when it isn't, the security risks, and a starter evaluation set for Turkish.
Why hand-writing prompts doesn't scale
At the start, we all did the same thing. We opened a chat window, typed a request, disliked the output, changed a sentence, added "think step by step," dropped in an example, and tried again. This loop works beautifully for a single task, a one-off job. The trouble begins when you put that prompt into a production system.
Doing consulting in the field, I keep seeing the same picture: a team spends weeks and finds the "perfect" prompt. That prompt works great on the fifteen examples they tried. Then the system goes live, real users arrive with real inputs, and hundreds of corner cases the prompt never covered surface. The team returns to the prompt, adds a sentence — but that added sentence breaks three scenarios that used to work. Nobody notices, because nobody tests those three scenarios again. This is the classic "regression" problem from software, in prompt form — but without any test infrastructure.
There are several concrete reasons hand-writing prompts doesn't scale:
- Eyeballing is misleading. You think you "improved" a prompt, but with no yardstick it's just a feeling. The human eye is easily fooled on small samples.
- Prompts break when the model changes. When the provider updates the model, the assumptions of your hand-polished prompt collapse. A new version of GPT or Claude behaves differently, and your "magic sentences" no longer have the same effect.
- Combinatorial explosion. A real system has more than one prompt. A classifier prompt, a summarizer prompt, a rewriter prompt, a verifier prompt... each feeds the next. Change one by hand and you have to rebalance the entire chain.
- Knowledge gets trapped in one person. I can't tell you how many times I've heard "Ahmet knows the prompt best." When Ahmet takes leave, the system freezes. Hand-prompting becomes a craft that can't be institutionalized.
- Iteration cost is hidden. Every manual trial consumes a person-hour. An engineer polishing prompts for weeks is an invisible but very expensive cost.
The core idea is this: hand-writing prompts is engineering done without measurement. And no engineering done without measurement scales. Just as we stopped writing code without tests in software, we have to stop writing prompts without metrics.
"An observation from the field: you can only see the difference between "improving" a prompt and "changing" it if you have an eval set. Without one, you're just walking randomly and getting lucky sometimes.
The shift from prompt engineering to context engineering
Gartner summarized this transformation with a very apt slogan in July 2025: "context engineering is in, prompt engineering is out." But that sentence is easy to misread. Nobody is saying "the skill of prompt-writing is trash." What's being said is: the effort to find a single magic sentence gives way to designing the entire context around the model as a system.
What does context engineering cover? In Gartner's framing:
- Context architecture: which information you give the model, in what order, in what form. Retrieval layers, memory, example selection, formatting.
- Agent orchestration: how multiple LLM calls, tools, and steps are coordinated. Who speaks when, who verifies whom.
- Automated optimization pipelines: processes where prompts and context are compiled automatically against a metric rather than by hand. This is the heart of this article.
- Enterprise governance: who can change which prompt, version control, audit trail, approval flows.
- Security-aware system design: baking prompt-injection defense, data-leak prevention, and untrusted-input isolation into the design.
Notice that "writing prompts" is still in there — but it's now just one of ten parts. The skill isn't disappearing; it's turning into a sub-discipline. Just as we moved from writing assembly by hand to using a compiler. Assembly knowledge is still valuable; but the compiler does the daily work now.
Gartner's forecast supports this direction: by 2026, roughly 70% of enterprises are predicted to deploy AI-driven prompt automation. So this isn't a fad but a structural shift settling into the industry's mainstream. AI systems increasingly internalize real-time feedback to self-optimize their prompts, reducing the need for manual iteration.
What does this mean in practice? It means you're no longer searching for "the best sentence." Instead you define three things — (1) what you want the system to do, (2) how you measure success, (3) which examples you measure on. An optimization process handles the rest. DSPy is precisely the framework that concretizes this philosophy.
Understanding DSPy in plain language: Signature, Module, Optimizer
When I first heard about DSPy I got confused, because most explanations dive straight into code. Yet the idea is very clean. DSPy's one-sentence summary is: use the LLM by programming it, not by writing prompts. Instead of hand-writing the prompt text, you declare what you want structurally, and the framework generates and optimizes the prompt for you.
There are three core concepts. Let me explain them in everyday terms.
Signature — Declaring the behavior
A Signature describes the input and output of a task. It's a declaration of "I'll take this kind of input and produce this kind of output." For example: "Input: a customer email. Output: a sentiment label (positive/negative/neutral)." Note that you're not writing the prompt itself here — you're only declaring the behavior's contract. DSPy generates the prompt text.
Think of it like a function signature. In classic programming you write add(a, b) -> c; you fill in the body separately. A Signature is similar: "what goes in, what comes out" is fixed, but the "how" is left to optimization.
Module — Composing the behavior
A Module is the building block that runs a Signature with a particular reasoning strategy. The best-known example is the "chain-of-thought" module: it takes the same Signature but nudges the model to think step by step before arriving at an answer. Other modules chain multiple calls, use tools, or verify an answer with another module.
The key point: modules are composable. You can feed a classification module's output into a summarization module, and its output into a verification module. This way you build a complex system from small pieces, each with its own Signature. This is exactly the idea of software modularity carried into the LLM world.
Optimizer (teleprompter) — The compiler
Here's the magic. The optimizer — sometimes called a "teleprompter" in DSPy's vocabulary — takes a small dataset and a metric, then compiles your Signatures and Modules to yield the best result on that metric. What do I mean by "compile"? The optimizer automatically searches for which examples (few-shot) to put in the prompt, how to phrase the instruction, and in some scenarios even how to tune model weights.
So you don't hand-write "think step by step, here are three examples, answer in this format." The optimizer discovers, by trial on your dev set, which examples and which phrasings raise the metric. This is the automated version of hand-polishing prompts — but based on a measured score rather than a human hunch.
A caveat here: be skeptical of the specific percentage-improvement figures floating around online for DSPy. The framework's value is conceptual — "measurement-driven automatic compilation" — and the gain varies with your task, dataset, and metric. I won't promise you a made-up "40% improvement" here; instead I'll explain why the method makes sense.
Let me put the two worlds side by side with this table:
| Dimension | Hand-writing prompts | Automated optimization (DSPy-style) |
|---|---|---|
| Success criterion | Feeling, eyeballing | Defined metric + eval set |
| Iteration | Person-hours, slow | Automated, parallel, fast |
| Robustness to model change | Fragile, needs rewriting | Recompile, metric preserved |
| Knowledge sharing | Trapped in one person | Institutionalized in code + data + metric |
| Regression control | Almost none | Caught automatically via eval set |
| Startup cost | Low | Medium (need to build an eval set) |
| Cost at scale | Rises over time | Falls over time |
| Best fit | One-off, exploration | Production, repeated, critical tasks |
Looking at the table, you see this: automated optimization has a higher startup cost (building an eval set takes effort) but pays off at scale. For small, one-off jobs hand-prompting still makes sense; for growing and critical systems automation is inevitable.
Meta-prompting: having an LLM write prompts
Meta-prompting, however fancy the name sounds, is actually a very simple idea: using an LLM to write, critique, or improve another prompt. The model is the party that knows its own language best; so you can ask it how it should be instructed.
There are three typical usage forms:
- Generating: you say "write an effective system prompt to solve this task," and the model produces a draft prompt. This solves the blank-page problem. Instead of writing from scratch, you start with a draft to work on.
- Critiquing: you give your existing prompt to the model and ask "in what situations does this prompt fail, what ambiguities does it have?" The model often points out corner cases you couldn't see.
- Improving: you say "this prompt produced a wrong output on this example, revise the prompt to fix this error." The model analyzes the error and updates the instruction.
The power of meta-prompting emerges when you put it into a loop. The model produces a prompt, you run it on your eval set, then feed the results back to the model saying "here are the failed examples, fix the prompt." This loop is essentially the manual/semi-automated version of what a DSPy optimizer does conceptually.
But there's a critical trap here: without a metric, meta-prompting is just a faster tool for fooling yourself. The model gives you a very convincing "improved prompt," and you say "wow, that's much nicer" — but you don't actually know whether it got better. What makes meta-prompting valuable is the evaluation loop behind it. Without it, you're just producing polished words.
"A sentence I often say in consulting: meta-prompting is a gas pedal. If you don't have a steering wheel (your metric), you just hit the wall faster.
Building an evaluation (eval) set and metric: the heart of the matter
Now we've arrived at where the whole point of automated optimization revolves. Neither DSPy, nor meta-prompting, nor a "self-improving system" — none of them work without a metric and an evaluation set. These two are the foundation of all automation. Skip them and all you have is a fancy name.
What is an evaluation set
An evaluation set (eval set / dev set) is a small but representative sample of realistic inputs your system will face and — where possible — expected outputs. I say "small" because you don't need thousands of examples; a well-chosen 30-100 examples are enough as a start for most tasks. What matters is not the count but representativeness.
A good eval set includes:
- Typical cases: the ordinary inputs the system will see most of the time.
- Corner cases: rare but important inputs where the system usually stumbles.
- Hard/ambiguous cases: borderline examples where even a human hesitates.
- Past failures: real cases the system got wrong before. These are worth their weight in gold because that's exactly where you catch regressions.
What is a metric
A metric is a function that turns "how good" an output is into a number. The metric's form varies by task:
- Exact match: in classification, does the output equal the correct label? Simple and reliable.
- Overlap scores: in extraction/summary tasks, how many of the expected elements did it capture?
- LLM-as-judge: in subjective tasks (the quality, tone, helpfulness of an answer) you ask another LLM "score this output 1-5 by this criterion." Powerful but must be set up carefully; the judge model has its own biases too.
- Rule-based checks: deterministic checks like "is the output valid JSON, does it contain the required fields, is there a forbidden phrase?"
In most serious systems a single metric doesn't suffice; you combine several. For instance both "is the JSON valid" (rule) and "is the content correct" (LLM-judge) and "are the required fields present" (rule). The better the metric is defined, the more accurate the optimization. A poorly defined metric drives optimization in the wrong direction — the model "hacks" the metric, not real quality.
"The golden rule: whatever your metric rewards, your system produces. Measure the wrong thing and you get a system that perfects the wrong thing.
The optimization loop: how a self-improving system works
Now let's put the pieces together. A "self-improving system" sounds like science fiction, but it's actually a very concrete, repeatable loop. Here it is, step by step:
- Define the task (Signature). Declare what the system takes in and produces. Don't write the prompt yet.
- Build an initial system (Module). Start with a simple module — direct answer or chain-of-thought, say. This is your baseline.
- Prepare the eval set. Gather 30-100 representative examples, with expected outputs where possible. Add past failures especially.
- Define the metric. Write the function that turns success into a number. Combine a few checks.
- Measure the baseline. Get the initial system's score on the eval set. This is your comparison point.
- Run the optimization. The optimizer (or meta-prompting loop) tries different example selections, instruction phrasings, and structures; scores each with the metric; picks the best.
- Validate the best. Measure the optimized system on a separate test set not used in optimization. This is crucial: keep a separate validation set so you don't fall into the "overfitting" trap on the eval set.
- Deploy and monitor. Watch real outputs in production, collect new failures, feed them back into the eval set. The loop starts over.
That last step — feeding real production failures back into the eval set — is what truly makes the system "self-improving." As the system runs, you discover new corner cases, add them to the eval set, re-run optimization, and the system gets a bit sturdier every round. That's exactly what's meant by AI systems internalizing real-time feedback and reducing manual iteration.
One point to watch: even though this loop is automated, it requires human oversight. A human defines the metric, a human ensures the eval set's quality, a human makes the go-live decision. Automation isn't replacing the human; it's shifting the human's focus from "polishing sentences" to "designing systems and criteria."
When to automate and when to stay manual
Now let me get to a very important balance, because automation isn't a cure-all. The question I meet most in consulting is: "should we set up DSPy too?" My answer is always the same: it depends.
Automated optimization is worth it when:
- The task is repeated and persistent — the same job will run thousands of times, live for months.
- Quality is critical — the cost of error is high (legal, financial, customer-facing).
- You have representative data or can collect it.
- You can measure success — a clear metric can be defined.
- The system consists of multiple steps and hand-balancing gets hard.
- You want robustness to model changes — the ability to recompile when you switch provider or version.
Hand-prompting still makes sense when:
- The job is one-off or exploratory — you'll summarize a report once.
- No examples/data exist and collecting them costs more than the job itself.
- The metric can't be defined — success is entirely subjective and contextual.
- The task is very simple — a one-sentence instruction already works fine.
- You're at the prototype stage — you're still discovering what the problem is.
Let me add a cost warning in the Turkey context. Optimization loops consume model calls. The optimizer tries dozens or even hundreds of candidate configurations on the eval set; each trial means money. With a small eval set and a modest search budget this cost stays reasonable, but if you run uncontrolled with the zeal to "optimize everything," the bill can surprise you. My advice: first automate a single, most critical, most-run prompt, measure the gain, then expand. With Turkey's budget realities, "automate where it's worth it" is the healthiest approach.
A simple decision rule: estimate how many times you'll revise a prompt by hand over its lifetime. If that number is high and each revision risks regression, automation already pays for itself.
Security: automated pipelines aren't immune to prompt injection
The topic most skipped in the enthusiasm for automation is security. Let me be blunt: the fact that a machine optimizes your prompt does not protect the system against prompt injection. On the contrary, automated pipelines can open new surfaces.
The basic risk is this: if your system processes untrusted input (user text, web-scraped content, email, documents), instructions hidden inside that input can try to hijack your system instructions. There are a thousand variants of the "forget all previous instructions and do this" attack. Optimization doesn't solve this risk; in fact the optimizer might inadvertently drift toward a configuration that weakens security, because if your metric doesn't measure "security," the optimizer won't care about it.
Concrete defense principles:
- Isolate untrusted input from instructions. System instructions and user/external content must be clearly separated. Mark content as "data," not "instructions."
- Include security in the metric. Put injection attempts in your eval set and have your metric ask "did the system resist this attack?" The optimizer protects whatever you measure.
- Validate the output. Don't use the model's output blindly; add rule-based checks, allow-lists, field validations.
- Least-privilege principle. Keep the tools and data the model can access to a minimum. Even if an injection succeeds, keep the damage bounded.
- Human approval for critical actions. Put a human approval in front of the automated pipeline for irreversible or high-risk operations.
In short: automated optimization doesn't replace security engineering, it's designed alongside it. If you don't make security a part of your metric, the optimizer ignores it for you.
A starter evaluation set for Turkish
Now let me get to a very practical topic, because the reality everyone working in Turkey faces is this: English eval sets don't guarantee Turkish performance. The model may be brilliant in English but stumble on Turkish morphology, suffixes, idioms, formal/informal tone shifts, and context-dependent meanings. So for a serious Turkish system, building a Turkish eval set is a must.
Here's a practical starter recipe:
- Start with real Turkish data. Collect real examples from your own domain — customer emails, support tickets, documents. Synthetic/translated texts don't reflect Turkish's real nature.
- Sample Turkish-specific difficulties especially. Suffixed/inflected forms, upper-lower case traps (İ/ı, İ/i), idioms, sarcastic/implicit expressions, regional usage, mixed Turkish-English ("plaza jargon") texts.
- Have a Turkish speaker label the expected outputs. Labeling quality is the eval set's quality. A native Turkish speaker makes the right call on borderline examples.
- Add a tone and formality layer. In Turkish the "siz/sen," formal/informal distinction is critical. Does your system hit the right tone? Measure that too.
- Tune the metric for Turkish. Exact string match can be misleading in Turkish (the same meaning is expressed with different suffixes). Semantic overlap or a Turkish-aware LLM-judge is fairer.
- Start small, grow. Begin with 30-50 well-chosen Turkish examples. Once the system goes live, collect real Turkish failures and add them to the set.
A caveat: if you'll use LLM-as-judge, keep in mind the judge model may be less consistent evaluating Turkish than English. Occasionally audit the judge's decisions by hand and calibrate. For Turkish, the "verify the judge too" step is more critical than in English.
Common mistakes
The mistakes I see over and over in the field that will cost you time and money:
- Optimization without a metric. The biggest mistake. You say you're building a "self-improving system," but you're not measuring the improvement. This is sailing without a compass.
- Overfitting to the eval set. The system is great on the eval set, terrible in reality. The reason: you both optimized and tested on the same set. Always keep a separate validation set.
- Too small or unrepresentative eval set. A system optimized on five examples collapses on the sixth real input. Few but representative examples beat many but monotonous ones.
- Defining the metric wrong. The model "hacks" the metric — technically scores high but doesn't produce real quality. Make sure your metric truly measures what you care about.
- Not accounting for cost. Uncontrolled optimization loops produce surprising bills. Cap the search budget, start with a critical prompt.
- Leaving security out of the metric. The optimizer protects whatever you measure. If you don't put injection in the eval set, your optimized system stays open to attack.
- Papering over Turkish with an English eval. A system that works well in English stumbles in Turkish. Measure separately for Turkish.
- Cutting the human out entirely. Automation leaves metric and eval design to the human. Those who fire the human in the name of "fully automatic" optimize a blind system.
- Optimize once and forget. Models change, inputs drift. Optimization isn't an event but a process; periodic recompilation is needed.
How to start: your first week's plan
Let me drop the theory and give a concrete starting plan. To move from the hand-prompting world to automated optimization, let your first steps be these:
- Pick a single prompt. Find the most-run, most-critical prompt that's giving you the most grief right now. Don't try to transform everything at once; pick a pilot.
- Collect a 20-30 example eval set. From real inputs, from past failures where possible. Label the expected outputs by hand. If it's a Turkish system, with Turkish examples.
- Write a simple metric. Start with the plainest criterion suited to your task — exact match, field check, or an LLM-judge criterion. It doesn't have to be perfect, just measurable.
- Measure the baseline. Get your current prompt's score on this eval set. Now you have a comparison point.
- Try meta-prompting first. Before setting up DSPy, run the "here's the prompt, here are the failed examples, fix it" loop by hand with the model you have. See whether the score rises. This teaches the concept for free.
- Move to DSPy if you see a gain. If meta-prompting works by hand, carry the process into DSPy's Signature-Module-Optimizer structure and automate it. Now you can recompile on every model change.
- Validate on a separate test set. Test the optimized system on examples it didn't see in optimization. Don't fall into the overfitting trap.
- Add security. Put a few injection attempts in your eval set and make sure your metric catches them.
- Go live, feed failures back. Collect real failures and add them to the eval set, recompile periodically. The loop is now turning.
These nine steps turn you from a team that "polishes prompts by feeling" into one that "optimizes by measurement." And the best part, you can start small — a single prompt, thirty examples, a simple metric. It grows from there. We're not throwing away the skill of hand-writing prompts; we're placing it inside a discipline of measure-and-optimize. As far as I can see in the field, teams that make this transition early solve in days, and far more robustly, the work that late movers polish by hand for months.
Consulting Pathways
Consulting pages closest to this article
For the most logical next step after this article, you can review the most relevant solution, role, and industry landing pages here.
Enterprise RAG Systems Development
Production-grade RAG systems that provide grounded, secure and auditable access to internal knowledge.
AI Agents and Workflow Automation
Move beyond single-step chatbots to AI workflows orchestrated with tools, rules and human approval.
Enterprise AI Architecture Consulting for CTOs
Technical leadership consulting to move AI initiatives from isolated PoCs into secure, scalable and production-ready architecture.