safe-refactor-code

Installation
SKILL.md

Safe Refactor Code

Refactor code in small verified slices, then update the repo's continuity files so future agents can resume without rereading the whole session.

Core Rules

  • Treat AGENTS.md at repo root as the main long-term repo memory. Preserve existing content and update it carefully instead of rewriting blindly.
  • Keep agent-local MEMORY.md short. It is a working summary for the repo, not a replacement for any shared or tool-managed memory system.
  • Keep safe-refactor-code.md focused on the repo's refactor rules, guardrails, and recurring cleanup workflow.
  • Update CHANGELOG.md on real code changes using today's section: ## [YYYY-MM-DD].
  • Prefer additive or scoped edits to docs. Do not wipe user-written history unless the user explicitly asks.
  • After refactors, scan for obvious dead code, unused imports, stale helpers, and outdated doc references before finishing.
  • Use code-review graph tools when available. Fall back to direct source search and verification when graph tools are unavailable or empty.

Graph-Aware Refactor Rules

  • Start graph-assisted refactors with get_minimal_context_tool(task="<refactor goal>").
  • Update stale graphs with build_or_update_graph_tool() before broad refactors.
  • For symbol renames, use refactor_tool(mode="rename", old_name=<old>, new_name=<new>) and inspect the preview before applying.
Related skills

More from afu-it/safe-code

Installs
7
GitHub Stars
2
First Seen
Apr 23, 2026