/hoangsa:memory-refactoringfrom hoangsa
Guides safe code refactoring using a memory graph to expose all callers, references, and subtypes before editing. Use for rename, extract, move, split, or restructure operations.
Ships in hoangsa. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Refactors fail when a caller you didn't know about gets out of sync. The graph exposes every caller, reference, and subtype before you touch the code — so the edit plan is grounded, not guessed.
1. memory_recall({query: "<target concept>"}) → find exact FQN
2. memory_impact({fqn, direction: "up", depth: 3}) → every dependent
3. memory_symbol_context({fqn}) → siblings + extends
4. Draft the edit plan, naming every touched file
5. Apply edits in order: callees first, then callers
6. Re-index if needed: memory_index
7. Verify: repeat memory_impact, confirm 0 stale refs
8. Persist anything durable the refactor taught you
Use memory_recall to disambiguate the target. Refactors on wrong
symbols are the most expensive mistake — double-check the FQN matches
what the user meant.
memory_impact { fqn: "auth::verify_token", direction: "up", depth: 3 }
Count the depth-1 ring. That's the minimum number of sites you must edit (rename) or that will break (signature change). Depths 2–3 break only if the signature change propagates through wrappers.
If direction: "up" returns 0 dependents, the symbol may be dead
code — flag that to the user before refactoring ("nothing references
this; did you mean to delete it?").
memory_symbol_context { fqn: "auth::verify_token", limit: 32 }
Look for:
siblings — sharing the file. A module-level rename may pull
them along; make sure you don't accidentally split what belongs
together.extends / extended_by — if you're changing a trait or base
class, every subtype needs the matching edit.references — non-call uses (type annotations, generic bounds,
macro args). These are easy to miss with grep; the graph has them.Before editing, list every file you'll touch. Use the output of steps 2+3 as the checklist. Share the plan with the user if the radius is
5 files or crosses crate boundaries — refactor scope is the #1 thing users want to veto early.
mod / use / import statements along with
the actual move.Apply one file at a time — don't rely on one big diff to land atomically.
After the edits, the graph reflects the old code. Run:
memory_index { path: "." }
(Or hoangsa-memory index . via CLI. If hoangsa-memory watch is running, it already
re-indexed on save — skip this step.)
Re-run memory_impact on the old FQN. It should error with
symbol not found — that's the success signal (the old name is
gone). Then run memory_impact on the new FQN and confirm the
dependent count matches what you expected from step 2.
Run the test suite. If it passes, the refactor held.
If the refactor surfaced a recurring pattern (e.g. "this repo never changes a public trait without adding a blanket impl"), persist it:
memory_remember_lesson {
trigger: "renaming a method on a public trait in this repo",
advice: "Add a default impl calling the new name that delegates to
the old name for one release; remove after N+1."
}
memory_impact first, even for "tiny" renames.memory_impact will omit new callers and include
deleted ones.If memory_impact depth: 1 returns > 30 dependents, stop and reconsider.
pub fn old() -> New { new(…) } that can
be deprecated in a follow-up.Flag these to the user before starting — they often change their mind when they see the radius.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
refactoring, memory-graph, safe-refactoring, code-restructuring, rename, extract, move
11 skills in this plugin
/fe-testingThis skill should be used when the user is building, changing, or trying to verify a frontend feature on web (React/Vite) or React Native/Expo, and is unsure how to prove it actually works. Triggers on phrases like 'how do I test this component/screen', 'verify this feature', 'make sure this works on web/mobile', 'is this covered by tests', 'my tests pass but the feature is broken', 'no tests yet', or before shipping any FE change. Guides the full loop: define verifiable success criteria before coding, write tests at the correct layer (logic/component/E2E/visual), and confirm behavior by running the real app./git-flowThis skill should be used when the user wants to start a new task, switch between tasks, park or resume work, finish a task (push + PR), clean up merged branches, or sync with upstream. Triggers on phrases like 'start task', 'new task', 'work on', 'switch to', 'park this', 'resume', 'continue where I left off', 'done with this', 'finish task', 'create PR', 'clean branches', 'delete merged', 'rebase', 'pull latest', or 'sync with main'./memory-cliUse when the user needs to run hoangsa-memory CLI commands — init / index / query / watch / memory / archive / impact / context / changes / graph / projects. Examples: "index this repo", "show memory", "trace the graph", "find taint paths", "consolidate memory".
npx claudepluginhub unknown-studio-dev/hoangsa --plugin hoangsaOther plugins' skills for the same job