{"slug":"rename-move","title":"rename-move","summary":"Use to rename or move a module/class/function/method/attribute (Python or TypeScript) and update all imports/references, with a deterministic check that nothing was missed. Mutator = trmv-refactor; the guarantee = trmv-typecheck + trmv-mock-lint + the test suite. Only sound on a ","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:43:58.409199Z","repo":{"url":"https://github.com/MotleyAI/living-architecture","stars":16,"forks":2,"license":"MIT","updatedAt":"2026-11-27T11:19:06Z"},"bodyHtml":"<hr>\n<h2>name: rename-move\ndescription: Use to rename or move a module/class/function/method/attribute (Python or TypeScript) and update all imports/references, with a deterministic check that nothing was missed. Mutator = trmv-refactor; the guarantee = trmv-typecheck + trmv-mock-lint + the test suite. Only sound on a compliant target (see docs/rename-and-move.md).</h2>\n<p><strong>Preflight:</strong> run <code>trmv-doctor --plugin &lt;this skill's base directory&gt; --require-config</code> once per session before using any <code>trmv-*</code> command. If it reports the missing-config finding (the one naming <code>/trmv:init</code>), run the fast path of the <code>trmv:init</code> skill, then re-run this preflight; stop and show the user its output on anything it still reports, or on any other failure. If <code>trmv-doctor</code> is not found, or reports the trmv tools older than the plugin, stop and give the user the install command at this plugin's <code>version</code> (in its <code>.claude-plugin/plugin.json</code>): la's install command when the repo has <code>living-architecture.yaml</code>, else <code>uv tool install type-rename-move==&lt;version&gt;</code> in a Python repo, <code>npm install -g type-rename-move@&lt;version&gt;</code> in a TS/JS repo.</p>\n<h1>Rename and move</h1>\n<p>The mutator is best-effort — no tool reliably rewrites every annotated\n<code>obj.attr</code>, <code>super()</code> call, and override. The <strong>type-check gate is the\nguarantee</strong>, and it is only sound on code that meets the compliance conditions\n(<code>docs/rename-and-move.md</code>). If the blast radius is not typed, run <code>trmv:make-refactor-target-compliant</code>\nfirst.</p>\n<p>The file's language decides the mutator and its idioms: read\n<code>&lt;this skill's base directory&gt;/../../languages/&lt;language&gt;.md</code> for each language\nthe refactor touches (<code>trmv-config get languages</code> lists the repo's).</p>\n<h2>Procedure</h2>\n<ol>\n<li><strong>Name the symbols</strong>: each by its file and its path inside it\n(<code>--file F --symbol Class.method</code>; also <code>func.&lt;locals&gt;.inner</code>,\n<code>Class.method(param)</code>, <code>Alias['value']</code> for a <code>Literal</code> member). Related\nrenames go in one rename map: one dry-run, one apply, one gate.</li>\n<li><strong>Check the verifier</strong>: run <code>trmv-typecheck</code>. It runs the project's type\nchecker in the project env (the one the tests use) against its committed\nbaseline, and it must pass before you start. If it prints \"nothing to\ncheck\", STOP and tell the user: with no type check there is no guarantee,\nso offer to set one up (<code>commands.typecheck</code> and\n<code>trmv-typecheck --write-baseline</code>) first.</li>\n<li><strong>Type the receivers</strong> (member renames):\n<code>trmv-compliance --select attr-blindspot,string-blindspot --attr OLD &lt;repo&gt;</code> (one <code>--attr</code> per\nold name) lists each receiver the checker cannot type. Type them\n(<code>trmv:make-refactor-target-compliant</code>) until it reports nothing; <code>trmv-refactor</code>\nrefuses a member rename while any remain.</li>\n<li><strong>Dry-run</strong> (default):\n<code>trmv-refactor --project &lt;repo&gt; rename --file F --symbol Q --new-name N --docs</code>,\nor <code>trmv-refactor --project &lt;repo&gt; rename-map MAP --docs</code>.\nMethod renames rename the hierarchy by default. Re-run until it is the rename you want:\n<ul>\n<li><code>stand-in</code>: a class outside the hierarchy declares <code>OLD</code>. <code>--with PATH:LINE</code> renames it too\n(a duck-typed implementation: a cache, a fake, a <code>cast()</code> target); <code>--without PATH:LINE</code> leaves it\n(an unrelated class). To give it a different new name, add it to the map as its own entry.\nPytest fixtures are left by default.</li>\n<li><code>attr-blindspot</code> or <code>string-blindspot</code> on a receiver that cannot be typed (a third-party <code>Any</code>): <code>--allow-blindspots</code>,\nand tell the user which.</li>\n<li><code>unlinked-keyword</code>: a call keyword <code>OLD=</code> the checker cannot link to the renamed parameter or field (a\ndecorator that erases the signature, a <code>**kwargs</code> helper that copies its dict or passes it on). Read each\nlisted call and the helper it reaches: <code>--unsure include --allow-blindspots</code> renames the keywords,\n<code>--allow-blindspots</code> alone leaves them. Neither changes a key the helper reads by its old name, so fix\nthose by hand. Tell the user which.</li>\n<li>a site that must keep the old name (a back-compat test or shim): <code>--keep PATH:LINE</code>, or\n<code>--keep PATH</code> for a whole file.</li>\n<li>a <code>leftover</code> mention that does name the renamed symbol (an untyped document body, a docstring two\nmap entries reach): <code>--docs-pick PATH:LINE</code> rewrites the mentions listed on that line; add <code>=ENTRY</code>\nwhere two entries rename that word to different names.</li>\n<li>a literal that must keep its old keys (a versioned stored document): <code>--keep-literal KEY</code> leaves\nevery dict or object literal holding that key.</li>\n<li>code still using the back-compat alias of an earlier rename: a <code>retarget</code> entry moves it to\nthe new name and keeps the alias.\nShow the diff.</li>\n</ul>\n</li>\n<li><strong>Apply</strong>: <code>--apply</code> is a GLOBAL flag and goes before the subcommand\n(<code>trmv-refactor --project &lt;repo&gt; --apply rename ...</code>); trailing it errors.\nIt realigns the type-check baseline too; never edit the baseline by hand.</li>\n<li><strong>GATE — done only when ALL pass:</strong>\n<ul>\n<li><code>trmv-typecheck</code> passes: <strong>no new errors</strong> vs the baseline;</li>\n<li><code>trmv-mock-lint &lt;tests&gt;</code> passes; when the base branch already has findings,\n<code>trmv-mock-lint --base &lt;base-branch&gt; &lt;tests&gt;</code> reports only the new ones;</li>\n<li>the full non-integration test suite (<code>trmv-config get commands.test</code>) passes;</li>\n<li>by hand, only these: each <code>leftover</code> and <code>unverified-read</code> line the apply printed, each receiver and keyword\n<code>--allow-blindspots</code> let through, and the string-only references the language doc lists.</li>\n</ul>\n</li>\n<li>Review the diff. The user commits — never commit or <code>git add -A</code>.</li>\n</ol>\n<h2>Commands</h2>\n<p><code>trmv-refactor</code> subcommands: <code>rename</code> / <code>rename-map</code> / <code>generate-map</code> / <code>retarget</code> / <code>move-symbol</code> /\n<code>move-module</code>. Dry-run is default; <code>--apply</code> writes, baseline included;\n<code>--timings</code> (also before the subcommand) prints each phase's wall time on stderr;\n<code>--project</code> defaults to cwd. Locator: <code>--symbol Q</code> (the path inside <code>--file</code>,\nquoted for the shell: <code>'f.&lt;locals&gt;.g'</code>, <code>'C.m(p)'</code>, <code>\"Alias['value']\"</code>; no match\nor several exit 2 listing the candidates), <code>--line [--col]</code> (1-based)\nor <code>--offset N</code> (0-based). A <code>rename</code> given <code>--file</code> a module and no locator, or a Python <code>rename</code> located on\nan import that names a module, renames the module: its file (a Python package's directory) moves beside itself, a\nTypeScript module keeping its extension (<code>--new-name</code> is the new stem), and every import follows, while\n<code>move-module</code> only moves a module into an existing package under its own name. <code>--stub REMOVAL</code> (Python) leaves a\nstub at the old path from the repo's <code>refactor.python.moved_module_stub</code>. <code>rename-map MAP</code> reads a YAML list of\n<code>{file, symbol, new_name}</code>, <code>{file, symbol, retarget}</code> or <code>{module, new_name}</code> entries\n(paths relative to <code>--project</code>), resolves every entry before renaming any (so entries may chain or swap names), and writes all or nothing. <code>retarget --file F --symbol OLD --target NEW</code> rewrites what resolves to\nthe alias <code>OLD</code> to name <code>NEW</code>, its target declared or imported in the same class or\nmodule, imports <code>NEW</code> where a file lacks it, and leaves <code>OLD</code> and its re-exports in\nplace. <code>rename</code>, <code>rename-map</code> and <code>retarget</code> also take <code>--with</code> /\n<code>--without PATH:LINE</code>, <code>--keep PATH[:LINE]</code> (site paths relative to <code>--project</code>), <code>--allow-blindspots</code> and <code>--docs</code>\n(comments, docstrings, strings and prose files: qualified mentions everywhere;\ncode-marked ones in the declaring files where the class owning the mention has\nthe renamed member, or outside such a class where every declaration of the name\nin the file is renamed to one name; the rest listed as <code>leftover</code>, as are\ndeclarations whose name contains the old name). <code>rename</code> and <code>rename-map</code> also\ntake <code>--docs-pick PATH:LINE[=ENTRY]</code> (rewrite the mentions listed on that line)\nand <code>--keep-literal KEY</code> (leave every dict or object literal holding that key).\nA string matching a pattern of the repo's <code>refactor.string_forms</code> is respelled\nwith a renamed class or module-level symbol, with or without <code>--docs</code>. Move destinations must already\nexist, and a <code>move-symbol</code> destination is a file of the same language. Run the\nrepo's formatter afterwards.</p>\n<p>A vocabulary rename (one word replaced across the repo) starts from a word table.\n<code>trmv-refactor --project &lt;repo&gt; generate-map TABLE &gt; MAP</code> writes one entry per declaration and\nmodule whose name holds a word (<code>words: [{from, to}]</code>, one row per inflection). <code>carve_outs</code>\n(<code>{words, annotated | paths | symbols}</code>) leave out a declaration where the word keeps its old sense, and\n<code>entries</code> holds hand-written map entries, kept on every regeneration. Change the table and regenerate;\nnever edit MAP by hand. Pass the table to the rename as <code>--words TABLE</code>: carved stand-ins are left and\ncarved <code>--docs</code> mentions are listed as <code>leftover</code>. A map entry\n<code>{file, symbol: '*.&lt;locals&gt;.NAME', new_name}</code> renames every local of that name in the file.</p>\n","files":[{"path":"SKILL.md","sizeBytes":8787,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-11-29T00:45:51.808196Z","sha256":"A64EC0FF56E447E8112DF81FC058E28E6A2333F002D57886CCC53E46E73CCDAF","sizeBytes":3836},"review":null,"source":{"repositoryUrl":"https://github.com/MotleyAI/living-architecture","path":"plugin/trmv/skills/rename-move","license":"MIT","commit":"c1ecf0af05da41d754e0a83233334edf6cbca797","subtreeSha":"F8508A483EA3EDF05F70EEF3CAFB1CF31F37D154D3DEAE122D68A875446443BC","lastSyncedAt":"2026-11-29T00:43:57.908191Z"},"reviewedAt":"2026-11-29T00:52:15.814345Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/MotleyAI/living-architecture/tree/main/plugin/trmv/skills/rename-move"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install motleyai-living-architecture@llmmart"},{"target":"git","command":"git clone https://github.com/MotleyAI/living-architecture.git"}]}