/project-toolkit:destructive-change-safetyfrom project-toolkit
Proves blast radius and recovery path before destructive operations (deletes, overwrites, drops, revocations). Scans for sinks, traces callers, previews scope, and blocks on unknown scope or missing rollback.
Ships in project-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Trace before mutate. Measure before delete. Recover before execute.
Owns one invariant: before a destructive operation runs or ships, the affected
scope and the recovery path are proven, not discovered after execution. It does
not replace security-scan, deployment tooling, migration tooling, or backups.
is this delete safe, blast radius, check this destructive change,
rollback plan for this change
A change can reach a sink that deletes rows, files, or resources, overwrites
canonical state, drops or truncates, force-pushes, or revokes credentials. The
scan decides: "decision": "skip" ends the skill. Read-only and pure changes
pay one scan and nothing more.
Each command below is a locator that runs destructive_gate.py. Output is
one JSON object.
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/destructive-change-safety/scripts/destructive_gate.py scan <dir-or-file> --base . --changed <edited-function> ...; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
Scan the whole package the change lives in, not only the edited file, so
callers and adapters are in the graph. Pass each edited function to
--changed.
| Field | Read it as |
|---|---|
chains | Call paths from entry points to the sink. The path through an adapter, config loader, or job is the indirect path. |
flags | CLI flags declared on functions along those chains, or on a function they call directly such as parse_args. A new flag is a new way to reach the sink. |
reached_from_changed | Non-empty means an edited function can reach this sink. Empty means the scan found no path, not that none exists. |
callers_unknown | True means the entry point lies outside the scan. Widen the scan or read the real callers by hand; the trace is not done. |
Decision unknown (exit 1) means a file did not parse (unparsed) or a source
file the scan cannot read went unscanned (unscanned): a language such as
PowerShell, JavaScript, C#, or Go, a CI or build definition (YAML, Makefile,
Dockerfile), or any file that starts with a shebang. Scope is unknown; do not treat it as skip.
Read each listed file by hand and record what you checked. A scope with no
readable file at all exits 2. The call graph matches by simple name and over-reports
on purpose. For callers outside the scanned set, follow the caller-reading
step of the review skill's technical-review reasoning protocol and cite the
call sites checked.
| Sink | Preflight |
|---|---|
| SQLite DELETE or UPDATE | preview-sql --database <file> --statement "<sql>" runs it on an in-memory copy. count is rows hit, total_changes includes cascades and triggers. |
| Files | preview-files --root <dir> --pattern "<glob>" lists what the glob selects (a matched directory counts every file beneath it), refuses patterns that leave the root, and ignores symlinks that do. |
| Other engine, remote resource | Use the system's own dry run, plan, or SELECT COUNT. Record the command and its real output. |
A preview that cannot run exits 1 with scope unknown. If the platform has no
safe preview, say so and treat scope as unknown. Do not estimate.
Choose one: backup, snapshot, version, or irreversible.
backup, snapshot, version: name the ref that restores it. The gate
checks what it can for each kind, and blocks when that check fails:
backup: give backup_path and source_path; the gate hashes both and
requires a match.snapshot: give snapshot_path and snapshot_target. The gate checks
the snapshot format contract below.version: ref must be a 40-hex commit id that git cat-file finds in
the repository. Any reachable commit passes.A version PASS means the commit exists. You still own the claim that it
restores the data the operation destroys.
irreversible: record the human approval. Per the AGENTS.md Autonomy
Guardrail (irreversible goes to a human), an agent never invents a rollback
or approves its own irreversible step. Law 2 in the
security-scan skill's agent-guardrails-template.md is the same boundary.
snapshot_path names either a snapshot manifest file or a directory that
contains snapshot.json. The manifest is a JSON object:
{
"format": "destructive-change-snapshot",
"version": 1,
"ref": "snap-2026-10-11",
"target": "sqlite:users",
"payload": "users.dump",
"sha256": "<SHA-256 of users.dump, 64 hex characters>"
}
The gate checks every field: format is destructive-change-snapshot,
version is 1, ref equals the rollback ref, target equals the
rollback snapshot_target, payload is a relative path to a file inside the
snapshot (and is not the manifest itself), and sha256 equals the payload
hash. The payload holds the recovery data: a dump, archive, or exported state.
A missing manifest, a mismatched recovery point or target, or a changed
payload blocks.
Run the tests and checks that cover the sink. Record each command and exit code from this run, not a prediction. Write the evidence file:
{
"sinks": [{"location": "<file>:<line>", "trace": ["main", "apply_removals", "remove_worktree"]}],
"preflight": {"command": "preview-sql ...", "exit_code": 0, "measured": 3},
"expected": 3,
"rollback": {"kind": "snapshot", "ref": "snap-id", "snapshot_path": "backups/snap-id", "snapshot_target": "sqlite:users"},
"approval": {"human": "required only when irreversible"},
"checks": [{"command": "pytest -q", "exit_code": 0}]
}
expected is the exact count, or an object with a max key. Then:
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/destructive-change-safety/scripts/destructive_gate.py gate --evidence <evidence.json> --scan <scan.json>; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
| Verdict | Exit | Meaning |
|---|---|---|
PASS | 0 | A --scan report covers every sink it found; evidence may declare more, and each declared sink is held to the same rules. Every sink traced, scope measured and as expected, rollback stated, checks green. Execution may proceed. |
SKIP | 0 | No sink declared, and a --scan report with "decision": "skip" backs it. |
BLOCK | 1 | reasons lists each failure. Fix the evidence, or stop. |
Every verdict needs --scan. The gate requires an evidence entry for every
scanned sink, so an agent cannot omit one, and it cannot declare one sink and
leave the rest unscanned. Without a scan report, or with one that has no known
decision, the gate blocks. A SKIP needs "decision": "skip"; an activate
report that lists no sink is inconsistent and blocks. Cardinality outside expected, a
missing or failed preflight, no rollback, an irreversible step without human
approval, or a failed check blocks. There is no override here; a break-glass
path is a repository policy decision outside this skill.
| Subcommand | Purpose | Exit codes |
|---|---|---|
scan | Sinks, caller chains, flags, forward trace | 0 ran, 1 unparsed or unscanned file, 2 bad path or no scannable file |
preview-files | Files a glob would touch | 0 counted, 1 refused |
preview-sql | Rows a SQLite DELETE or UPDATE would change | 0 counted, 1 refused |
gate | Fail-closed verdict over evidence | 0 PASS or SKIP, 1 BLOCK, 2 bad input |
The scripts are stdlib-only. Python sinks use ast; .sql and .sh files are
scanned by line.
skip or every sink traced.callers_unknown without a hand-read of the real callers.expected.PASS or SKIP at the final head, and the verdict is quoted in the PR body.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub rjmurillo/ai-agents --plugin project-toolkit105 skills in this plugin
/adr-generatorCreate comprehensive Architectural Decision Records (ADRs). Researches the destination directory to detect existing template conventions, gathers context, determines next ADR number, generates the ADR, validates completeness, and saves. Supports multiple ADR formats (MADR, Nygard, Alexandrian, project canonical). Use when documenting technical decisions, creating new ADR files, or capturing rationale so future readers can revisit a choice. Use when you say "write an ADR", "document this decision", "document these design choices", "record why we chose this", "capture the rationale", or "for future maintainers", or when creating an ADR-like markdown file under docs/decisions/, docs/adr/, docs/architecture/, architecture/decisions/, or .project-toolkit/architecture/. Do NOT use to debate or review an existing ADR (use adr-review)./adr-reviewMulti-agent debate orchestration for Architecture Decision Records. Automatically triggers on ADR create/edit/delete. Coordinates architect, critic, independent-thinker, security, analyst, and high-level-advisor agents in structured debate rounds until consensus. Use when you say "review this ADR", when an ADR is created/edited/deleted, or when reviewing, accepting, or updating a decision file under .project-toolkit/architecture/, docs/architecture/, docs/decisions/, docs/adr/, or architecture/decisions/, including intent like "review this decision record" or "check this rationale for future maintainers". Do NOT use to author a new ADR (use adr-generator).2 plugins in one repository ship this exact skill · first indexed Nov 13, 2026
Other plugins' skills for the same job