Guides refactoring and modularization using coupling analysis, type-level design, and safe migration strategies. Corrects LLM blind spots around temporal cohesion.
Ships in quality-tools. 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.
Principles that LLMs consistently get wrong during refactoring. This skill corrects systematic blind spots around coupling analysis, type-level design, module boundaries, and safe migration strategies.
The core problem: LLMs optimize for what code looks like (structural similarity), but good modularization optimizes for how code changes together (temporal cohesion). Every principle here addresses that gap.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
When refactoring, follow this sequence:
references/architecture.md).references/tactical-moves.md).Scan for these signals to identify which principle to apply:
| Signal | Likely Smell | Principle | Reference |
|---|---|---|---|
| Same group of parameters passed to 3+ functions | Data clump | Parse, don't validate — extract parameter object | type-design.md §1 |
| Method uses more of another class's fields than its own | Feature envy | Move method to where data lives | module-boundaries.md |
if isinstance / type switch with >2 branches | Missing polymorphism | Replace conditional with polymorphism | type-design.md §2 |
| Import cycle between modules | Acyclic violation | Extract shared or invert dependency | module-boundaries.md §2 |
| Boolean parameter on public API | Flag argument | Split into separate methods or use enum | tactical-moves.md §5 |
# TODO: remove after migration older than 3 months | Dead code | Delete it now | tactical-moves.md §1 |
Function has both return and side effects (db/file/network) | Mixed concerns | Functional core, imperative shell | architecture.md §1 |
| Test requires mocking >3 dependencies | Over-coupling | Missing a seam — identify and create one | structural-coupling.md §1 |
| Changing one feature touches >3 directories | Wrong slicing | Package by feature, not layer | module-boundaries.md §1 |
| Two modules that always change in the same PR | Under-modularized | Common closure — merge them | module-boundaries.md §3 |
| One module changes for unrelated reasons | Divergent change | Split by reason-for-change | structural-coupling.md §4 |
| One logical change touches 5+ files | Shotgun surgery | Merge the scattered concern | structural-coupling.md §4 |
init() must be called before process() | Temporal coupling | Type-state pattern | type-design.md §4 |
| External API types used deep in business logic | Leaked integration | Anti-corruption layer at boundary | architecture.md §2 |
| Same struct mutated in 3+ different modules | Unclear data ownership | Designate owning module for each data type | structural-coupling.md §5 |
| Vendor SDK types used in core logic | Volatility leak | Wrap behind narrow stable interface | structural-coupling.md §6 |
| Module exposes setters instead of operations | Undefended invariants | Expose intention-revealing operations | module-boundaries.md §5 |
| Infrastructure exceptions surface in business logic | Error leakage | Translate errors at module boundary | module-boundaries.md §6 |
| Pass-through layer with no logic (just forwards calls) | Fake modularity | Remove unnecessary indirection | tactical-moves.md §9 |
Module named utils, common, helpers, shared | Dumping ground | Split by actual consumer clusters | module-boundaries.md §4 |
| Domain logic inside controllers, handlers, or jobs | Misplaced business logic | Extract to domain module | architecture.md §1 |
| Services scattered across modules constructing own deps | Missing composition root | Centralize wiring at app entry point | architecture.md §5 |
| God service that coordinates AND decides everything | Mixed orchestration | Separate orchestration from computation | architecture.md §1 |
Each principle is covered in detail in references/. Read the relevant file when you encounter its smell.
references/structural-coupling.md)references/type-design.md)references/architecture.md)references/module-boundaries.md)references/tactical-moves.md)references/rust-specific.md)Read when refactoring Rust codebases. Covers visibility as architecture, public API surface control, crate vs. module boundaries, Cargo features, workspace feature unification, and dependency policy tooling.
references/swift-macos-specific.md)Read when refactoring Swift codebases on macOS. Covers access control as architecture (package modifier), explicit import visibility (SE-0409), target/framework boundary selection, macro isolation, and API governance tooling.
After this skill completes, check before closing:
Only update if the issue is real and reproducible — not speculative.
references/architecture.md (opens in a new tab)references/module-boundaries.md (opens in a new tab)references/rust-specific.md (opens in a new tab)references/structural-coupling.md (opens in a new tab)references/swift-macos-specific.md (opens in a new tab)references/tactical-moves.md (opens in a new tab)references/type-design.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
/quality-tools:refactoring-guidefrom quality-tools
npx claudepluginhub terrylica/cc-skills --plugin quality-tools10 skills in this plugin
/clickhouse-architectClickHouse schema design and optimization. TRIGGERS - ClickHouse schema, compression codecs, MergeTree, ORDER BY tuning, partition key./code-clone-assistantDetect and refactor code duplication with PMD CPD. TRIGGERS - code clones, DRY violations, duplicate code./dead-code-detectorDetect unused/unreachable code in polyglot codebases (Python, TypeScript, Rust). TRIGGERS - dead code, unused functions, unused imports/multi-agent-e2e-validationMulti-agent parallel E2E validation for database refactors. TRIGGERS - E2E validation, schema migration testing, database refactor validation./multi-agent-performance-profilingMulti-agent performance profiling for pipeline bottlenecks. TRIGGERS - performance profiling, bottleneck analysis, pipeline optimization./pre-ship-reviewRun a structured quality review before shipping code at any checkpoint such as PRs, releases, or milestones. Use whenever the user says.Other plugins' skills for the same job