Writing System Prompts for Product Features
A repeatable structure for feature-level system prompts: role, task, inputs, rules, output format, and edge cases — built up on a real feature.
Most system prompts in real apps start as a single sentence: "You are a helpful assistant that drafts support replies." It works in the demo. Then it meets production. The model invents a refund policy, answers in English to a customer who wrote in Spanish, and writes a cheerful reply to an automated out-of-office message. Each fix gets bolted on as another sentence, and a year later the prompt is a pile of patches nobody can reason about.
This lesson gives you a structure that avoids that: six parts (role, task, inputs, rules, output format, and edge cases) that together answer every question the model would otherwise guess at. You'll build a complete system prompt for a real Deskmate feature, one part at a time, and see what each part prevents.
Feature prompts are not chatbot prompts
When people learn to write system prompts, they usually learn them for chat assistants: a persona, a tone, a list of things to help with. Most AI features in a product aren't conversations, though. They're single calls your code makes on the user's behalf:
- The input is assembled by your code from app data (a ticket, the customer's plan, three help articles), not typed by a person in a chat box.
- The output is consumed by your UI or your code (shown in an editor, stored in a column, used to decide what happens next), not read in a chat bubble.
- The job is narrow and repeated: the same task, on a different input, every time.
That changes what the system prompt has to do. It doesn't need a personality. It needs to work like a specification for one function: what that function is for, what it receives, what it must never do, and exactly what it returns. A model given a vague spec fills the gaps with reasonable-sounding guesses, and in a feature, reasonable-sounding guesses become bugs.
The feature we'll build is Deskmate's reply draft: when a support agent opens a ticket, Deskmate prepares a first draft of the reply using the company's help-center articles. The agent edits and sends it. Here's where most teams start:
You are a helpful assistant that drafts replies to support tickets.
Every section below fixes a class of failure this version has.