modify_existing_codelisted
Install: claude install-skill feralbureau/luminy
# modify_existing_code
Modifying existing code is more dangerous than writing new code — you're changing something that already works (or is supposed to). The goal is surgical precision: change exactly what needs to change, nothing more.
## The Golden Rule
**Understand before you touch.** The most common cause of regressions is editing code without fully understanding what it does. Read the full function/class/module before making any change, even if the change looks trivial.
## Step-by-Step Process
### 1. Read the Full Context
Before making any edit:
- Read the entire file, not just the function the user pointed at.
- Identify all callers of the function/class you're modifying. Search the codebase (`grep`/`find`) for every usage. Changes to signatures, return types, or behavior affect every caller.
- Read related tests — they document the expected behavior and will tell you if your change breaks a contract.
### 2. Understand the Invariants
Ask yourself: what does this code assume? Common invariants that get silently broken:
- **Order dependencies** — does this function expect its inputs in a particular order?
- **Null/None handling** — does the caller guarantee non-null, or does the function handle it?
- **Thread safety** — is this code called from multiple threads? Does your change introduce a race?
- **Transaction boundaries** — is this inside a DB transaction? Does your change affect atomicity?
- **Idempotency** — should this function be safe to call multiple time