/harness:refactoring-safelyfrom Harness (обвязка)
Guides safe code restructuring using behavior-preserving transformations: characterization tests first, one refactoring per commit, green between steps. Use when splitting modules, extracting functions, cleaning legacy code, or removing dead code.
Ships in Harness (обвязка). 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.
Read when SKILL.md points to them.
Refactoring is a behaviour-preserving transformation. If behaviour changed, that was not a refactor, it was a rewrite with optimistic branding — and the reason large restructures fail is almost always that the two were done in one step.
Never restructure and change behaviour in the same commit. Alternate deliberately: refactor (green → green, no behaviour change), then change behaviour (with a new test). When both happen at once, a failing test cannot tell you which half broke it.
Legacy code is code without tests, regardless of age. So:
| Smell | Underlying problem | Transformation |
|---|---|---|
| Long function | Several jobs in one scope | Extract function, split by level of abstraction |
| Large module | Several reasons to change in one file | Move features into modules that own their state |
| Long parameter list | A missing object, or a hidden mode flag | Introduce parameter object; split by behaviour |
| Feature envy | Method uses another object's data more than its own | Move method to where the data lives |
| Shotgun surgery | One decision spread across files | Gather it into one owner |
| Divergent change | One file changing for unrelated reasons | Split by reason to change |
| Primitive obsession | A concept represented as a string or dict everywhere | Introduce a type; put its rules with it |
| Duplicated decision | One rule expressed in several places | Extract and give it one home |
Duplicated text expressing unrelated decisions is not a smell. Merging it couples things that had no reason to change together.
Order matters more than technique, and this order is what keeps each step small:
At each step: green before, green after, one commit.
Hand-rolled locks and module-level mutable state do not survive naive moves. Before moving anything guarded:
references/refactoring-patterns/smell-catalog.md — the full catalogue with triggersreferences/refactoring-patterns/refactoring-workflow.md — safe workflow and rollbackreferences/refactoring-patterns/composing-methods.md — extract, inline, replace tempreferences/refactoring-patterns/moving-features.md — move method/field, hide delegatereferences/refactoring-patterns/organizing-data.md — replace primitive, encapsulatereferences/refactoring-patterns/simplifying-conditionals.md — guard clauses, polymorphismreferences/dead-code-sweep.md — agent-driven removal of dead code and stale flags: read-only audit, production evidence, one draft PR per removal*-original.md — the source skill's own framework prose, kept verbatim| Symptom | Cause | Fix |
|---|---|---|
| Tests broke and you cannot tell why | Behaviour change smuggled into a structural commit | Revert; redo as two commits |
| Extracted function needs six parameters | The cut is in the wrong place | Cut along the data, not along the line count |
| Circular import after the split | Two new modules both own part of one concept | Extract the shared concept into a third |
| Race appears only after the move | State and its lock ended up in different modules | Move them together; re-state the invariant |
| New offline path has no traffic | The module is not a live served boundary | Identify its consumers and use the applicable focused contract/integration receipt before authorized deletion |
references/dead-code-sweep.md (opens in a new tab)references/refactoring-patterns-original.md (opens in a new tab)references/refactoring-patterns/composing-methods.md (opens in a new tab)references/refactoring-patterns/moving-features.md (opens in a new tab)references/refactoring-patterns/organizing-data.md (opens in a new tab)references/refactoring-patterns/refactoring-workflow.md (opens in a new tab)references/refactoring-patterns/simplifying-conditionals.md (opens in a new tab)references/refactoring-patterns/smell-catalog.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub anastasiyaw/codex-claude-code-config --plugin harness60 skills in this plugin
/agent-harness-designDesigning agent harnesses and tool systems — risk taxonomy for tools, permission decisions, draft/commit pattern, structured tool results, agent budgets (10 types), context trust labels against prompt injection, plan-artifact, approval records, observability and traces, evals (13 categories), event model, streaming buffering, 3rd-party skill install checklist, agentic RAG, self-improving SOP loops, model policy, reasoning effort, and Programmatic Tool Calling adoption gates. Use when building a new Agent SDK app, custom orchestrator, MCP server, Cloudflare Worker with tool calls, agentic RAG pipeline, model router, or model-tier policy; when designing tools and permissions; when writing an agent loop; or when you need trust labels for external content. Do NOT use for improving or auditing an already-built harness (use harness-audit / harness-design instead), nor for ordinary Claude Code sessions where the harness is already given./agents-best-practicesUse when designing, auditing, refactoring, or explaining an agentic harness for any domain, especially when work must continue from a measured gap to verified completion. Covers provider-neutral loops, tools, permissions, environment adaptation, planning, durable workflow state, context, skills, observability, evals, and safety for OpenAI, Anthropic, and compatible APIs. Not for implementing an ordinary app feature or reviewing one concrete diff.Other plugins' skills for the same job