agentleFS
r3bl-orgr3bl-org/r3bl-open-core/.agents/skills/safe-renaming/SKILL.md

safe-renaming

Skill486 starsChanged 15 days agoApache-2.0View on GitHub

Safely execute rename requests and mass refactoring using file-by-file native edits, semantic AST tools, and optional BTRFS staging verification.

  • Deletes or force-pushes

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Search and inspect target occurrences using AST references or grep.

    line 29
  2. Very specific:

    After modifying a batch of 3-5 files, run fast type/lint validation directly and delegate long-running test/doc checks to a background …

    line 34
  3. Very specific:

    Run full workspace verification on the live repository (via a Model: "inherit" background subagent) to confirm 100% clean compilation, zero …

    line 43
  4. Distinctive:

    Substrings in Trait/Method names: Ensure identifiers are properly bounded and not partially matching unrelated symbols.

    line 49
  5. Distinctive:

    Doc Comment Integrity: Ensure plain English prose in doc comments is not inadvertently changed when updating code symbols.

    line 51
  6. Very specific:

    No Scripts: Never reach for sed/awk/python/rust scripts to automate text replacements.

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

When to Use This Skill

Activate this skill whenever the user asks for rename requests (e.g., "Rename X to Y across the codebase", "tree-wide rename", "safely rename ..."), or any renaming of variables, fields, functions, parameters, or types across files in the codebase.

Mandate: No Scripts of Any Kind

Scripts of ANY kind (shell scripts like perl, sed, awk, python, bash, fish, or custom/disposable Rust scripts compiled via rustc) are STRICTLY PROHIBITED for performing code refactoring or modifications. All changes must be performed file-by-file using native file-editing tools (replace_file_content / multi_replace_file_content) combined with AST-level semantic tools (rust-analyzer).

Workflow: Safe Staged Refactoring Protocol

To ensure safety during multi-file refactoring, follow this protocol:

Step 1: Optional BTRFS Staging Copy

For large changes, use cp --reflink=auto to create a lightweight, near-instant BTRFS CoW snapshot copy of the workspace in ~/Downloads/rename-staging/.

# Ensure any previous staging directory is clean
rm -rf ~/Downloads/rename-staging

# Create BTRFS reflink clone
cp --reflink=auto -r ~/github/roc ~/Downloads/rename-staging

Step 2: Systematic File-by-File Native Edits

Perform the refactoring file-by-file using native file editing tools (replace_file_content / multi_replace_file_content) and semantic AST tools:

  1. Search and inspect target occurrences using AST references or grep.
  2. Carefully apply edits line-by-line or chunk-by-chunk to preserve surrounding rustdoc, formatting, and comments.
  3. Beware of local variable shadowing (e.g. let vp_width = ... shadowing vp_width(...)).

Step 3: Incremental Validation

After modifying a batch of 3-5 files, run fast type/lint validation directly and delegate long-running test/doc checks to a background subagent (invoke_subagent with TypeName: "self", Model: "inherit"):

./check.fish --check
./check.fish --clippy
./check.fish --test
./check.fish --quick-doc

Step 4: Final Verification

Run full workspace verification on the live repository (via a Model: "inherit" background subagent) to confirm 100% clean compilation, zero lint warnings, and all tests passing:

./check.fish --full

Pitfalls & Safeguards

  • Substrings in Trait/Method names: Ensure identifiers are properly bounded and not partially matching unrelated symbols.
  • Module Shadowing: Watch out for local variable names (let vp_width = ...) that shadow constructor helper functions (vp_width(...)).
  • Doc Comment Integrity: Ensure plain English prose in doc comments is not inadvertently changed when updating code symbols.
  • No Scripts: Never reach for sed/awk/python/rust scripts to automate text replacements.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.