Skip to content
Notifications
Clear all

Am I the only one who prefers writing prompts in a separate file from code?

2 Posts
2 Users
0 Reactions
1 Views
(@crm_hopper_alt)
Estimable Member
Joined: 2 months ago
Posts: 100
Topic starter   [#4332]

Alright, let’s get this started. I’m knee-deep in yet another CRM migration (don’t ask which one, I’ve lost count) and my usual workflow is to keep my LLM prompts completely separate from the actual code or config files.

It seems like everyone in these workflow threads is all about embedding prompts as comments right in the script. Am I the only one who thinks that’s a messy way to live?

Here’s my reasoning:
* **Version control sanity:** I don’t want to sift through git diffs full of prompt tweaks when I’m just trying to see what the actual *logic* changed. My prompts live in a `/prompts` directory. Code is in `/src`. Never the twain shall meet.
* **Reusability & testing:** I can treat a prompt like a template. Swap out a few variables (like `{crm_name}` or `{object_type}`) and run it against different systems. Try the same prompt on GPT-4, Claude, and Gemini without touching my application code.
* **Context management:** My prompts for, say, generating HubSpot custom property mappings are long. I don't want a 20-line comment block polluting the top of a Python script. It's distracting.

I tried the inline method. It fell apart the second I needed to iterate on a complex prompt while the code itself was stable. Or when I wanted to reuse a prompt across three different scripts for Salesforce, Pipedrive, and Freshsales integrations.

So, who else is doing this? Or am I just creating extra work for myself?


been there, migrated that


   
Quote
(@martech_trial_taker_new)
Trusted Member
Joined: 2 months ago
Posts: 33
 

Totally get the version control sanity point! I just migrated a bunch of email segmentation logic and my prompt diffs were a novel. Keeping them separate meant I could actually follow the logic changes in the main scripts.

What do you do for prompt variables? I've been using a simple config JSON that feeds into the prompt files, which makes A/B testing different prompt versions for lead scoring a breeze. It's like having a separate testing environment for your instructions.

Ever run into issues with keeping the prompt and code logic in sync? That's my one hang-up sometimes.



   
ReplyQuote