From sd0x-dev-flow
Safely removes plugin assets (skills, agents, rules, scripts, hooks) by detecting dependencies and cleaning up references. Invoke via /safe-remove for decluttering.
How this skill is triggered — by the user, by Claude, or both
Slash command
/sd0x-dev-flow:safe-removeThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Safely remove plugin assets by discovering dependencies, classifying impact, and executing removal with verification.
Safely remove plugin assets by discovering dependencies, classifying impact, and executing removal with verification.
/safe-remove <type> <name> [--execute] [--dry-run]
| Argument | Description | Default |
|---|---|---|
<type> | Asset type: skill, agent, rule, script, hook | Required |
<name> | Asset name (e.g., create-skill, strict-reviewer) | Required |
--execute | Apply removal (with AskUserQuestion confirmation) | off |
--dry-run | Output plan only (default behavior) | on |
If both
--dry-runand--executeare provided,--dry-runwins (safe default).
sequenceDiagram
participant U as User
participant S as /safe-remove
participant C as Codebase
S->>C: Phase 1: Resolve target files
S->>C: Phase 2: Build reference graph
S->>S: Phase 3: Classify (BLOCKER/PATCHABLE)
alt Has BLOCKER
S->>U: HALT — show blockers with file:line
else Dry-run (default)
S->>U: Output removal plan
else --execute
U->>S: AskUserQuestion approval
S->>C: Phase 4: Patch → Delete
S->>C: Phase 5: Verify
S->>U: Removal complete
end
Validate <type> and locate canonical files for the asset.
| Type | Primary Files | Secondary Files |
|---|---|---|
skill | skills/<name>/ (entire directory) | — |
agent | agents/<name>.md | — |
rule | rules/<name>.md | .claude/rules/<name>.md (mirror) |
script | scripts/<name>.* | — |
hook | Entry in hooks/hooks.json | Hook script file |
If target not found, output error: Target not found: <type> <name> and stop.
Scan the entire codebase for references to the target. Use type-specific patterns from references/removal-policy.md.
# Core scan — find all references
grep -rn "^skills:.*<name>" agents/ --include="*.md"
grep -rn "/<name>" CLAUDE.md .claude/CLAUDE.md CLAUDE.template.md
grep -rn "/<name>" README*.md
grep -rn "/<name>\|<name>" rules/ skills/ --include="*.md"
grep -rn "<name>" hooks/hooks.json
grep -rn "<name>" test/ --include="*.test.js"
Apply 2-tier classification per references/removal-policy.md:
| Tier | Definition | Action |
|---|---|---|
| BLOCKER | Structured runtime binding — removal breaks execution | HALT with file:line details |
| PATCHABLE | Prose/documentation reference — safe to auto-edit | Include in patch plan |
Requires AskUserQuestion confirmation before any changes.
Execution order (patches first, deletes last):
.claude/CLAUDE.md, CLAUDE.template.mdskill type: remove entire skills/<name>/ directory + test/skills/<name>*.test.jsscript type: remove scripts/<name>.* + test/scripts/<name>.test.jshook type: remove hook script + JSON entry + test/hooks/<name>.test.jsNote:
.claude/CLAUDE.mdmust be patched directly — do not rely on hook auto-sync for content removal.
Run type-specific verification from references/removal-policy.md:
# Verify no residual references (excluding archived docs)
grep -rn "^skills:.*<name>" agents/ --include="*.md"
grep -rn "/<name>" CLAUDE.md .claude/CLAUDE.md CLAUDE.template.md README*.md skills/ --include="*.md" | grep -v "archived/"
If residual references found, report them. If clean, output Verification passed.
## Safe Remove Plan: <type> <name>
### Target Files (to delete)
| File | Status |
|------|--------|
| skills/<name>/SKILL.md | DELETE |
| test/skills/<name>*.test.js | DELETE (if exists) |
### BLOCKER References (must resolve first)
| File:Line | Pattern | Why |
|-----------|---------|-----|
| agents/foo.md:3 | skills: <name> | Agent skills field |
### PATCHABLE References (auto-fix)
| File:Line | Current | Patch |
|-----------|---------|-------|
| CLAUDE.md:90 | \| /name \| desc \| | REMOVE ROW |
| README.md:308 | \| /name \| desc \| | REMOVE ROW |
### Verdict
- BLOCKER count: N → ⛔ HALT (resolve blockers first)
- BLOCKER count: 0, PATCHABLE count: M → ✅ Ready to execute
--execute flag + user confirmation| File | Purpose | When to Read |
|---|---|---|
references/removal-policy.md | BLOCKER/PATCHABLE classification rules + per-asset-type matrix | Always (Phase 2-5) |
/safe-remove skill create-skill
→ Dry-run plan showing skill dir + tests to delete + 12 PATCHABLE references
/safe-remove skill create-skill --execute
→ AskUserQuestion → patch 12 refs → delete skill dir + test/skills → verify clean
/safe-remove agent unused-agent
→ Dry-run: 1 file to delete, check for BLOCKER in agents skills: field
npx claudepluginhub sd0xdev/sd0x-dev-flow --plugin sd0x-dev-flowUninstalls community skills installed via the hub, with safety checks, confirmation, and audit logging. Refuses to remove first-party plugin skills.
Disables a skill by ID in the project configuration, removing its rules from the next AGENTS.md generation. Use to prune unused languages, frameworks, or conflicting rules.
Interviews the user, scans coding-agent log files, and recommends unused K-skills for removal. Supports Claude Code, Codex, OpenCode, OpenClaw, and Hermes Agent.