refactor
БесплатноБез исполняемых скриптовНе проверенAlignment refactor — restore naming, boundaries, and structure to match the concept capsule. Use after a slice lands, or when naming, module boundaries, or…
от hashintel★ 38 звёзд на GitHubОб этом скилле
Alignment Refactor
Restore naming, module boundaries, and structure so the code matches the concept capsule. Refactor immediately after green, while context is fresh.
Input
What feels off, or the scope to check: $ARGUMENTS
Before starting, locate:
- The concept capsule (glossary, invariants — naming authority). If none exists →
/pragma:capsulefirst. - The recent changes (files touched in the last slice)
- What feels off (if the user has a specific concern, start there)
Procedure
1. Audit naming
Compare every public name (types, functions, modules, test suites) against the capsule glossary:
- Mismatches: same concept, different words → rename to match glossary
- Missing terms: glossary concept with no code home → note for future slice
- Extra terms: code name with no glossary counterpart → add to glossary or delete as speculative
If the glossary says "Worker," the code says "Worker" — not "processor," not "handler."
2. Audit module boundaries
For each module, complete: "This module hides the decision about ___." (Parnas)
- Can't complete the sentence → module does too much, split it
- Two modules hide the same decision → merge
- Module hides no decision (pass-through) → delete
Check functional core / imperative shell boundary: pure domain logic has zero I/O imports; I/O adapters have zero domain logic; shell calls core, never the reverse.
3. Delete dead code
- Speculative abstractions (generics/interfaces with one implementation)
- Commented-out code
- "For later" structure (empty dirs, placeholders, stubs)
- Unused imports and variables
If it doesn't serve a current test or behavior, it goes.
4. Check invariant enforcement
For each capsule invariant: type system (best) → constructor/validator (good) → tests (minimum) → none (fix this).
5. Classify authority deltas
Before closing refactor work, classify what changed and route durable updates:
- Semantics changed (glossary/invariant/happy-path/non-goal meaning) →
/pragma:capsule update - Strategy changed (cross-cutting decision/rationale/reversal trigger) →
/pragma:roadmap update - Phase control changed (scope/status/ordering/deferment/exit criteria) →
/pragma:milestone update - Confidence changed (assumption validated/invalidated/confidence shift) →
/pragma:assumptions update - Enforcement readiness changed (invariant now enforceable in code/tests) →
/pragma:contract
Use explicit none for lanes with no change.
6. Verify and commit
Run full verification harness. All checks must pass — remain green throughout. Commit separately from behavior work: Refactor: align naming/boundaries to capsule after [slice]
Constraints
- Tests stay green. Refactor under green.
- No new features. Structure changes only. Missing behavior → write a
/pragma:card. - The capsule is the authority. Code wrong + capsule right → change code. Code right + capsule wrong → update capsule first, then change code.
Output
- Renames: what was renamed to match glossary
- Splits/merges: module boundary changes
- Deletions: speculative or dead code removed
- Invariant status: which invariants are enforced where
- Authority Delta:
- Semantics:
none|/pragma:capsule update— [reason] - Strategy:
none|/pragma:roadmap update— [reason] - Phase control:
none|/pragma:milestone update— [reason] - Assumptions:
none|/pragma:assumptions update— [reason] - Enforcement:
none|/pragma:contract— [reason]
- Semantics:
- Capsule updates: if the capsule itself needed updating
- Remaining drift: anything that needs a separate slice to fix
- Lifecycle:
State: stabilizing,Next: first non-'none' authority delta command (otherwise /pragma:assumptions update),Loop: /pragma:consult(default unless user explicitly continues directly)
Установить refactor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл refactor?
Alignment refactor — restore naming, boundaries, and structure to match the concept capsule. Use after a slice lands, or when naming, module boundaries, or structure have drifted from the capsule. Prevents conceptual drift.
Как установить скилл refactor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл refactor запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic