hoc-git-prohibit-destructive-commands
The git commands this library does not run, because what they destroy cannot be given back — a modified file, an untracked note, an object no ref still names…
от openreachtech★ 17 звёзд на GitHub
Установить hoc-git-prohibit-destructive-commands в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Git: Prohibit Destructive Commands
What a repository still holds is not the agent's to destroy. It was put there by whoever is working, and an agent that did not write a file cannot read what it is worth. The commands below take it away with nothing left to recover from, so the work is carried through an operation rather than cleared before one.
Nothing that discards uncommitted work is run
No command is run whose effect is that an uncommitted change or an untracked file is gone, and there is no exception. The rule is written as the effect rather than as a list of spellings, so a command not named here is covered by what it does.
Four were measured, and not one of them asked:
| Command | What went |
|---|---|
git reset --hard <target> |
A modified file and a staged one, both |
git checkout -- <path> |
The modification at that path |
git restore <path> |
The same |
git clean -fd |
Untracked files, and untracked directories whole |
git cleanis barred outright rather than merely avoided, and nothing is given up by that. It is the one of the four with no recoverable half: the others take back a change the repository still holds an object for, and this one removes what the repository never held. What it is reached for is reached another way —git stash -uempties the tree of untracked files without destroying them — and the operations said to need a clean tree largely do not: a rebase, measured, runs straight past an untracked file it has no use for, and where it would have to overwrite one it aborts rather than removing it. A working practice that never runsgit cleanloses nothing, which is what makes the bar costless to hold.- A command that prints what it removed has still not asked.
git clean -fdnames each path as it goes, into a scrollback nobody is reading at that moment. A line after the fact is not a confirmation before it. - "The tree is clean" is not a reason to run one. That is a reading taken at an instant while the operation is not, and where it is true the command had nothing to do anyway.
- Needing a clean tree is not a reason either. Setting the work aside is what that calls for, and it is below.
Why it is absolute
The judgement it would take is not one to be made here. Deciding that a file may go means knowing what it was for and what losing it would cost — a reading of somebody else's work, taken in passing, with no way to check the answer and no way back from a wrong one. Where an act cannot be undone and the judgement behind it cannot be verified, the act is not taken at all. That is what makes this absolute rather than a matter of care: care is what is exercised over decisions that are yours to get wrong.
The agent did not make every file in the tree. Notes, a half-written draft, a file copied in to compare against, a directory kept outside version control on purpose — a person leaves these where they are working, and nothing in the tree distinguishes them from the agent's own leavings.
Measured: a directory of notes kept untracked was removed whole by an agent clearing the tree. Nothing announced it to the person who had put it there, and nothing could bring it back.
And the loss arrives dressed as tidiness. What is removed looks like debris — stale, untidy, in the way — so the removal is reported as housekeeping rather than as a loss, and nobody present has reason to question it. The person who put the thing there learns of it later, from its absence. What makes something worth keeping is rarely visible in it, and an assessment made on appearance is precisely the judgement that is not available here.
"No way back" is literal here, which is what supplies the premise above. A committed change survives its own deletion, because the object was written and something still names it. An untracked file has no object at all — nothing in the repository ever held it, so it is in no reflog and no stash, and what removes it from the filesystem is the end of it. That asymmetry is why the rule reaches an untracked file at least as hard as a tracked one, where every instinct says the opposite.
Setting it aside instead
git stash -u is the preserving form of what those four do to the tree. It takes the
modifications and the untracked files together, leaves the tree clean for whatever needed it,
and gives them back.
git stash -u
<the operation that needed a clean tree>
git stash pop
-uis part of the command rather than an option to it. Without it the untracked files stay in the tree — which is the half a plain stash does not cover, and the half that has no other home.- Where the point was to move a ref, the stash is only half the answer.
git reset --hard <target>clears the tree and moves the branch, and a stash replaces the first of those alone. What replaces the second isgit rebase --onto <target> @, which moves the branch and
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл hoc-git-prohibit-destructive-commands?
The git commands this library does not run, because what they destroy cannot be given back — a modified file, an untracked note, an object no ref still names — and what is reached for instead. Use before any command that would clear the working tree, discard a change or delete an object, and whenever something else needs the tree clean before it can run. Destroying what the remote holds belongs to the git push convention.
Как установить скилл hoc-git-prohibit-destructive-commands?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hoc-git-prohibit-destructive-commands запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…