{"slug":"arch-cleanup","title":"arch-cleanup","summary":"Use to carve or tighten ONE architecture boundary in a repo with the living-architecture setup — take a coherent batch of grandfathered `#legacy` arrows (or extract a new node), refactor them away with verified moves (type-rename-move), and shrink the legacy-arrow baseline monoto","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-11-29T00:43:58.547986Z","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: arch-cleanup\ndescription: Use to carve or tighten ONE architecture boundary in a repo with the living-architecture setup — take a coherent batch of grandfathered <code>#legacy</code> arrows (or extract a new node), refactor them away with verified moves (type-rename-move), and shrink the legacy-arrow baseline monotonically. Behaviour-preserving by definition; one slice = one branch/PR.</h2>\n<p><strong>Preflight:</strong> run <code>la-doctor --plugin &lt;this skill's base directory&gt; --require-config</code> once per session before using any <code>la-*</code> or <code>trmv-*</code> command. If it reports the missing-config finding (the one naming <code>/la:init</code>), run the fast path of the <code>la: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>la-doctor</code> is not found, or reports the la 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>): <code>uv tool install living-architecture==&lt;version&gt; --with-executables-from type-rename-move</code> in a Python repo, <code>npm install -g living-architecture@&lt;version&gt; type-rename-move@&lt;version&gt;</code> in a TS/JS repo.</p>\n<p><strong>Stealth mode:</strong> if <code>la-config get stealth</code> prints <code>true</code>, STOP and tell the user this skill does not run in stealth\nmode: a model that is not versioned with the code cannot stay true across branches.</p>\n<h1>Carve one boundary slice</h1>\n<p>A slice moves code until a batch of grandfathered edges dies, with a\ndeterministic gate proving nothing dangles. It is behaviour-preserving: no new\nbehaviour, no new tests, no OpenSpec spec deltas. The legacy-arrow ratchet plus\nthe green suite ARE the spec, so the /la:pr stage flow does not apply — but\neach slice still gets its own branch and PR, and its own issue when the repo has a tracker.</p>\n<h2>Procedure</h2>\n<ol>\n<li><p><strong>Pick the slice.</strong> List the model's <code>#legacy</code> arrows (their count is\n<code>legacy_arrows.baseline</code> in <code>index.yaml</code>); propose a coherent batch — one\nimporter module, one edge family (e.g. <code>python.core -&gt; python.sql.render</code>),\nor one node extraction. Arrows live inside their language root, so a slice\nstays within one language.\nKeep it ≤ ~10 edges. Confirm the choice with the user.</p>\n</li>\n<li><p><strong>Read the touched elements' arc42 (and their ancestors') + LikeC4 view.</strong> The principles decide the\nresolution per edge:</p>\n<ul>\n<li><strong>move down</strong> — the imported thing is a lower-level utility on the wrong\nside → <code>trmv-refactor move-symbol</code> / <code>move-module</code> into the lower package;</li>\n<li><strong>move up</strong> — the importing code doesn't belong in this node → move it\nout;</li>\n<li><strong>invert</strong> — both sides are placed right → introduce a\nProtocol/callback in the lower layer (a real code change, not a pure\nmove — keep it minimal and fully typed);</li>\n<li><strong>legitimize</strong> — the edge is actually correct → change the model and\narc42 instead. Requires the user's explicit OK.</li>\n</ul>\n<p>Present the per-edge resolution table BEFORE mutating anything — this is a\nnontrivial design decision, the one permitted pause.</p>\n</li>\n<li><p><strong>Baseline the gate:</strong> <code>trmv-typecheck</code> green (the type checker against its\ncommitted baseline, in the project env) — if it prints \"nothing to check\",\nSTOP and tell the user: without a type check the moves cannot be verified,\nso offer to set one up (<code>commands.typecheck</code> and <code>trmv-typecheck --write-baseline</code>) first; <code>la-arch-check</code> green; the repo's test command (<code>la-config get commands.test</code>; if unset, the repo's documented full non-integration suite) green.</p>\n</li>\n<li><p><strong>Execute the moves</strong> via the <code>trmv:rename-move</code> skill (dry-run →\napply → format). The refactor's project scope must include the tests so\ntest imports are rewritten too. New destination packages are created first\n(destinations must exist before moving; the language doc says what a new\npackage needs).</p>\n</li>\n<li><p><strong>Move gate — done only when ALL pass:</strong></p>\n<ul>\n<li><code>trmv-typecheck</code>: <strong>no new errors</strong> vs baseline. A stale <code>from old import X</code>\nor <code>old_mod.X</code> surfaces here even in untyped code — module members are\nstatically resolvable without annotations;</li>\n<li>delete the slice's now-dead <code>#legacy</code> arrows from the model and lower\n<code>legacy_arrows.baseline</code> in <code>index.yaml</code> to match; <code>la-arch-check</code>\ngreen (it fails if the count, or any measured edge, disagrees with the model);</li>\n<li>the repo's test command (<code>la-config get commands.test</code>; if unset, the repo's documented full non-integration suite) green;</li>\n<li>grep the string-only refs no static tool sees, for every moved dotted\npath: <code>patch(\"...\")</code>, <code>importlib</code>, <code>getattr(</code>, <code>__all__</code>, pyproject\nentry points/scripts, config files, docs.</li>\n</ul>\n</li>\n<li><p><strong>Sync views &amp; arc42:</strong> adjust views if the node shape changed (an\nextracted node is a child of its language root with its own\n<code>metadata { package '…' }</code>; a nested element maps to <code>&lt;package&gt;.&lt;path&gt;</code> by\nconvention and may carry only <code>specs</code> metadata; views stay <code>of &lt;root&gt;</code>; an element whose id changed takes its arc42\nfile along as <code>architecture/&lt;new id&gt;.arc42.md</code>); re-validate\nthe model (<code>la-arch-diagrams</code> refreshes the embedded view diagrams); update\narc42 rationale/principles if the slice established a new\nrule — ideally tagged <code>[enforced: &lt;the check/test that now holds&gt;]</code>.</p>\n</li>\n<li><p>Review the diff; the user commits. One slice per PR; never mix in\nbehaviour changes.</p>\n</li>\n</ol>\n<h2>When is full compliance needed?</h2>\n<p>Full type-rename-move compliance (annotations everywhere, spec-bound\nmocks, <code>@typing.override</code>) is <strong>not</strong> required for pure moves: every reference\nto a moved module-level symbol resolves through a module namespace the checker\ncan see unannotated, and a stale <code>patch(\"old.path\")</code> fails loudly at test\nruntime because <code>patch</code> imports its target from the string. The blind spots\nthat remain are string refs in tests that don't execute — covered by the grep\nin step 5.</p>\n<p>The moment a slice must <strong>rename</strong> an attribute or method (e.g. while\ninverting a dependency), that guarantee needs typed receivers: run\n<code>trmv:make-refactor-target-compliant</code> on the blast radius first, then\n<code>trmv:rename-move</code> for the rename.</p>\n","files":[{"path":"SKILL.md","sizeBytes":6093,"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:52.502723Z","sha256":"79B1D735C46BB2BB2CAB3577AA4874082621665373C26FCA7476A74E149F1C9F","sizeBytes":2976},"review":null,"source":{"repositoryUrl":"https://github.com/MotleyAI/living-architecture","path":"plugin/la/skills/arch-cleanup","license":"MIT","commit":"c1ecf0af05da41d754e0a83233334edf6cbca797","subtreeSha":"BBE1C6C8701BB90AED967E02F4CB74566387AC69654A82D48781DAE14E318E04","lastSyncedAt":"2026-11-29T00:43:57.908191Z"},"reviewedAt":"2026-11-29T00:52:15.966937Z","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/la/skills/arch-cleanup"},{"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"}]}