Skip to content

Commit f974978

Browse files
committed
docs: add safe file deletion rule for migrations
Add rule requiring backup before deletion during migrations: - Never delete files until new version is validated - Move to backup folder or rename with .bak - Especially critical for files outside current project - Only delete backup after confirming new implementation works This prevents data loss of important configurations and scripts during refactoring or migration work.
1 parent bd41e18 commit f974978

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.ai/rules/code-quality.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ When you encounter a file that has been modified since you last read it:
4343
- This applies even when the modification seems minor or was done by a linter
4444
- The user's changes are intentional and should be respected
4545

46+
## Safe File Deletion During Migrations
47+
48+
When migrating, refactoring, or cleaning up files:
49+
- **NEVER delete files** until you've validated the new version works
50+
- Instead, preserve the original by:
51+
1. Moving to a backup folder (e.g., `.backup/` or `_old/`)
52+
2. Renaming with `.bak` extension
53+
3. Commenting out code instead of deleting
54+
- **ESPECIALLY critical** when working outside the current project (like `~/` files)
55+
- Only delete the backup after confirming the new implementation works
56+
- This prevents data loss of important configurations, scripts, or functions
57+
58+
Example safe migration:
59+
```bash
60+
# BAD: rm ~/.zshrc.d/00_zshconfig.zsh
61+
# GOOD: mv ~/.zshrc.d/00_zshconfig.zsh ~/.zshrc.d/00_zshconfig.zsh.bak
62+
```
63+
4664
## Parallelization
4765

4866
When possible, run Tasks in your Task list in parallel.

0 commit comments

Comments
 (0)