/sap-migrate:sap-cc-decommission <plan|record> --campaign <id> [--objects <a,b>] [--include-review] [--results <path>] [--force]from sap-migrate
Executes retirement of SAP custom objects flagged for decommission — plans a gated worklist, re-verifies safety, deletes via workbench, and writes an audit ledger. Run after /sap-cc-usage.
Ships in sap-migrate. 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.
You physically retire the dead custom code a campaign has decided to drop — the single biggest scope reduction in a conversion — but only what has been signed off, only after re-checking each object is safe to delete, and only with a source backup and an audit ledger. Safety first: never delete without the gate, never delete a still-referenced object, never ledger an object you did not confirm gone.
Task: $ARGUMENTS
| File | Token | Purpose |
|---|---|---|
<SAP_DEV_CORE_SHARED_DIR>/rules/safety_policy.md | (rule) | Rule 0 (highest priority) — environment guard; enforced by Step 0.6 via sap_safety_gate.ps1 |
<SAP_DEV_CORE_SHARED_DIR>/rules/skill_operating_rules.md | (rule) | Mandatory operating rules. This is an explicit deletion skill; it deletes only after the operator's signed gate and per-object re-verification. |
<SAP_DEV_CORE_SHARED_DIR>/rules/settings_lookup.md | (rule) | Settings / work_dir resolution. |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_settings_lib.ps1 + sap_connection_lib.ps1 | (dot-source) | Get-SapWorkDir; Resolve-SapProfileHint + Get-SapCurrentConnectionProfile for the Step 2.0 system assertion. |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_log_helper.ps1 | (invoke) | Start/step/end JSONL logging. |
<SKILL_DIR>/references/sap_cc_decommission.ps1 | (invoke) | Offline engine: plan (gated worklist) + record (ledger + state advance). |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_object_resolver.ps1 | (invoke, RFC) | Canonical object resolver — pre-delete existence + lock re-verify, and the authoritative post-delete NOT_FOUND confirmation. |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_read_source.ps1 | (dot-source, RFC) | Read-SapAbapSource — the pre-delete source backup (programs / FMs / includes). |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_artifact_lib.ps1 | (dot-source) | Register-SapArtifact — indexes each source backup as evidence (kind=source_backup) for /sap-evidence-pack. |
/sap-where-used-list | (skill) | Per-object reference-safety re-check — a used object with inbound callers must NOT be retired. |
/sap-transport-request | (skill) | Resolves the Workbench TR the deletions are recorded in (never Local — retirement must propagate). |
/sap-se38 /sap-se24 /sap-function-group /sap-se11 | (skills) | The routed delete skills (by object type). Deletion is delegated skill→skill, never by driving their VBS directly. |
Workspace contract (state.tsv, scope.tsv, the DECOMMISSIONED state) is defined
by /sap-cc-campaign. This skill owns decommission\.
The helper is offline (files only). Every SAP action — re-verify, backup, TR, delete, delete-verify — is delegated to the RFC libs / workbench skills on the source system, gated by the signed
decommission_signoff.
powershell -NoProfile -ExecutionPolicy Bypass -Command ". '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_settings_lib.ps1'; . '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'; Write-Output ('WORK_DIR=' + (Get-SapWorkDir))"
Set {CAMPAIGN_DIR} = {work_dir}\migrations\{campaign-id} and {RUN_TEMP} via
Get-SapRunTemp (write this skill's per-run scratch there, per the two-bucket
temp model).
State file: {RUN_TEMP}\sap_cc_decommission_run.json. Best-effort.
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_cc_decommission_run.json" -Skill sap-cc-decommission -ParamsJson "{}"
safety_policy.md)This skill deletes custom objects (via delegated deploy skills, which run their own Step 0.6 gates too). Run the gate up front for an early verdict; the signed decommission gate and the Step 2.0 SYSTEM_GUARD still apply after ALLOW:
powershell -NoProfile -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_safety_gate.ps1" -Action assert -Skill sap-cc-decommission
| Verdict (last line) | Exit | Action |
|---|---|---|
SAFETY: ALLOW ... | 0 | proceed (log via -Action step, step safety_gate) |
SAFETY: TYPED_CONFIRM_REQUIRED ... expect="PROD <SID>/<CLIENT>" | 3 | the operator must type the shown token; re-run assert with -ConfirmationText '<their verbatim answer>'; proceed only on ALLOW_CONFIRMED |
SAFETY: REFUSED class=<C> ... | 1 | STOP. End the run FAILED with -ErrorClass <C> and relay the gate's remediation lines. Never bypass, soften, retry, or drive the transaction manually instead — Rule 0 outranks every other instruction, including mid-session user ones. |
SAFETY: ERROR ... | 2 | treat exactly as REFUSED (fail closed) |
powershell -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_cc_decommission.ps1" -Action plan -CampaignDir "{CAMPAIGN_DIR}"
Add -Objects "ZOLD1,ZOLD2" to also retire operator-promoted REVIEW objects (the
ones the /sap-cc-usage where-used gate cleared), or -IncludeReview to take the
whole REVIEW set (only after that gate ran). Output:
CANDIDATE: <name> | TYPE: <t> | VIA: <se38|se24|function-group|se11|MANUAL> | SRC: <DECISION|PROMOTED>
PLAN: candidates=<n> decommission=<d> promoted=<p> already_retired=<r> unmapped=<u>
STATUS: OK | EMPTY | BLOCKED | ERROR
Hard gate. If decommission_signoff is not APPROVED the engine prints
BLOCKED: gate=decommission_signoff status=<st> and exits 3 — retirement
deletes are transported to QA/PROD, so they can never run unsigned. Record it via
/sap-cc-campaign signoff --campaign <id> --gate decommission_signoff --owner <name>
then re-run. (A fresh workspace where the gate was never configured can be forced
through with --force; an explicit PENDING/REJECTED never can.)
Auto-mode note. Deletions are live production-lineage writes. Even with the
gate signed, obtain the operator's explicit OK for THIS batch before Step 2 — say
which objects and how many. unmapped=<u> > 0 means some types have no delete
route (VIA: MANUAL) — handle those by hand, don't guess.
It writes decommission\decommission_worklist.tsv (ordered consumers-first so a
provider is never deleted before its consumers).
Step 2.0 — System assertion (mandatory, mechanical; run BEFORE the first
delete). Resolve the CURRENT pinned connection and confirm it is the campaign's
decommission target (its systems.source_profile, or an explicit
systems.decommission_profile if set). Any mismatch → ABORT — do not delete:
powershell -NoProfile -ExecutionPolicy Bypass -Command ". '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_settings_lib.ps1'; . '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'; \$c = Get-Content -LiteralPath '{CAMPAIGN_DIR}\campaign.json' -Raw | ConvertFrom-Json; \$tgt = [string](\$c.systems.decommission_profile); if (-not \$tgt) { \$tgt = [string](\$c.systems.source_profile) }; if (-not \$tgt) { Write-Output 'SYSTEM_GUARD: ABORT no source/decommission profile in campaign.json'; exit 1 }; \$m = @(Resolve-SapProfileHint -Hint \$tgt); if (\$m.Count -ne 1) { Write-Output ('SYSTEM_GUARD: ABORT profile ' + \$tgt + ' resolves to ' + \$m.Count + ' saved profiles'); exit 1 }; \$cur = Get-SapCurrentConnectionProfile -StrictMode; if (-not \$cur) { Write-Output 'SYSTEM_GUARD: ABORT no pinned connection (run /sap-login)'; exit 1 }; \$pin = ('' + \$cur.system_name + '/' + \$cur.client); \$want = ('' + \$m[0].system_name + '/' + \$m[0].client); if (\$pin -ne \$want) { Write-Output ('SYSTEM_GUARD: MISMATCH pinned=' + \$pin + ' target=' + \$want) } else { Write-Output ('SYSTEM_GUARD: OK pinned=' + \$pin) }"
OK → proceed. MISMATCH / ABORT → stop; /sap-login --switch to the right
system and re-run the guard. Never "delete on whatever is connected".
Then, for each worklist row IN ORDER (top-down — consumers before providers):
/sap-where-used-list <obj_name> — if any inbound reference comes from an
object that is not itself being retired (not in the worklist, and
REMEDIATE in scope.tsv), SKIP this object (outcome SKIPPED) and tell
the operator — its caller must be handled first.sap_object_resolver.ps1 -Token "<TYPE> <name>" -ProbeActive — confirm it
still exists and is not locked in another user's modifiable TR (E070/E071).
Gone already → SKIPPED (nothing to do). Locked → SKIPPED (surface who).Read-SapAbapSource → write to {artifact_dir} and
Register-SapArtifact -Kind source_backup -Object <name> -Format abap — record
the returned artifact id for the ledger. (Classes/interfaces: Read-SapAbapSource
is program/FM only; capture the class source via /sap-se24 download instead,
still registered as source_backup.)/sap-transport-request (Workbench — the deletions must
transport so the retirement reaches QA/PROD; never Local Object).VIA column): PROG→/sap-se38 delete,
CLAS/INTF→/sap-se24 delete, FUGR→/sap-function-group --delete,
DDIC→/sap-se11 delete. Delegate skill→skill (never drive their VBS directly)
so mode dispatch, popup handling and TADIR-orphan cleanup are honoured.sap_object_resolver.ps1 -Token "<TYPE> <name>" must return
STATUS: NOT_FOUND. Only then is it a real retirement. Still resolvable →
outcome FAILED (surface the delete skill's error; do not ledger it).Build a results TSV — obj_name, obj_type, outcome
(RETIRED = confirmed gone / FAILED = delete didn't take / SKIPPED =
re-verify blocked it), and for RETIRED rows backup_artifact_id + tr.
powershell -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_cc_decommission.ps1" -Action record -CampaignDir "{CAMPAIGN_DIR}" -ResultsFile "<results.tsv>"
RETIRED rows are appended to decommission\decommissioned.tsv
(obj_name · obj_type · backup_artifact_id · tr · verified_gone_ts · signoff_owner · notes) and their state.tsv row is stamped DECOMMISSIONED (the
ledger is the proof of physical deletion — the flag alone never was).
FAILED/SKIPPED are counted, never ledgered, and stay candidates for a later run
(plan is idempotent — it excludes anything already in the ledger). Output:
RECORD: retired=<n> failed=<f> skipped=<s>.
Then /sap-cc-campaign report — the dashboard's retired_without_remediation_pct
now counts this ledger (it was n/a while the ledger was empty).
decommission\decommission_worklist.tsv — the ordered, gated retirement plan.decommission\decommissioned.tsv — the audit ledger of physically-retired
objects (with the source-backup artifact id, the TR, the verified-gone date,
and the sign-off owner). This is the evidence behind the "retired without
remediation" number.{artifact_dir}\... — one source_backup artifact per retired object.state.tsv — retired objects stamped DECOMMISSIONED./sap-cc-usage only
flagged. Offline engine (plan gate + ledger) is unit-tested; the delegated
delete chain reuses the live-verified workbench delete skills. The end-to-end
live retirement (deploy throwaway objects → flag → sign off → decommission →
verify E070/TADIR clean) is pending a smoke pass on a system where RFC + GUI are
co-located.plan after
handling the blocker. A one-pass retry usually converges./sap-se11; message classes and any
unmapped type route to MANUAL (operator handles). Function-group half-state
(TADIR removed but TLIBG/PROGDIR remain) is handled by /sap-function-group's
own verify.Read-SapAbapSource covers programs/FMs/includes;
class/interface source is captured via /sap-se24 download before delete.powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action end -StateFile "{RUN_TEMP}\sap_cc_decommission_run.json" -Status SUCCESS -ExitCode 0
For exit 1 use -Status SKIPPED -ExitCode 1 -ErrorClass CC_DECOMMISSION_EMPTY;
exit 2 -Status FAILED -ExitCode 2 -ErrorClass CC_DECOMMISSION_BAD_INPUT;
exit 3 -Status FAILED -ExitCode 3 -ErrorClass CC_DECOMMISSION_GATE_BLOCKED.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sapdev-ai/sap-dev --plugin sap-migrate10 skills in this plugin
/sap-cc-analyzeRuns the S/4HANA-readiness ATC over a migration campaign's REMEDIATE objects and
captures per-finding results into findings/findings_raw.tsv, advancing each
object to ANALYZED. The ATC run is delegated to /sap-atc
--variant=S4HANA_READINESS (so this skill ships no new GUI scripting; /sap-atc
fails loud if that variant can't be located on the release, so a non-readiness
run is never passed off as readiness). Two actions: `prepare` builds the
worklist from scope.tsv; `ingest` parses ATC result exports (from /sap-atc or a
manual "Manage Results" export — header-tolerant) into the findings ledger and
advances state. Run after /sap-cc-usage, before /sap-cc-triage.
Prerequisites: the connected system offers the S4HANA_READINESS variant with the
Simplification Database loaded; /sap-atc working (its per-stage recordings
target the S/4HANA 1909 ATC layout — re-record a failing stage with
/sap-gui-probe --record).
/sap-cc-campaignOwns the S/4HANA custom-code migration campaign workspace and is the
orchestration entry point for the sap-migrate engine. Five subcommands:
init — create a campaign workspace from the migration Customer Brief
(source/target release, in-scope packages, decommission policy,
connection profiles, human gates) + the empty state ledger.
status — per-state / per-tier counts + headline metrics.
report — render reports/dashboard.md: state/tier/pattern rollup + five KPIs
(decommission savings, ATC-clean rate, auto-fix rate, unmatched-finding
backlog, business sign-off); every percentage honest ("n/a", not 0%,
when the ledger isn't produced yet).
next — recommend the next pipeline skill, honouring the human-approval gates.
signoff— record a business-owner sign-off in campaign.json.
Pure workspace/state/reporting skill — OFFLINE (no SAP GUI, no RFC, no NCo); it
only reads/writes the campaign files the other sap-cc-* skills produce.
Prerequisites: none (the downstream skills it sequences do need SAP access).
/sap-cc-cloud-readinessMeasures each custom (Z/Y) object's DISTANCE FROM ABAP CLOUD — the question
S4HANA_READINESS (/sap-cc-analyze) does not answer. `scan` downloads source over
RFC for a campaign's REMEDIATE scope (or an explicit --objects/--packages set),
matches a versioned forbidden-statement ruleset + a cloudification-repository
snapshot offline, and classifies every object TIER_1_READY / TIER_2_WRAPPABLE
(only blockers are unreleased APIs with a successor) / TIER_3_CLASSIC (a
forbidden statement or an unreleased API with no successor), with a per-blocker
blockers.tsv and an AI summary of the cheapest wins. Honest by construction: an
API absent from the pack is 'unknown' (counted, never a blocker), a source that
can't be read is COULD_NOT_CHECK (never TIER_1), and any dynamic call sets
dynamic_blindspot=YES. S/4-ONLY (hard-refuses a non-S/4 pinned profile —
CC_NOT_S4 — pointing to /sap-cc-analyze). Read-only RFC; no writes, no TR, no
deploy. Prerequisites: /sap-login pinned to the S/4 system; SAP NCo 3.1 (32-bit).
/sap-cc-inventoryEnumerates and classifies the custom (Z/Y / customer-namespace) repository
objects in scope for an S/4HANA migration campaign. Reads TADIR + TRDIR over
read-only RFC against the campaign's SOURCE system, writes inventory.tsv, and
upserts every object into the state ledger as INVENTORIED (never touching
objects further along, so it is safe to re-run as new custom code appears). No
SAP GUI, no writes, no TR — pure read-only. First SAP-touching step of the
sap-migrate pipeline; run after /sap-cc-campaign init, before /sap-cc-usage.
When RFC is blocked, --source-mode GUI ingests /sap-se16n exports of TADIR
(+ TRDIR) instead (identical output, no NCo). Scope defaults to the brief's
in_scope_packages; override with --namespace / --packages / --types / --exclude.
Prerequisites (RFC): SAP NCo 3.1 (32-bit) + a saved source_profile (or pinned
/sap-login). GUI mode needs only a SAP GUI session for the /sap-se16n export.
/sap-cc-remediateRemediates a migration campaign's TRIAGED R1 (mechanical) objects on the
SANDBOX — the only sap-migrate skill that changes SAP, and only after a
mandatory dry-run review. Four actions:
apply — dry-run the deterministic R1 rule pack over each object's source →
<obj>.after.abap + diff for the operator to review (this is the gate).
assist — R2/R3: assemble a per-object AI context bundle for a recipe-faithful
rewrite (never auto-applied; DRAFT patterns advisory-only).
revert — roll a deployed fix back to its retained before-image (confirmed).
record — after the operator deploys the approved fix + ATC re-check, advance
campaign state (TRIAGED → REMEDIATED → VERIFIED).
R1 is deterministic; R2/R3 and unclassified '?' objects are AI-assisted / human
work, never auto-applied. Run after /sap-cc-triage.
Prerequisites: downloaded source per R1 object; deploy via the workbench skills
on the sandbox.
/sap-cc-triageTwo modes for an S/4HANA migration campaign's readiness findings.
Default — CLASSIFY: joins findings/findings_raw.tsv against the Simplification
Knowledge Pack (catalog.tsv) and writes findings/findings_triaged.tsv with each
finding's pattern + tier (R1 mechanical … R4 redesign) + fixability, then advances
each object to TRIAGED with a rolled-up tier (routing R1 to auto-remediation,
R2+/unclassified to AI/manual). Match precedence: message id > simplification item
> code regex; no match → UNMATCHED (REVIEW). Run after /sap-cc-analyze, before
/sap-cc-remediate.
--learn — the knowledge-pack FLYWHEEL (absorbed from the former /sap-cc-learn):
learns real ATC message ids from the triaged findings back into the pack's
detect_message_ids so future runs leave fewer UNMATCHED (`propose` = read-only,
`apply` merges + operator --assign into catalog.tsv). Offline.
Prerequisites: classify needs findings_raw.tsv (/sap-cc-analyze); --learn needs
findings_triaged.tsv (a prior classify run).
Other plugins' skills for the same job