rule-code-preservation

Enforce non-destructive code changes with explicit approvals before commits.

1|Updated Apr 17, 2025
One-click install
npx skills add https://github.com/carrot-foundation/schemas --skill rule-code-preservation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rule-code-preservation
Source: https://github.com/carrot-foundation/schemas/tree/main/.agents/skills/rule-code-preservation
Command: npx skills add https://github.com/carrot-foundation/schemas --skill rule-code-preservation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents silent deletions and reversions during code refactoring by enforcing non-destructive changes.

Core Features & Use Cases

  • Ensures non-destructive edits by requiring explicit approval before removing or altering existing code.
  • Provides guardrails for preserving backward compatibility across sessions and branches.
  • Used during refactoring, code reviews, and maintenance tasks to maintain intentional behavior.

Quick Start

Inspect a refactoring task and confirm all intentional code paths are preserved before committing changes.

Frequently Asked Questions about rule-code-preservation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent silent code deletions during refactoring?▼

To prevent silent code deletions during refactoring, enforce non-destructive edits by requiring explicit approvals before altering existing logic. This approach preserves backward compatibility and documents all change decisions directly in commits.

What is the best way to maintain backward compatibility across code branches?▼

The best way to maintain backward compatibility across branches is to apply guardrails that preserve existing logic during maintenance tasks. This ensures intentional behavior remains intact and prevents accidental reversions in your codebase.

How do I ensure non-destructive changes in code reviews?▼

To ensure non-destructive changes in code reviews, inspect refactoring tasks to confirm all intentional code paths are preserved before committing. Explicitly document decisions in commits to maintain transparency and prevent silent reversions.

When do I need to enforce non-destructive code changes?▼

You need to enforce non-destructive code changes during refactors, maintenance tasks, and code reviews where backward compatibility matters. This prevents silent deletions and ensures existing behavior is explicitly preserved across sessions.

Does this approach require explicit approval before removing code?▼

Yes, this approach requires explicit approval before removing or altering existing code. By enforcing non-destructive edits, it ensures that intentional code paths and backward compatibility are preserved during refactoring.

Why does refactoring sometimes cause silent reversions in a codebase?▼

Refactoring causes silent reversions when changes are made without enforcing non-destructive edits or documenting decisions. Requiring explicit approvals before altering existing logic prevents these accidental deletions and maintains intentional behavior.