Safely decommission, sunset, or remove a deprecated feature, flow, bounded context, persona, or product — the subtractive counterpart to /implement-flow and the reverse mirror of the Inception -> Specs -> Code lifecycle. USE THIS SKILL when the user mentions: decommission, sunset feature, remove deprecated feature, delete feature, retire flow, retire product, retire persona, clean up dead feature, remove legacy flow, or tear down a module. Traces blast radius top-down (from Inception or Flows...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Decommission?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/faparicior-decommission)
---
name: decommission
description: >-
Safely decommission, sunset, or remove a deprecated feature, flow, bounded context, persona, or product —
the subtractive counterpart to /implement-flow and the reverse mirror of the Inception -> Specs -> Code lifecycle.
USE THIS SKILL when the user mentions: decommission, sunset feature, remove deprecated feature, delete feature,
retire flow, retire product, retire persona, clean up dead feature, remove legacy flow, or tear down a module.
Traces blast radius top-down (from Inception or Flows down to code to catch shared-path traps), executes
outside-in compile-safe deletions in two checkpoints with per-layer commits and pin tests (no test-first TDD ritual),
verifies via compiler + existing tests + ArchUnit + leftover grep checklist, and closes documentation bottom-up
from living specs back to Inception.
disable-model-invocation: true
---
# PROTOCOL: DECOMMISSION (EXECUTION LEVEL 3)
<state_machine>
CURRENT_STEP -> REQUIRED_TOOL -> REQUIRED_OUTPUT -> MANDATORY_HALT
STEP_00: Discover -> grep / find / read_file -> Repo conventions, real build/test/arch cmds, docs map -> Continue to STEP_00B
STEP_00B: Triage -> evaluate 3 tiers (Light / Standard / Full) -> Tier & entry level decision (Code / Flow / Inception) -> Continue to STEP_01 (or Light fast-path if user confirms)
STEP_01: Blast Radius -> grep / read_file (top-down: Inception/Specs->Code) -> Exclusive vs. Shared map, removal traps, fixtures, data -> Continue to STEP_02 (or STEP_03 if adopting approved proposal)
STEP_02: Propose -> read_file(templates/decommission-proposal.md) -> working-on/active/[change]/proposal.md -> 🛑 HALT TURN (Wait for user approval & open questions)
STEP_03: Plan -> read_file(templates/decommission-plan.md) -> working-on/active/[change]/decommission-plan.md -> 🛑 HALT TURN (Wait for user plan approval)
STEP_04: Checkpoint A (Code) -> edit_file / run_command / git commit -> Pin tests + outside-in deletions (1 commit/layer) + green -> 🛑 HALT TURN (Present Checkpoint A summary & commits)
STEP_05: Checkpoint B (Docs) -> grep / edit_file / mv (active -> grace-period) -> Leftover grep (0 leaks) + bottom-up docs + grace-period -> 🛑 HALT TURN (Final PR-ready verification report)
</state_machine>
<execution_invariants>
1. WORKFLOW IMMUTABILITY: You may reason freely INSIDE each step to hunt for shared paths, silent drops, fixtures, and stale docs, but you are strictly forbidden from skipping, merging, or reordering steps (`workflow structure = immutable | step reasoning = flexible`).
2. STOP GATES ARE ABSOLUTE (WITH LIGHT-TIER / EXPLICIT BATCH OVERRIDE):
- In `Standard` and `Full` tiers, you MUST stop after `STEP_02` (Proposal), `STEP_03` (Plan), `STEP_04` (Checkpoint A), and `STEP_05` (Checkpoint B) — unless the user explicitly requested unattended/batch execution or confirmed `Light` tier in `STEP_00B`.
- Do NOT stop after every individual code layer inside `STEP_04`: Checkpoint A executes Layers 0–4 continuously with separate commits per layer and halts ONCE at the end of Checkpoint A.
3. SUBTRACTIVE SAFETY MODEL (NO ADDITIVE TDD RITUAL): Never force "write a failing test first" or inside-out (domain-first) deletion. The real safety nets for decommissioning are:
- **Pin tests** (characterization tests protecting surviving shared paths) + **seeding fixture swaps** in Layer 0,
- **Outside-in compile order** (`fixtures -> interfaces -> infrastructure -> application -> domain`),
- **Compiler + existing test suite + ArchUnit/lint** staying green at compile boundaries,
- **Leftover grep checklist** in Checkpoint B.
4. TEMPLATE LOCK: Reconstructing template headers or tables from memory is strictly forbidden. You MUST call `read_file` on `templates/decommission-proposal.md` before `STEP_02` (unless adopting an existing approved `proposal.md`) and `read_file` on `templates/decommission-plan.md` before `STEP_03`.
5. LIVING DOCS DESCRIBE SHIPPED CODE ONLY: Never edit `docs/product/bounded-contexts/` or `docs/inception/` before Checkpoint A (`STEP_04`) is green. Update living docs strictly bottom-up in Checkpoint B (`STEP_05`), and NEVER rewrite frozen historical Inception artifacts (`4-empathy-map.md`, `6-brainstorming.md`, `8-mvp-canvas.md`).
6. DEFERRED ITEMS LOCK: When decommissioning closes a `scheduled-cleanups/` item, delete its file and remove its row from `deferred/README.md` in Checkpoint B (zero `✅ Resolved` zombies). If post-deploy follow-ups remain (e.g. deferred DB table drop after a retention window), record them using `../guidelines/templates/deferred/scheduled-cleanup.md` via `read_file` (or `/defer-item`).
7. ESCAPE HATCH: If the situation does not fit the contract, do not silently improvise and do not force-fit: declare the deviation in one line and ask.
</execution_invariants>
<output_contract>
- PROPOSAL ARTIFACT (`STEP_02`, unless adopting an existing approved `proposal.md`):
- TARGET_PATH: `docs/product/working-on/active/[change-name]/proposal.md` (honouring `.sdlc/config.json` overrides)
- SOURCE_TEMPLATE: `templates/decommission-proposal.md` (MUST call `read_file` first)
- SCHEMA_INVARIANCE: Preserve all metadata bullets and numbered sections (`## 1. Decommissioning Rationale` through `## 7. Open Questions` + `## 🔗 Related Documentation`) and exact Markdown table schemas verbatim.
- PLAN ARTIFACT (`STEP_03`):
- TARGET_PATH: `docs/product/working-on/active/[change-name]/decommission-plan.md`
- SOURCE_TEMPLATE: `templates/decommission-plan.md` (MUST call `read_file` first)
- SCHEMA_INVARIANCE: Preserve `### Resolved Open Questions`, `## 0. Cross-Repo Dependencies`, `## 1. Pre-Decommission Safety Checklist`, `## 2. Checkpoint A — Code & Test Removal (Outside-In, Compile-Safe)` (Layers 0–4 + Verification Gate), `## 3. Checkpoint B — Leftover Grep, Bottom-Up Docs & Closure` (3.1–3.3), `## 4. Rollout & Post-Deploy Cleanup Notes`, and `## 🔗 Related Documentation` verbatim.
- ESCAPE_HATCH: Never silently omit or invent template sections or layers. If a layer or section genuinely does not apply (e.g., `Layer 4: Domain` when removing only an unused HTTP endpoint, or `2.1 Discovery & Inception Impact` when the repo has no `docs/inception/`), preserve the heading and write `"N/A — [1-line rationale]"`, or halt and ask the user before deviating.
</output_contract>
---
## 🔄 The Reverse SDLC Model
Decommissioning mirrors the forward SDLC in reverse — **Top-Down to discover traps, Outside-In to delete safely, Bottom-Up to close docs**:
```mermaid
flowchart TD
A["STEP_00 / 00B: Discover & Triage<br/>(Light / Standard / Full)"] --> B["STEP_01: Top-Down Blast Radius<br/>(Inception / Specs -> Code: Exclusive vs Shared)"]
B --> C["STEP_02: Proposal<br/>(proposal.md — or adopt existing)"]
C --> G1{{"🛑 HALT 1: Approve Proposal<br/>& Resolve Open Questions"}}
G1 --> D["STEP_03: Decommission Plan<br/>(decommission-plan.md)"]
D --> G2{{"🛑 HALT 2: Approve Plan"}}
G2 --> E["STEP_04: Checkpoint A — Code Removal<br/>(Pin Tests & Fixtures -> Interfaces -> Infra -> App -> Domain)<br/>1 commit/layer + Full Build/Tests/ArchUnit"]
E --> G3{{"🛑 HALT 3: Review Checkpoint A"}}
G3 --> F["STEP_05: Checkpoint B — Closure<br/>(Leftover Grep -> Living Specs -> ADRs -> Inception -> grace-period/)"]
F --> G4{{"🛑 HALT 4: Final PR-Ready Report"}}
```
---
## STEP_00 — Discover This Repo's Conventions
- **INPUT:** Target workspace and `.sdlc/config.json` (if present, honour its `docsRoot`, `productDocsDir`, `adrDir`, and `inceptionDir` overrides; defaults are `docs/product/`, `docs/adr/`, and `docs/inception/`).
- **ACTION:** Discover from real files (never assume):
1. **Docs layout:** Check whether `docs/inception/`, `docs/product/bounded-contexts/`, `docs/adr/`, and `docs/product/working-on/active/` exist. Check if an approved `proposal.md` already exists for this decommission (e.g. created earlier via `/modify-flow`).
2. **Language & layering:** Identify source layout and dependency direction (e.g. `interfaces -> infrastructure -> application -> domain` or feature modules).
3. **Real verification commands:** Read `AGENTS.md`, `CLAUDE.md`, `README.md`, or build config (`build.gradle`, `package.json`, `pom.xml`, `Makefile`) for exact **compile/build**, **unit test**, **integration test**, **architecture test (e.g. ArchUnit)**, and **lint/typecheck** commands.
4. **Cross-repo dependencies & feature flags:** Check `AGENTS.md` / `CLAUDE.md` for cross-repo consumers and flag systems.
- **PASS CONDITION:** All 4 dimensions verified from real files.
---
## STEP_00B — Triage Tier & Entry Level
Evaluate these 4 criteria:
1. Does the retired code share any class, read path, client, template builder, event listener, or test fixture with surviving features?
2. Does it touch living domain specs (`flows/`, `entities/`, `BR-*`, `INV-*`), ADRs, DB schemas/queues, or another repository?
3. Does it retire a **product, bounded context, journey, or persona** documented in `docs/inception/` (or PRD / Story Mapping)?
4. Are there open product/data-retention questions or an audit trail requirement (e.g. ticket + formal decisions)?
| Tier | Trigger Condition | Entry Level | Mandatory Execution Path |
| :--- | :--- | :--- | :--- |
| **Light** | **All 4 answers are strictly "no"** (pure isolated dead code / unused feature with no shared paths or doc impact) **AND the user confirms Light tier** | Code | Skip `proposal.md` and `decommission-plan.md`. Write a concise PR change note + **Leftover Grep Checklist** (the 8 categories in `templates/decommission-plan.md` Section 3.1), delete outside-in, run build/unit/integration/ArchUnit/lint, and stop. |
| **Standard** *(Default)* | Feature or flow decommission with shared paths, fixtures, living docs, data/infra cleanup, or audit trail | Flow / Feature | Execute `STEP_01 -> STEP_05` in full (reusing an existing approved `proposal.md` if one already exists in `working-on/active/[change]/`). |
| **Full** | Product, module, bounded context, or persona ceases to exist | Inception / Product | Execute `STEP_01 -> STEP_05` starting from `docs/inception/` (Vision `DOES -> DOES NOT`, Personas, Journeys, Features) down to code, and closing bottom-up back to `docs/inception/` and ADRs. |
- **DO NOT:** Silently self-select `Light` tier. If uncertain about shared paths or doc impact, default to `Standard`.
---
## STEP_01 — Top-Down Blast Radius & Removal Trap Hunt
Trace **from the highest affected level downward (`⬇️`)** to separate **Exclusive** artifacts (safe to delete/retire) from **Shared** artifacts (traps that must be pinned or pruned carefully):
1. **Discovery / Inception layer (`Full` tier or when `docs/inception/` references the target):**
- Inspect `1-product-vision-and-boundaries.md` (`IS` / `DOES`), `3-personas/`, `5-user-journeys/`, and `7-features-and-sequencing.md`.
- Classify each hit as **Living Reference (Bucket A — update in Checkpoint B)** vs. **Frozen Historical Record (Bucket B — `4-empathy-map.md`, `6-brainstorming.md`, `8-mvp-canvas.md` — do NOT rewrite)**.
2. **Specification & Architecture layer:**
- Read affected `flows/`, `entities/`, `value-objects/`, `domain-services/`, `BR-*`, `INV-*`, and `docs/adr/`.
- Use [../guidelines/traceability.md](../guidelines/traceability.md) (`Traces up to`, `Enforces`, `Enforced by`, `Verified by`) to check whether any `BR-*`, `INV-*`, entity, or domain service is still referenced by **another surviving flow or bounded context**.
3. **Code & Shared-Path Trap Hunt (Code is Truth):**
- Grep every symbol, route, event, queue, config key, and feature flag across the entire codebase.
- Explicitly hunt for the classic deletion traps:
- **Shared read paths** (another feature still reads data or consent written/managed here),
- **Shared infrastructure** (shared HTTP/Feign clients, email/notification builders, serializers, DTOs),
- **Silent drops / event consumers** (removing a handler or branch that silently drops or dead-letters live messages),
- **Coupled test fixtures / seeding** (unrelated integration tests that seed data through the retired feature).
4. **Data, Ops & Cross-Repo Audit:**
- Identify DB tables/columns, migrations, queues/topics, crons, feature flags, metrics/alerts, and external repos that call or produce for the retired capability.
- **PASS CONDITION:** Complete map of Exclusive vs. Shared artifacts, removal traps, outside-in file list, and any open questions.
---
## STEP_02 — Write the Decommissioning Proposal (`OUTPUT CONTRACT`)
*(If an approved `proposal.md` for this decommission already exists in `docs/product/working-on/active/[change-name]/`, re-ground it against `HEAD`, verify Sections 2–6 cover shared-path traps and outside-in scope, and proceed directly to `STEP_03`.)*
1. **MANDATORY TOOL CALL:** Call `read_file` on `templates/decommission-proposal.md`.
2. Write `docs/product/working-on/active/[change-name]/proposal.md` preserving 100% of template headings and table schemas verbatim (use `"N/A — [1-line rationale]"` for non-applicable sections).
3. Record all unresolved product, data-retention, or silent-drop questions in **Section 7 (Open Questions)** — never decide them unilaterally.
4. **🛑 HALT TURN (HARD GATE 1):** Present `proposal.md` with clickable file links, highlight the discovered shared-path traps (Section 3), and wait for user approval and answers to Section 7 before creating the plan.
---
## STEP_03 — Write the Decommission Plan (`OUTPUT CONTRACT`)
Execute **only after** `proposal.md` is approved and blocking Open Questions are resolved.
1. **MANDATORY TOOL CALL:** Call `read_file` on `templates/decommission-plan.md`.
2. Write `docs/product/working-on/active/[change-name]/decommission-plan.md` preserving all headings, the 2-checkpoint structure (`Checkpoint A` with Layers 0–4 + `Checkpoint B` with Leftover Grep & Bottom-Up Docs), and real commands from `STEP_00`.
3. **🛑 HALT TURN (HARD GATE 2):** Present `decommission-plan.md` for user approval before modifying any code or tests.
---
## STEP_04 — Checkpoint A: Code & Test Removal (Outside-In, 1 Commit per Layer)
Execute **only after** user approval at `HARD GATE 2`.
1. **Layer 0 — Pin Tests & Seeding Fixture Swap:**
- Write characterization / pin tests for every surviving shared path in `proposal.md` Section 3 (these tests must **PASS** against current code before deletion begins).
- Decouple or swap any seeding fixtures used by unrelated tests.
- Run unit tests to verify green, then make a dedicated commit (e.g. `test(<scope>): pin surviving paths and decouple fixtures`).
2. **Layers 1 → 4 — Outside-In Compile-Safe Deletion:**
- Delete/prune in strict reverse dependency order matching this codebase:
- **Layer 1:** Interfaces / Entrypoints (controllers, listeners, routes, boundary DTOs) → compile/unit check → **commit**.
- **Layer 2:** Infrastructure (repositories, external clients, config, flags, builders) → compile/unit check → **commit**.
- **Layer 3:** Application (use cases, handlers, sagas, mappers) → compile/unit check → **commit**.
- **Layer 4:** Domain (entities, value objects, domain services, events, rules) → compile/unit check → **commit**.
- Skip any layer marked `N/A` in the plan.
- Check off (`[x]`) completed tasks in `decommission-plan.md`.
3. **Checkpoint A Full Verification:**
- Run the repo's **full build, unit test, integration test, architecture test (e.g. ArchUnit), and lint/typecheck** suites.
- Confirm `git log --oneline` shows clean, bisectable per-layer commits.
4. **🛑 HALT TURN (HARD GATE 3 — CHECKPOINT A COMPLETE):** Report the per-layer commit list, test/ArchUnit results, and any unexpected findings. Wait for user confirmation before Checkpoint B (unless the user explicitly requested unattended execution of both checkpoints).
---
## STEP_05 — Checkpoint B: Leftover Grep, Bottom-Up Docs & Closure
Execute **only after** Checkpoint A is green and confirmed.
1. **Execute Leftover Grep Checklist (`decommission-plan.md` Section 3.1):**
- Run project-wide `grep` across **all 8 categories** (symbols/packages, feature flags/config, env vars, routes/topics/queues, metrics/alerts, i18n/email keys, test fixtures/mocks, DB migrations/tables).
- Remove every unintentional remnant (re-running build/tests if code changed) and record exact counts and dispositions in Section 3.1.
2. **Close Documentation Strictly Bottom-Up (`decommission-plan.md` Section 3.2):**
- **Level 1 — Living Bounded-Context Specs (`bounded-contexts/`):**
- **Exclusive artifacts with zero live code (`flows/`, `entities/`, `domain-services/`, `BR-*`, `INV-*`):** **Delete the file** (`rm`) and remove every reference from indexes and reciprocal links. Do **not** leave "Deprecated / Decommissioned" zombie files inside `bounded-contexts/` (living docs describe currently shipped code only; history lives in git, the archived `proposal.md`, and ADRs). **Never reuse a retired ID** — optionally add a single 1-line tombstone row in a `Retired IDs` table at the bottom of the folder's `README.md` index (e.g. `| BR-014 | YYYY-MM-DD | Retired / Superseded by ... (#PR) |`).
- **Shared docs:** Prune references to the retired flow/rule, update `Enforced by` / `Verified by`, and promote relevant audit-trail decisions (e.g. D9) into the surviving doc's *History & Evolution* or an ADR.
- **Level 2 — Architecture (`docs/adr/`):**
- ADRs are an append-only decision log — **never delete** them. If an ADR governed only the retired capability, amend it non-destructively (via `/adr-amend` or status `Deprecated` / `Superseded` with date and decision link).
- **Level 3 — Discovery & Inception (`docs/inception/`, `Full` tier or when impacted):**
- **Living Reference Docs (Bucket A):**
- `1-product-vision-and-boundaries.md`: move retired items from `DOES` to `DOES NOT` with date.
- `3-personas/`, `5-user-journeys/`, & `7-features-and-sequencing.md`: delete exclusive retired persona/journey files (removing index links) or prune retired steps/features from shared docs.
- **Frozen Historical Docs (Bucket B — `4-empathy-map.md`, `6-brainstorming.md`, `8-mvp-canvas.md`):** Do **not** rewrite history; leave untouched (only add a 1-line retirement banner at the top if an entire product was sunset).
3. **Mechanical Traceability & Link Verification:**
- Run `audit-docs/scripts/check-links.sh <docs-root>` and `audit-docs/scripts/check-reciprocity.sh <docs-root>` (if available, or manual `test -e` / `grep` on retired IDs) and confirm **0 broken links** and **0 dangling/half-edges**.
4. **Close Working-On Lifecycle:**
- Update `proposal.md` status to `🚀 Decommissioned (Grace Period)` + `Shipped Date`, and `decommission-plan.md` status to `✅ Complete`.
- Move the change folder out of `active/`:
```bash
mv docs/product/working-on/active/[change-name] docs/product/working-on/grace-period/
```
- Commit Checkpoint B cleanly (`docs(<scope>): close decommission docs and traceability`).
5. **🛑 HALT TURN (HARD GATE 4 — FINAL REPORT):** Present the final PR-ready summary (commits from Checkpoint A & B, leftover grep results, docs closed bottom-up, verification commands passed, and any deferred post-deploy rollout items from Section 4).
---
<self_validation_gate>
Before ending your turn, verify every applicable item below with concrete evidence (not just a checkmark). If any item for your current stage cannot be cited with real evidence from this turn, DO NOT end your turn — return to the failed step and fix the violation first:
- [ ] **Triage & Blast-Radius Evidence (`STEP_00B` / `STEP_01`):** State selected Tier (`Light` / `Standard` / `Full`), entry level (`Code` / `Flow` / `Inception`), and real files/shared-path traps verified via `grep`/`read_file`: `<tier, entry level & traps>`
- [ ] **Template Read Evidence (`STEP_02` / `STEP_03`):** Exact `templates/*.md` path passed to `read_file` before writing (`templates/decommission-proposal.md` or `templates/decommission-plan.md`, or adopted proposal path): `<path>`
- [ ] **Schema & Escape-Hatch Evidence (`STEP_02` / `STEP_03`):** Exact artifact path written with 100% of template headings preserved (listing any `"N/A — [rationale]"` sections/layers): `<path & status>`
- [ ] **Checkpoint A Evidence (`STEP_04`):** Exact per-layer commit SHAs/messages (Layers 0–4), pin tests run before deletion, and full build/unit/integration/ArchUnit/lint commands with exit code `0`: `<commits & commands>`
- [ ] **Checkpoint B Evidence (`STEP_05`):** Leftover grep counts across all 8 categories (`0 unintentional leaks`), exact docs updated bottom-up (`bounded-contexts/`, `adr/`, `inception/`), link/reciprocity check output (`0 broken / 0 half-edges`), and `grace-period/` move confirmation: `<evidence>`
- [ ] **Halt Gate Evidence:** Confirm turn stops at the active `🛑 HALT TURN` gate (or cite explicit user batch/Light-tier override): `<gate>`
</self_validation_gate>