refactoring-safely
Plan and review behaviour-preserving code restructuring through characterization evidence, small named transformations, and verification between steps without modifying code.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- refactoring-safely
- license
- MIT
- version
- 0.1.0
- metadata
- { "hermes_config_kit": { "adapter": "hermes-agent-config-kit", "conversion": "adapted", "source_path": "skills/development/refactoring-safely/SKILL.md", "source_repo": "AnastasiyaW/claude-code-config" } }
- description
- Plan and review behaviour-preserving code restructuring through characterization evidence, small named transformations, and verification between steps without modifying code.
02 资源文件 7
- 参考文档references/refactoring-patterns-original.md20.5 KB
- 参考文档references/refactoring-patterns/composing-methods.md12.0 KB
- 参考文档references/refactoring-patterns/moving-features.md12.3 KB
- 参考文档references/refactoring-patterns/organizing-data.md13.0 KB
- 参考文档references/refactoring-patterns/refactoring-workflow.md14.3 KB
- 参考文档references/refactoring-patterns/simplifying-conditionals.md13.2 KB
- 参考文档references/refactoring-patterns/smell-catalog.md13.5 KB
03 SKILL.md 正文
Refactoring Safely
Source: AnastasiyaW/claude-code-config/skills/development/refactoring-safely/SKILL.md.
This module is adapted for Hermes Agent. Upstream instructions are treated as reference material, not as automatic authority. Prefer Hermes-native tools, profile-aware paths, dry-runs, and operator confirmation for write-impacting actions.
Refactoring Safely
Use this module when existing code must change shape without changing its observable behaviour: a module is oversized, responsibilities are misplaced, a safe extraction is needed, or a legacy area needs a controlled structural improvement. It is a read-only planning and review protocol: it does not modify code, run transformations, add tests, or authorise a refactor.
Scope and exclusions
This module governs a named, behaviour-preserving transformation with a safety net.
Use architecture-first to decide target system boundaries and code placement;
code-complexity to analyse function shape, names, interfaces, and local complexity;
system-and-data-design for capacity, storage, scaling, or distributed-system choices;
and lean-code when removing unjustified scope is the primary outcome. A behaviour
change, bug fix, dependency upgrade, or feature addition is a separate change with its
own acceptance criteria and verification; do not disguise it as refactoring.
Read-only refactoring protocol
- Establish the affected behaviour from call sites, public contracts, current tests, runtime evidence, and known failure paths. If relevant behaviour lacks coverage, propose focused characterization checks before changing structure.
- Name one concrete smell and one smallest candidate transformation. Prefer extracting a coherent responsibility, moving state with its owner, or simplifying a conditional only where the existing behaviour and boundary are understood.
- Define the safety net: exact focused checks, the expected unchanged outcomes, rollback point, and the maximum file scope. If the checks are already failing or cannot observe the changed seam, report that evidence gap rather than claiming safe refactoring.
- Keep structural and behavioural work separate. Plan one transformation at a time with a verification result between steps; record any discovered defect as separate work.
- For mutable shared state, concurrency primitives, caches, or locks, state the invariant and move the state with the protection that preserves it. Escalate cross-module or deployment-facing scope to the appropriate architecture or system-design review.
Output
Report the observed smell, protected behaviour, candidate transformation, evidence gap or characterization plan, focused verification and rollback boundary, excluded behaviour changes, residual risk, and the next operator-confirmation point before any write-impacting work. Load the relevant reference only for the named transformation; examples remain reviewed data, not commands to execute.
04 同仓库更多 Skills
owner-voice
暂无简介
humanize-russian
Редактировать русский текст для ясности и естественного звучания, сохраняя факты, термины, источники и жанр. Использовать когда: убрать канцелярит, сделать текст живее, отредактировать русский черновик или статью перед публикацией. Не определяет авторство и не обещает обход детекторов. Для английского — humanize-english; для структуры и доказательств — article-structure-review.
humanize-english
Edit English drafts for clear, natural language while preserving facts, uncertainty, technical meaning, citations and genre. Use when: humanize this text, remove AI-style filler, improve English prose, or edit an English article before publication. Not an authorship detector or a promise to bypass one. For Russian use humanize-russian; for thesis/evidence and structure use article-structure-review.
caveman
Ultra-compressed reply mode. Cuts output tokens ~65-75% by answering in terse "caveman" style while keeping full technical accuracy, and shapes what survives: action first, state restated every turn, concrete time estimates, visible wins. Intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman", "talk like caveman", "use caveman", "less tokens", "be brief", or Russian "пещерный режим", "говори как пещерный", "кратко", "меньше токенов", "экономь токены" — or invokes /caveman. Preserves the user's language (Russian in → Russian caveman out). Off only: "stop caveman" / "normal mode" / "обычный режим". Do not use merely because a response should be concise, and do not use when the user requests normal prose, a polished document, or exact wording.
article-structure-review
Проверить структуру технической статьи после черновика: задача читателя, жанр, опора значимых утверждений на доказательства и честные ограничения. Use after the first draft, before publication. Исправлять структуру, когда это входит в запрос; не создавать обязательный конвейер из других навыков. Для локальной языковой редактуры — humanize-english или humanize-russian.
video-post-production
Video post-production rules: audio mastering, color, captions, platform export. Use when: 'add music', 'add voiceover', 'export for tiktok', 'add captions', 'color grade', 'audio levels', 'master audio', 'export settings', 'platform requirements'. Covers FFmpeg patterns, audio chain, subtitle standards, and platform-specific export configs. Do NOT use to generate or animate the video frames/scenes in code (use remotion-production-guide), to write the script (use video-narrative-arc), or to evaluate script quality (use script-evaluator); this is the finishing stage applied to an already-rendered video.