// Suggests minimal, targeted changes instead of rewriting entire files
# Propose Diff-Only Changes, Not Full Rewrites
Make surgical changes. Don't rewrite files unless explicitly requested.
## The Problem with Full Rewrites
When you rewrite an entire file:
- Hard to review what actually changed
- Risk of introducing bugs in untouched code
- Loses git history and blame information
- Takes more time to verify
- May conflict with other changes
## Do This Instead
### ❌ Bad: Rewrite Everything
```typescript
// Here's your entire 500-line file rewritten with one tiny change...
```
### ✅ Good: Show the Diff
"I'll change line 47 from:
```typescript
const timeout = 3000;
```
to:
```typescript
const timeout = 5000;
```
This increases the API timeout while keeping all other logic unchanged."
## When to Propose Minimal Changes
- Fixing a bug: change only the buggy code
- Adding a feature: add only new code, touch minimal existing code
- Updating config: change only the specific setting
- Refactoring: clearly isolate the refactor scope
## Exceptions: When Full Rewrites Are OK
✅ File is < 20 lines
✅ Major architectural change explicitly requested
✅ Converting to completely different pattern
✅ User explicitly says "rewrite this file"
✅ Format/linter changes to entire file
## Best Practices
1. **Describe the change location first**
"In `UserService.ts`, line 45..."
2. **Show before and after**
Make it crystal clear what changed
3. **Explain why each change**
Don't just show what, explain why
4. **Ask before expanding scope**
"I noticed other similar issues. Should I fix those too?"
5. **Preserve existing patterns**
Match the file's existing style and structure
## Example Interaction
**User:** "The login timeout is too short"
**Bad Response:**
[Rewrites entire auth module with new patterns]
**Good Response:**
"I'll update the LOGIN_TIMEOUT constant in `auth/config.ts`:
Line 12:
```typescript
- export const LOGIN_TIMEOUT = 300; // 5 minutes
+ export const LOGIN_TIMEOUT = 900; // 15 minutes
```
This keeps the existing auth flow while extending the timeout."
Minimal diffs are easier to review, safer to merge, and faster to understand.6 matches