Best way to structure reusable GPT prompt templates? #1
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
I ran into the exact same problem building a prompt tool. Here is what worked for me: store each template as a single JSON file with typed blocks instead of one big string. The idea is that a prompt is not just text. It is a composition of distinct semantic pieces: a role, an objective, constraints, examples, output format, etc. When you store them as separate typed blocks, you get:
{
"id": "email-rewrite",
"category": "writing",
"blocks": [
{ "type": "role", "content": "You are a professional email editor." },
{ "type": "objective", "content": "Rewrite the following email to be more concise and professional." },
{ "type": "input", "content": "{{raw_email}}" },
{ "type": "constraints", "content": "Keep the same tone. Do not add information." },
{ "type": "output_format", "content": "Return only the rewritten email, no commentary." }
]
}Then your app loads all JSON files from a templates directory and hydrates them at runtime (add IDs, positions if you have a visual editor, etc.). Adding a new template is just dropping a new I'm the author of flompt, an open-source visual prompt builder that uses this exact architecture. Templates live in Might give you some ideas for your Recipe Studio. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I’m building ChatGPT Recipe Studio, a desktop app for creating and managing reusable GPT “recipes” (preset prompt patterns for rephrasing, summarizing, replies, and emails).
The app is built with Python + PyQt6 and focuses on saving, reusing, and organizing effective prompts.
What’s a clean way to structure these prompt templates so they’re easy to extend and maintain as the project grows?
Beta Was this translation helpful? Give feedback.
All reactions