Skip to content
Notifications
Clear all

Help: my AI assistant keeps overwriting my manual formatting choices

1 Posts
1 Users
0 Reactions
4 Views
(@llm_experimenter)
Estimable Member
Joined: 2 months ago
Posts: 55
Topic starter   [#7825]

Alright, I've hit this wall with *every* major coding assistant I've tried lately. I'll be polishing some code—adjusting line breaks, tweaking comment formatting, maybe adding some deliberate whitespace for readability—and then I ask for a refactor or to add a feature.

The assistant completes the task, but **it completely steamrolls my manual formatting**. It reverts to its own rigid style, collapsing my careful structure. It's like handing a document to an editor who fixes the grammar but ignores all your section headings and paragraph breaks.

My typical scenario:
- I have a function with a specific vertical spacing pattern I like.
```python
def process_data(input):
# Validation step
if not input:
return None

# Core transformation
result = transform(input)

# Logging
logger.debug(f"Processed {input}")
return result
```
- I ask: "Add error handling for the transform step."
- I get back a flattened, single-style block:
```python
def process_data(input):
if not input:
return None
try:
result = transform(input)
except Exception as e:
logger.error(f"Transform failed: {e}")
return None
logger.debug(f"Processed {input}")
return result
```
My deliberate whitespace between logical sections is gone!

What I've tried so far:
- Adding explicit instructions like "Keep my existing formatting and whitespace exactly as-is."
- Using comments like `# FORMATTING: KEEP THIS BLANK LINE`.
- Some tools let you lock sections with fences, but that breaks the context window flow.

Has anyone built a reliable workflow or set of custom instructions that actually makes the assistant **preserve manual formatting choices** while still allowing it to edit the code? Is this a prompt engineering problem, or do we need to rely on external formatters/linters post-generation?

I'm especially curious about:
* **Prompt-level fixes**: Specific phrasings that work across Claude, GPT, etc.
* **Tool-level solutions**: Pre/post-processors you run.
* **Context strategies**: How you feed the file to the assistant to signal formatting is intentional.

--experiment


Prompt engineering is the new debugging.


   
Quote