make-refactor-target-compliant
Use BEFORE renaming a symbol/attribute (Python or TypeScript) to make its blast radius verifiable — type the code that might reference it (untyped params/vars that could hold the class, classes with matching attribute names, overrides not marked as such) so the post-rename type-c
Install
npx skills add https://github.com/MotleyAI/living-architecture/tree/main/plugin/trmv/skills/make-refactor-target-compliant
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install motleyai-living-architecture@llmmart
git clone https://github.com/MotleyAI/living-architecture.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole motleyai/living-architecture collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Preflight: run trmv-doctor --plugin <this skill's base directory> once per session before using any trmv-* command; if it fails, stop and show the user its output. If trmv-doctor is not found, or reports the trmv tools older than the plugin, stop and give the user the install command at this plugin's version (in its .claude-plugin/plugin.json): la's install command when the repo has living-architecture.yaml, else uv tool install type-rename-move==<version> in a Python repo, npm install -g type-rename-move@<version> in a TS/JS repo.
Make a refactor's blast radius compliant
A rename is only provable over code the type checker can resolve. This closes
the blind spots first, so the trmv:rename-move gate afterwards is sound.
The idioms for each language are in
<this skill's base directory>/../../languages/<language>.md.
Steps
- Identify the target: the symbol, and for a member rename the attribute NAME and its owning class.
- Enumerate blind spots:
trmv-compliance --select attr-blindspot,string-blindspot --attr NAME <repo>(one--attrper name a rename map renames) →x.NAME,getattr(x, "NAME")and the like wherexis untyped. Each names the receiver to type.- A
trmv-refactordry-run of the rename lists the stand-ins: classes outside the hierarchy that declare NAME. Make a real implementation a subclass or aProtocolimplementation now, or classify it at the rename (--with/--without, seetrmv:rename-move).
- Make them resolvable (do NOT rename yet):
- Type the flagged parameters/variables with the owning class (or its interface/protocol); type the class's own attributes.
- Mark the overrides in the hierarchy.
- Type any test doubles of the class (
trmv-mock-lint).
- Re-check until the blast radius is typed:
- the same
trmv-compliance --select attr-blindspot,string-blindspotcommand reports nothing; trmv-typecheckshows no new errors over the touched files.
- the same
- Then run
trmv:rename-move. Every real reference is now type-visible; what is left is a string the rename lists as aleftoveror the language doc names.
The guarantee still comes from the type checker after the rename; this skill's job is to shrink the checker's untyped surface over the blast radius to zero.
Files (living-architecture)
-
SKILL.md 2.6 KB
--- name: make-refactor-target-compliant description: Use BEFORE renaming a symbol/attribute (Python or TypeScript) to make its blast radius verifiable — type the code that might reference it (untyped params/vars that could hold the class, classes with matching attribute names, overrides not marked as such) so the post-rename type-check gate is sound. --- **Preflight:** run `trmv-doctor --plugin <this skill's base directory>` once per session before using any `trmv-*` command; if it fails, stop and show the user its output. If `trmv-doctor` is not found, or reports the trmv tools older than the plugin, stop and give the user the install command at this plugin's `version` (in its `.claude-plugin/plugin.json`): la's install command when the repo has `living-architecture.yaml`, else `uv tool install type-rename-move==<version>` in a Python repo, `npm install -g type-rename-move@<version>` in a TS/JS repo. # Make a refactor's blast radius compliant A rename is only provable over code the type checker can resolve. This closes the blind spots first, so the `trmv:rename-move` gate afterwards is sound. The idioms for each language are in `<this skill's base directory>/../../languages/<language>.md`. ## Steps 1. **Identify the target:** the symbol, and for a member rename the attribute NAME and its owning class. 2. **Enumerate blind spots:** - `trmv-compliance --select attr-blindspot,string-blindspot --attr NAME <repo>` (one `--attr` per name a rename map renames) → `x.NAME`, `getattr(x, "NAME")` and the like where `x` is untyped. Each names the receiver to type. - A `trmv-refactor` dry-run of the rename lists the stand-ins: classes outside the hierarchy that declare NAME. Make a real implementation a subclass or a `Protocol` implementation now, or classify it at the rename (`--with` / `--without`, see `trmv:rename-move`). 3. **Make them resolvable (do NOT rename yet):** - Type the flagged parameters/variables with the owning class (or its interface/protocol); type the class's own attributes. - Mark the overrides in the hierarchy. - Type any test doubles of the class (`trmv-mock-lint`). 4. **Re-check until the blast radius is typed:** - the same `trmv-compliance --select attr-blindspot,string-blindspot` command reports nothing; - `trmv-typecheck` shows no new errors over the touched files. 5. **Then run `trmv:rename-move`.** Every real reference is now type-visible; what is left is a string the rename lists as a `leftover` or the language doc names. The guarantee still comes from the type checker after the rename; this skill's job is to shrink the checker's untyped surface over the blast radius to zero.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.