Tidy Diff
Tidies a change's file-and-line list before commit: simplify, comment deletions, generated-code residue; docs-hygiene/ai-slop on markdown. Runs on detached…
от melodic-software★ 34 звезды на GitHub
Установить Tidy Diff в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Tidy diff
Variables
Arguments: $ARGUMENTS
HARD path exclusions: ${user_config.hard_exclusions} (unexpanded, empty, or any value outside
enforce and advisory means enforce).
Purpose
A change reaches review tidier when its author tidies it before the one commit that carries it, so the review judges final code and no tidy push restarts it. This skill is that step for a change that exists only in the working tree: it edits the change's own lines and nothing else, keeps behavior unchanged, and reports what it did and what it left.
The caller names the scope. This skill never derives it from a branch, a base ref, HEAD or the
index, which is why it runs the same on a detached head, in a lane that runs no git command, and
in a session that has not committed yet.
Input
<lines-file> holds one row per changed hunk, <start><TAB><count><TAB><path>, the shape
${CLAUDE_PLUGIN_ROOT}/scripts/added-lines.sh prints: <path> repository-relative, <start> the first
changed line in the current file and <count> how many follow. A new file is one row from line 1.
A row with <count> 0 (a pure deletion) names no line to tidy and is skipped.
Drop, and name in the report with the reason, every row whose path is absolute, has a ..
segment, is a symbolic link, is not a regular file, or matches the GLOBAL HARD list in
tidy's exclusions (path entries lift only under advisory).
No row left: report "nothing to tidy" and stop.
No <lines-file>: report that the caller writes one with
${CLAUDE_PLUGIN_ROOT}/scripts/added-lines.sh <base>, and stop. This skill derives no scope
itself.
--turns <n>: the turns this run may spend. Without it there is no budget.
Passes
Run them in this order, each only over the rows left. A code file is any listed file that is not
markdown (.md, .mdx); a markdown file goes to passes 4 and 5 only, so a change that is all
markdown runs only the markdown passes.
- Simplify the code lines. Read each listed hunk with enough of its file to see what it
calls and what calls it. Apply reuse (an existing helper in place of new code), simplification
(a needless branch, variable, wrapper or conversion removed) and efficiency (repeated work in a
loop hoisted, a needless second read dropped) cleanups inside the listed lines. Every edit
preserves behavior: a cleanup that would change an output, an error, an order or a public
signature is a proposal, never an edit. This pass does not call the bundled
simplifyskill; it works on the line list itself. Pointer for the targetssimplifytakes: the/simplifyrow in All commands. Recheck trigger: that row letssimplifytake a line list. The record for that surface is bundled-simplify.md, "Decision records". - Delete zero-information comments in the code lines. Classify each comment that sits in a
listed line per triage.md, skipping the exempt
surfaces in safety.md. Apply class A only, the
safemode of/code-tidying:remove-comments, proving each deletion before the real file changes: write the file with the comment deleted to the scratch directory the session's instructions name (else the system temp directory), keeping its extension, then run${CLAUDE_SKILL_DIR}/scripts/change-shape.sh <file> <scratch copy>. Only on exit 0 (COMMENT-ONLY) make the same deletion in the real file; any other exit leaves the real file untouched and the comment becomes a proposal quoting the verdict. Class B and class C are proposals. No rename, no move, no rewrite. - Strip generated-code residue from the code lines. Sweep each listed hunk for the residue kinds in generated-code-residue.md, in its order, and act on each finding as its In tidy-diff column says: an edit pass 1 allows is applied under pass 1's rule, and every other fix is a proposal naming the residue kind and the fix, including each choice of a loud failure over a quiet wrong answer. Comments are pass 2's alone: pass 2 already triaged every comment in the listed lines, and this pass edits none.
- Apply the docs-hygiene writing rules to the markdown lines. For markdown an agent loads
(a
SKILL.md, an agent, a rule,CLAUDE.md,AGENTS.md, a reference file a skill reads) invoke/docs-hygiene:write-for-agents <file>(if enabled); for other markdown invoke/docs-hygiene:write-for-humans <file>(if enabled). Apply what it asks only to the listed lines: cut restatement, filler and hedging, and keep every fact, link and constraint. - Fix AI prose patterns in the markdown lines. Invoke
/ai-slop:audit fix <file>(if enabled) per markdown file. Keep its fixes inside the listed lines and undo any outside them.
A
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash(${CLAUDE_SKILL_DIR}/scripts/change-shape.sh:*)
Вложенные файлы
- evals/evals.json
- reference/generated-code-residue.md
- scripts/change-shape.sh
FAQ
Что делает скилл Tidy Diff?
Tidies a change's file-and-line list before commit: simplify, comment deletions, generated-code residue; docs-hygiene/ai-slop on markdown. Runs on detached HEAD/unattended lanes without base ref. Use when: 'tidy my change before the commit', 'tidy these lines', 'tidy-diff'. Not for /code-tidying:tidy or /code-tidying:batch-simplify.
Как установить скилл Tidy Diff?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Tidy Diff запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis 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…