Need help crafting prompts for DeepSeekAI to generate clean Python/JS code snippets

Hey Prompt Wizards! :waving_hand:

I’ve been diving into DeepSeekAI lately to generate Python and JS snippets, and it’s been surprisingly handy. Still, I find myself tweaking the prompts a lot—too vague, and I get an abstract wall of text; too specific, and it stalls like my code when I forget a semicolon.

Anyone here got tips or prompt templates that consistently yield clean, ready-to-use code? Particularly for tasks like:

  • Generating concise utility functions

  • Cleaning up someone else’s spaghetti logic

  • Creating basic async/await or promise examples that don’t implode under peer review

I’m looking for that “Goldilocks” prompt—not too hot, not too cold, just right.

Would love to know how you shape your prompts so DeepSeekAI doesn’t help you miss errors in production. :sweat_smile:

1 Like

Sorry about the formatting and shortness - I’m answering on my phone.

The best way would be to have ai generate a personalized prompt, I find this easy and gets good results.

If you would like you could use something along these lines too:

You are a professional [language] developer. 
Write a [concise/optimized/readable] [function/module/class] that does the following:

[👉 Describe the task — clearly and specifically, but avoid micromanaging logic.]

Requirements:
1. [Constraint #1 — e.g., must use async/await]
2. [Constraint #2 — e.g., handle null inputs]
3. [Constraint #3 — optional formatting/output style]

Only return the complete code. Do not include explanation or comments unless necessary.

Let me know if you have any more questions, or if I may have forgotten something!

2 Likes