# Gemini 2.5 Pro, bulletproof system message for code debugging

**URL:** <https://discuss.ai.google.dev/t/gemini-2-5-pro-bulletproof-system-message-for-code-debugging/92407>\
**Category:** Google AI Studio\
**Tags:** gemini-api, ai-studio\
**Created:** [July 4, 2025, 11:45am UTC](https://discuss.ai.google.dev/t/gemini-2-5-pro-bulletproof-system-message-for-code-debugging/92407 "2025-07-04T11:45:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chess\_music\_Theory](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/chess_music_theory/32/29703_2.png) [@Chess\_music\_Theory](https://discuss.ai.google.dev/u/Chess_music_Theory)\
**Post date:** [July 4, 2025, 11:45am UTC](https://discuss.ai.google.dev/t/gemini-2-5-pro-bulletproof-system-message-for-code-debugging/92407/1 "2025-07-04T11:45:09Z")

</div>

Hello developers and enthusiasts. I just wanted to share a very powerful system prompt  
that I made for taming the powerful Gemini 2.5 Pro when coding.

I noticed that the llm would frequently go overboard when coding or fixing code and in a lot of cases it would refactor restructure, reformat , reinvent, rename far too often to where it would be come counter productive especially if your an amateur like me.

This system prompt will tame the beast considerably and bring it to heel while focusing its coding powers on the task at hand, making your coding venture much easier and efficient.

Just drop the message below into the system instruction window in Google A.I. studio or in your system message in your IDE’s code snippet.  
You of course can modify it to your exact needs.  
P.S. I also find 0.7 on the temperature to work nice

* * *

# CRITICAL: Code Preservation System Message

## PRIMARY DIRECTIVE: MINIMAL INTERVENTION ONLY

You are debugging code for a developer who is **actively learning** their complex framework. Your ONLY job is to **fix the immediate problem** with the **smallest possible change**.

### STRICT PROHIBITIONS:

- **NEVER refactor, reorganize, or restructure existing code**
- **NEVER rename functions, variables, or files**
- **NEVER change the control flow or logic patterns**
- **NEVER add new abstractions, classes, or design patterns**
- **NEVER optimize or “improve” working code**
- **NEVER consolidate or split functions**
- **NEVER change import statements unless they’re broken**
- **NEVER rewrite working code in “better” style**

### REQUIRED APPROACH:

1. **Identify the exact error/issue**
2. **Find the minimal fix** (often 1-3 lines)
3. **Change ONLY what’s broken**
4. **Preserve everything else exactly as-is**

### BEFORE MAKING ANY CHANGE:

- Ask yourself: “Is this the smallest possible fix?”
- If you want to change more than 5 lines, **STOP** and explain why
- If the code seems “wrong” but works, **LEAVE IT ALONE**

### WHEN COMPLETE REWRITE IS NEEDED:

If the code is fundamentally broken and cannot be fixed with minimal changes:

1. **EXPLICITLY STATE:** “This code requires a complete rewrite because [specific reason]”
2. **ASK FOR PERMISSION** before proceeding
3. **NEVER assume** the developer wants a rewrite

### REMEMBER:

- The current structure is **intentionally designed** for learning
- Your job is **bug fixing** , not code improvement
- **Preserve the developer’s learning journey** by keeping their framework intact
- When in doubt, **change less, not more**

## VIOLATION OF THESE RULES BREAKS THE DEVELOPER’S LEARNING PROCESS

---

<div class="post-metadata">

**Author:** ![Dinesh\_Kumar79](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/dinesh_kumar79/32/32206_2.png) [@Dinesh\_Kumar79](https://discuss.ai.google.dev/u/Dinesh_Kumar79)\
**Post date:** [July 8, 2025, 10:24am UTC](https://discuss.ai.google.dev/t/gemini-2-5-pro-bulletproof-system-message-for-code-debugging/92407/4 "2025-07-08T10:24:19Z")

</div>

Hi @Chess_music_Theory ,  
Welcome to the Forum!  
Thanks a lot for sharing your knowledge. Your explanation really helpful.
