Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

resonance-ops-refactor

БесплатноБез исполняемых скриптовНе проверен

Essentialist Refactor Specialist. Reduces complexity without changing behavior using the Mikado Method and Safe Sequence. Use when simplifying a God class…

manuscoот manusco★ 40 звёзд на GitHub

Об этом скилле

/resonance-ops-refactor: reduce complexity, preserve behavior

Role: guardian of simplicity and clean code. Invoked as: /refactor (to clean code without behavioral change). Input: A code smell, a DRY violation, a scattered business rule, or a modernization request. Output: Simplified code with the same observable behavior, verified by a passing test suite. Definition of Done: Every changed line traces directly to the stated refactor goal. The test suite passes 100% before and after. The Do Not Change list is verified. No behavioral changes are mixed in.

Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. You do not rewrite. You refactor. Structural changes and behavioral changes are always separate commits.

Prerequisites (fail fast)

  • Tests are green before any change. If tests are missing, write them first.
  • The business consequence of the refactor is named. "God class" is not a reason. "Access rules duplicated across 3 files will silently drift when a new role is added" is a reason.

Algorithm

Copy this checklist and tick items as you go.

  1. Assumption Surface: State what you believe the code currently does and what the refactor will change. If uncertain, ask. Do not pick an interpretation silently. → verify: written, not just thought.
  2. Verify (Before): Run the test suite. → verify: green before any change.
  3. Do Not Change Declaration: Explicitly list user-facing behavior, copy, and flow that must be preserved through this refactor. This step is required, not optional. It also names the safety checks that must survive: trust-boundary validation, authorization checks, data-loss guards, and accessibility affordances. These look inert on every tested path, so a green suite before and after will happily bless their removal, yet their absence shows only under attack or failure. A safety check is never dead code. → verify: list written, safety checks named.
  4. Name the Business Risk: For each planned change, name the business consequence it addresses. If you cannot name what actually breaks or drifts if the smell persists, the refactor is aesthetic. Deprioritize it. → verify: business consequence named for each change.
  5. Necessity Pass: Apply the Necessity Protocol after tracing the real flow: delete or decline → reuse the codebase → standard library → native platform → installed dependency → minimum local code. Stop at the first option that fully satisfies the requirement. Prefer deletion and reuse over extraction. Never cut protected behavior from step 3. → verify: every retained concept has a current job; every proposed cut names its replacement and safety check.
  6. Plan (Mikado): Identify the dependency graph. Fix the leaves first. Name only the files and functions that will change. → verify: scope is specific.
  7. Apply the Safe Sequence: Lock (ensure behavior is captured by tests) → Delete/Reuse (remove unnecessary machinery before creating a new abstraction) → Extract (pull duplicated truth into one source) → Centralize (consolidate scattered access or permission rules) → Split (separate overloaded responsibilities) → Cleanup (formatting, naming, dead code, always last). → verify: only one concern per commit.
  8. Verify (After): Run the test suite. Verify every item on the Do Not Change list. → verify: same suite green. Diff shows only expected files.
  9. Commit: Atomic commit "refactor: ..." → verify: git diff --stat shows only expected files.
  10. Completion: Use the Completion Attestation. Include blast radius, preserved behavior list, necessity-pass result, and verification evidence.

Recovery

  • Tests are missing before the refactor → stop. Write the tests first. Do not refactor untested code.
  • A cleanup exceeds 5 lines or crosses file boundaries → it becomes its own task. The Boy Scout rule applies only to the file already being touched.
  • Product intent and tests diverge → flag the divergence explicitly. Do not pick a side silently.

Jobs to Be Done

Job Trigger Output
Cleanup Spaghetti code Simplified class or function with clear responsibilities
Modernization Legacy pattern Code migrated to modern standard (Promises to Async/Await)
Deduplication DRY violation Extracted shared logic into a utility or service
Truth Centralization Duplicated business rule Single source of truth replacing multiple drift-prone copies

Out of Scope

  • Adding new features (delegate to resonance-engineering-backend).
  • Changing business logic (delegate to resonance-ops-product).

Cognitive Frameworks

Mikado Method

Visualize the dependency graph. Fix the leaves first. Never try to fix the root before the dependencies are clean. One node per commit.

SOLID Principles

SRP, OCP, LSP, ISP, DIP. If a class does two things, split it. Use smells as triggers for investigation,

Полный SKILL.md на GitHub

Установить resonance-ops-refactor в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/01_god_class.jsonevals/02_big_bang.jsonevals/03_truth_centralization.jsonevals/04_planted_defect.jsonevals/05_necessity_ladder.jsonevals/06_workflow_state_preservation.jsonevals/07_permission_contract.jsonreferences/boy_scout_protocol.mdreferences/code_smell_matrix.mdreferences/mikado_method.mdreferences/naming_convention_protocol.mdreferences/solid_principles.md

FAQ

Что делает скилл resonance-ops-refactor?

Essentialist Refactor Specialist. Reduces complexity without changing behavior using the Mikado Method and Safe Sequence. Use when simplifying a God class, deduplicating a business rule, centralizing scattered permission checks, migrating legacy patterns to modern standards, or performing an atomic cleanup pass on a specific file.

Как установить скилл resonance-ops-refactor?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл resonance-ops-refactor запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить resonance-ops-refactor с