/code-change-discipline:sweeping-changefrom code-change-discipline
Execute a large pre-planned change across a big codebase using subagents, a code knowledge graph and LSP, with a living plan document. Triggers on: execute this plan, run the migration plan, apply this refactor everywhere, migrate N sites, sweep the codebase for X, rename across the whole repo, localize/instrument/convert every call site, work through this audit, large multi-site refactor, hundreds of throw sites, fan out agents over slices. Also use when a plan or audit document already exists and the job is to carry it out. Covers only what changes when work outgrows one context — the per-change discovery, editing and verification rules live in code-change-discipline and apply at every size.
Ships in code-change-discipline. 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.
For changes that touch more sites than fit in one context: migrations, cross-cutting refactors, audits carried out to completion. The unit of work is a slice, executed by a subagent with a fresh context, verified by the orchestrator, and recorded in a shared document.
Before anything else, invoke the code-change-discipline skill (Skill tool,
skill: code-change-discipline). It owns discovery, LSP, the editing protocol and verification for
every change at every size. This skill owns only what changes when the work stops fitting in one
context. Do not restate its rules here — put its name in every agent brief instead.
Fan out when the change spans more sites than you can hold — roughly 50+ edit sites, or any job where reading the relevant code would itself exhaust the window.
Do not fan out for a change you can complete in one pass. Spawning agents for a ten-site rename costs more than it saves and adds a verification burden. Scale the fan-out to the work: most jobs justify two or three agents, and only a migration spanning hundreds of sites justifies dozens.
This threshold gates subagents, worktrees and the plan document — nothing else. The discovery
ladder, LSP-as-tiebreaker, the narrow-window edit protocol and test-count verification apply at
every size and are never "too much process for a small change". A ten-site rename still follows
code-change-discipline; it just does not spawn agents.
A plan or audit handed to you is the best available guess, and it will be wrong in specific, checkable ways. Assume it undercounts, and by margins that are routinely an order of magnitude rather than a few percent.
Instruct every agent to re-derive its own inventory and treat the plan's numbers as lower bounds. The techniques that actually produce ground truth, in order of reliability:
findReferences / goToImplementation for call sites and interface implementors.Grep is the least reliable and should not be how a count is established.
Plans also contain design claims that are simply false — including ones that are architecturally impossible, and ones that would ship a silent no-op past a green build. An agent that finds the plan wrong and says so is doing the job correctly. Say that in the brief.
Keep one document — the plan itself is ideal — with an execution log near the top. Every agent reads it before starting and appends its findings before finishing. State explicitly that the log overrides the plan body where they disagree.
Without this, each agent rediscovers the same traps independently. With it, a later slice starts
already knowing that a particular helper silently skips part of its input, or that a base-type
change stops an upstream catch from catching.
Record in the log, at minimum:
Most of a brief is reusable. Adapt the bracketed parts:
## NON-NEGOTIABLE WORKING PRACTICES
**Your first action is to invoke the `code-change-discipline` skill** (Skill tool,
`skill: code-change-discipline`) and follow it. Do not search anything before you have.
If that skill is not available to you, the minimum is: this codebase is large — **do not use Grep
or Glob to find code, and never Read a large file in order to search it.** Use codebase-memory-mcp
(its own `codebase-memory` skill is the tool reference), watch every response for silent truncation,
and remember that `search_code` treats patterns literally unless `regex=true` and `trace_path`
excludes tests unless `include_tests=true`. **LSP is the tiebreaker — trust it over the graph.**
Read(offset, limit) a narrow window, then Edit with a tight old_string.
**Before you cite a path, call `check_index_coverage` on it** — once, batched over every path your
conclusion rests on. A clean result means no recorded gap, not proof of completeness; where coverage
is partial, skipped, excluded or stale, read that range directly and say so.
Project name (exact): <PROJECT>. `project` is required on every codebase-memory-mcp call. Confirm
anything load-bearing with LSP before editing.
**Never Read whole:** <the two or three largest files in scope>.
**Test count (from the runner's discovery mode, not a run):** <N> tests <plus any double-counting
quirk in the runner>. Track it as a number that must be accounted for, not merely "green". Do not
run the suite before editing. When your slice is done, run the build and the tests covering the
files you touched, once, and report both counts. Never revert work to replay red-green.
**An agent that finds the plan wrong and says so is doing the job correctly.**
Append your findings to the execution log at <path> before you finish.
Then add, per slice: the scope, the verification commands, and commit conventions.
Ask for a report that names which plan claims turned out false — that is the most valuable thing an agent produces, and asking for it explicitly changes what comes back.
Slices that append to the same file — a shared catalog, a constants file, a resource bundle — cannot run concurrently even when their edit sites are in different files. Serialize those.
codebase-memory-mcp ships its own read-only agents — codebase-memory-scout (fast, provisional),
codebase-memory (task-directed) and codebase-memory-auditor (bounded full verification) — plus
--tool-profile=analysis|scout to restrict the surface. Use them for investigation slices; they
cannot edit.
For genuinely disjoint scopes, use git worktrees, and note:
isolation: "worktree" operates on the primary working directory. In a monorepo whose parent
is not a git repo, create worktrees on the subrepo yourself: git worktree add <path> -b <branch>.The per-change verification rules are in code-change-discipline §5 and apply to every slice.
On top of them:
git status, run the gates, review the diff shape, and commit if sound — far
cheaper than re-running the slice.What SKILL.md sets; muted values are Claude Code's defaults
2 skills in this plugin
Other plugins' skills for the same job
npx claudepluginhub spectralangel/ai-plugins --plugin code-change-discipline