tidying
БесплатноБез исполняемых скриптовНе проверенGuide structural code improvements using Kent Beck's Tidy First methodology. Use when seeing messy code, before making behavioral changes, after completing…
Об этом скилле
INSTRUCTIONS
Apply Kent Beck's "Tidy First?" philosophy: small, safe structural changes that improve code without changing behavior. Tidying is separate from feature work and gets its own commits.
- Behavior Contract: See
behavior-contract.mdfor complete definition of "behavior" (inputs, validation, outputs, side effects, errors) and structural vs behavioral change examples - Context Boundaries: See
context-boundaries.mdfor what's safe to tidy in frontend/backend/CLI/library contexts (behavior boundary differs by context!)
Core Principle
"Tidying is a special kind of refactoring... tidying is small, and you never need to tidy."
Tidyings are:
- Small: Minutes, not hours
- Safe: Structure only, no behavior change
- Optional: You choose when (or if) to tidy
- Separate: Own commits, distinct from behavioral changes
The Three Timings
| Timing | Trigger | Flow |
|---|---|---|
| Tidy First | Code is hard to change | /tidy:first → refactor: commit → behavioral change → feat:/fix: commit |
| Tidy After | Feature revealed better structure | behavioral change → feat:/fix: commit → /tidy:after → refactor: commit |
| Tidy Later | Tidying too big or off-focus | Note opportunity → backlog/TODO → continue current work |
Decision Framework
1. Does this code need to change for my current task?
No → Tidy Later (or never)
Yes ↓
2. Would tidying make my change easier/safer?
No → Make behavioral change, consider Tidy After
Yes ↓
3. Is the tidying small (< 15 minutes)?
No → Tidy Later, make behavioral change anyway
Yes → Tidy First, then make behavioral change
When NOT to DRY
"Duplication is far cheaper than the wrong abstraction." — Sandi Metz
Keep code inline when:
- Pattern is simple and self-explanatory (
vec![],None, error returns) - Abstraction adds indirection without clarity
- Repetitions might evolve differently
- grep/search is easier with inline code
Reference
Based on: Tidy First? by Kent Beck (2023)
Tidy First
Use before a behavioral change when the code you need to touch is hard to understand, tightly coupled, poorly named, duplicated, or otherwise messy.
- Identify one small tidying
- Make the structural change without changing behavior
- Run tests to confirm nothing broke
- Commit with
refactor: - Repeat only while the next behavioral change is still easier or safer
Good small tidyings include guard clauses, dead code removal, normalizing symmetries, extracting a helper, inlining an obscuring abstraction, renaming, reordering related code, and introducing explaining variables or constants.
Tidy After
Use after a committed behavioral change when implementation revealed clearer structure.
- Ensure the behavior change is already committed as
feat:orfix: - Identify one small cleanup opportunity
- Make only the structural change
- Run tests
- Commit with
refactor: - Repeat only while value remains high
Favor cleanup that removes copy-paste from getting green, improves names after learning the domain, simplifies conditionals, removes scaffolding, or improves cohesion.
Tidy Later
Use when a tidying is valuable but too large, disruptive, or not blocking the current work.
Document enough context for future work:
- Location: where the messy code is
- Problem: what makes it hard to work with
- Opportunity: what tidying would help
- Trigger: when to revisit it
Prefer the project's existing convention: an in-code TODO, an issue or ticket, or a tech-debt log. Keep entries specific enough to act on later.
Установить tidying в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл tidying?
Guide structural code improvements using Kent Beck's Tidy First methodology. Use when seeing messy code, before making behavioral changes, after completing features, documenting deferred cleanup, or discussing when to clean up code.
Как установить скилл tidying?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tidying запускает скрипты?
Нет, скилл состоит только из инструкций (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