What are the best s...
 
Notifications
Clear all

What are the best system prompts for DeepSeek Coder V2?

7 Posts
8 Users
0 Reactions
489 Views
0
Topic starter

Hey everyone! I've been experimenting with DeepSeek Coder V2 lately for a React and Python project, and while the model is super fast, I'm struggling to get it to follow my coding style perfectly. I usually want it to focus on type safety and avoid deprecated libraries, but it keeps suggesting older stuff.

I've tried a few basic instructions like 'act as a senior dev,' but I feel like I'm missing some secret sauce for this specific model architecture. I'm especially looking for prompts that help with:

  • Writing clean, modular TypeScript code
  • Handling complex logic without hallucinating imports

Does anyone have a go-to system prompt that really makes this model shine?


7 Answers
12

Hey! I totally get the frustration. I've been using the DeepSeek Coder V2 Lite MoE for a bit now and it can definitely get ahead of itself if you dont set some hard boundaries. Since I'm all about reliability and keeping things stable, I usually stick to one of two prompt setups. Option 1: The Strict Documentation approach.
This one focuses on telling the model to only use LTS versions and verify every import against current docs before writing a single line.

  • Pros: Super safe, rarely suggests weird outdated hacks.
  • Cons: It can be a bit overly cautious and might miss some cool new syntax. Option 2: The Modular Type-Safety prompt.

Here, I force the model to avoid 'any' at all costs and split everything into small, testable modules from the start.

  • Pros: The code is incredibly clean and easy to test.
  • Cons: It takes a bit more effort to stitch everything back together manually. Honestly, I recommend the first one for most projects. It stops the model from hallucinating imports that dont exist anymore. I run mine on a rig with a Crucial T705 2TB NVMe SSD and an NVIDIA GeForce RTX 4080 Super 16GB and it handles these long system prompts like a champ. Just remember to be specific about which React version you are on, otherwise it might try to give you class components from 2018 or something lol.


12

Honestly, the biggest issue with these MoE models is that they tend to drift toward the most common (often outdated) patterns found in their training data. To fix the hallucination and legacy code issues, I found that version locking your system prompt is the way to go. Instead of generic titles, tell it exactly which versions of Python or React you are using. For my workflow, I use a prompt like: Expert Dev. Enforce strict TS types. Use Vite and React 18 patterns only. No class components. Python 3.10+ syntax with Pydantic v2. If you are running the 236B version locally, make sure your hardware is up to it or you will get truncated logic. I am running mine on an ASUS ROG Strix GeForce RTX 4090 24GB and the speed is great for real-time coding. Another cheap tip: Tell the model to think step-by-step before outputting code to reduce those weird import hallucinations. It forces the model to verify the module exists in its internal map first.


3

I usually just include a line about minimizing tokens to save money and it actually stops the model from rambling into weird hallucinations. Honestly though, the money I saved on my last project let me finally fix up my old mountain bike. I spent all morning trying to bleed the brakes and got hydraulic fluid all over the garage floor... anyway sorry kinda went off topic there lol


3

I'm still learning the ropes but I've noticed DeepSeek behaves a bit differently than GPT-4o or Claude. You really have to watch it closely because it can get a bit too confident with older syntax even when you ask it to be modern. I usually try to check everything against the latest official docs just in case it's hallucinating an old method from 2021. Maybe try these to stay safe:

  • force it to use modern fetch instead of older libraries
  • tell it to assume React 18 patterns only
  • make sure to specify functional components specifically I actually got into this whole coding thing because I wanted to automate my backyard lights for the summer. I spent all weekend trying to get the motion sensor to talk to the bridge and ended up accidentally setting off the sprinklers while my neighbor was walking his cat. It was a total mess and I had to buy him a new towel since they both got soaked... anyway sorry kinda went off topic there lol


2

> it keeps suggesting older stuff Late to the party, but unfortunately, my experience with DeepSeek Coder V2 has been the same. It leans way too hard on outdated training data. I spent all of yesterday debugging a component where it insisted on using legacy lifecycle methods instead of hooks. It was honestly a headache. Here is what I found works better than generic instructions:

  • Define the environment stack version explicitly in every prompt session.
  • Mandate no legacy library usage by listing specific packages you allow.
  • Demand a reasoning step before the code block. It forces the model to acknowledge your constraints first. Avoid just telling it to be a senior dev. It basically does nothing. You have to treat it like a junior who needs a very strict style guide, otherwise it defaults to the messiest code in its database. I had issues with it hallucinating deprecated imports constantly until I started pasting my package.json dependencies directly into the system prompt. It is annoying to do every time, but it keeps the output way cleaner.


1

100% agree


1

^ This. Also, reading through everyone's input, it seems we all struggle with the same training data bias where the model favors legacy syntax over current best practices. People here suggested version locking, strict stack definitions, and even token minimization to keep the output focused. I would suggest being very careful about how you frame your requirements, as the model often prioritizes frequency over accuracy.

  • Explicitly forbid specific older patterns like React class components or older library wrappers in your system prompt.
  • Use a step-by-step reasoning chain to force it to verify imports against your provided stack versions before generating the main logic. For those running local instances, make sure you have enough overhead on your hardware. If you are struggling with speed or memory while handling these long context prompts, you might want to consider upgrading your storage to something faster like a Crucial T705 2TB NVMe SSD to keep your dev environment snappy while the model processes these complex instructions. Always double-check its output, though.


Share: