/sap-project:sap-explain-role <ROLE_NAME> [--no-holders] [--critical-only] [--audience audit|technical] [--lang <L>] [--critical-file <path>] [--max-rows N]from sap-project
Explains SAP PFCG roles via RFC: decodes authorization values, identifies critical grants, and generates audit dossiers. Useful for role reviews and compliance.
Ships in sap-project. 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 explain what a role actually permits, read-only over RFC. PFCG's display answers this for no one — auth values are raw codes, composites hide their children. This extracts the facts deterministically and narrates them into sign-off prose an auditor accepts, grounded only in the extracted data.
Task: $ARGUMENTS
You are read-only against SAP. No confirm gates, no TR, no GUI. The dossier and
its TSVs stay local under {work_dir}.
| File | Token / call | Purpose |
|---|---|---|
<SAP_DEV_CORE_SHARED_DIR>/rules/skill_operating_rules.md | (rule) | Mandatory operating rules — read-only here |
<SKILL_DIR>/references/sap_explain_role_rfc.ps1 | -Role <n> [-IncludeHolders -Lang -MaxRows] -OutDir <d> | The one RFC extractor (AGR_/USR/decode tables) |
<SKILL_DIR>/references/sap_role_critical_match.ps1 | -AuthsTsv -CriticalTsv -OutDir [-Role] | Offline deterministic critical-grant matcher |
<SKILL_DIR>/../../shared/tables/critical_auths.tsv | matrix | Co-owned critical-grant seed (with /sap-suim); customer override at {custom_url}\critical_auths.tsv |
<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_rfc_lib.ps1 / sap_object_resolver.ps1 / sap_artifact_lib.ps1 | dot-sourced / Step 7 | RFC connect, Read-SapTableRows, artifact index |
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)); Write-Output ('CUSTOM_URL=' + (Get-SapSettingValue 'custom_url' ((Get-SapWorkDir) + '\custom')))"
Set {RUN_TEMP} via Get-SapRunTemp. {OUT} = Get-SapArtifactDir -ScopeKey ROLE_<NAME> -Skill sap-explain-role (manual scope key — PFCG roles are not TADIR
objects).
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action start -StateFile "{RUN_TEMP}\sap_explain_role_run.json" -Skill sap-explain-role -ParamsJson "{}"
Default mode is role (bare <ROLE> arg). Flags: --no-holders (skip the USR
reads), --critical-only (render header + criticals + coverage only — the full
AGR_1251 read still runs, matching needs it), --audience audit|technical (default
audit = business language), --lang <L>, --critical-file <path>, --max-rows N
(default 50000). Uppercase the role name.
concept <PATTERN> is Phase 2 (not implemented) → say MODE_NOT_IMPLEMENTED
and STOP.
RFC only — no GUI session. Profile pinned via /sap-login; the extractor
self-connects. RFC unavailable → fail loud (RFC_LOGON_FAILED).
--critical-file → {custom_url}\critical_auths.tsv → the plugin seed
(sap-project/shared/tables/critical_auths.tsv). Log which tier won; a missing
matrix marks the whole critical section COULD_NOT_CHECK (never a silent "0 hits").
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_explain_role_rfc.ps1" -Role "<ROLE>" -IncludeHolders -SharedDir "<SAP_DEV_CORE_SHARED_DIR>" -OutDir "{OUT}"
Drop -IncludeHolders for --no-holders; add -MaxRows N. Parse:
ROLE: name=.. composite=<Y|N> children=.. text="<short text>"
SECTION: <area> rows=<n> coverage=<CHECKED|COULD_NOT_CHECK> [reason=..]
STATUS: OK | PARTIAL | ROLE_NOT_FOUND | RFC_ERROR
ROLE_NOT_FOUND (exit 1) → show the NEAR: candidates, log end ROLE_NOT_FOUND, STOP.PARTIAL → carry the per-SECTION: coverage flags into the dossier (a
COULD_NOT_CHECK area — auth-denied read or --max-rows truncation — is rendered
as such, never as empty/clean). A denied core area (auths) is ROLE_READ_DENIED;
a denied holders area alone stays SUCCESS + PARTIAL.RFC_ERROR (exit 2) → RFC_LOGON_FAILED, STOP. A composite with >20 children →
volume check-in with the user before continuing (not a write gate).The extractor writes role_header.tsv, role_tcodes.tsv, role_auths_decoded.tsv
(src_role / object / object_text / auth / field / low / high / activity_text),
role_orglevels.tsv, role_holders.tsv, role_children.tsv into {OUT}.
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "<SKILL_DIR>\references\sap_role_critical_match.ps1" -AuthsTsv "{OUT}\role_auths_decoded.tsv" -CriticalTsv "<matrix>" -OutDir "{OUT}" -Role "<ROLE>"
Parse CRIT: lines + STATUS: OK found=.. critical=.. high=.. medium=... NO_MATRIX
→ critical section COULD_NOT_CHECK, verdict PARTIAL (never CLEAN).
Write role_dossier.md into {OUT} from the TSVs. Grounding rule: every claim
traces to a TSV row — never invent an auth value, holder, or purpose. Sections:
technical
surfaces object/field codes, audit stays in business language.critical_findings.tsv; name the
grant + rationale ("S_TABU_DIS ACTVT 02 — change access to table maintenance").role_tcodes.tsv (menu vs S_TCODE grant; note a menu tcode
with no S_TCODE grant, and vice-versa).role_auths_decoded.tsv by object, using the
decoded object_text/activity_text; render ranges as "for X 1000–1999".role_orglevels.tsv (org field + value).role_holders.tsv, flagging locked / expired users; --no-holders
→ say holders were not read.COULD_NOT_CHECK/truncated area. On S/4 (release
marker) add: "Classic grants only — Fiori catalog/S_START app grants are NOT read
in v1", so the verdict never over-claims completeness.Register role_dossier.md (kind role-dossier, Verdict CLEAN|CRITICAL_GRANTS|PARTIAL,
Coverage from Step 4), each TSV (kind role-data), and findings.json (kind
findings) via Register-SapArtifact under scope ROLE_<NAME>. Echo:
ROLE: <name> tcodes=<n> objects=<n> critical=<n> holders=<n|SKIPPED|DENIED> verdict=<..>
powershell -ExecutionPolicy Bypass -File "<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_log_helper.ps1" -Action end -StateFile "{RUN_TEMP}\sap_explain_role_run.json" -Status SUCCESS -ExitCode 0
PARTIAL data still ends SUCCESS (with coverage=PARTIAL). Use -Status FAILED
with the mapped -ErrorClass for the STOPs (ROLE_NOT_FOUND, ROLE_READ_DENIED,
ROLE_DATA_TRUNCATED, RFC_LOGON_FAILED, MODE_NOT_IMPLEMENTED).
role dossier for single + composite roles (decomposed one
level) — decoded transactions, authorizations (object + activity texts), org
levels, holders (lock/validity/name), deterministic critical-grant matching against
the co-owned critical_auths.tsv. --no-holders, --critical-only, --audience,
--lang, --max-rows. Read-only.LOW..HIGH covers the rule value — a wildcard grant (LOW='*') hits any rule; a
rule low='*' flags only a wildcard grant; trailing-* prefix match; low..high
interval containment; blank field = object-presence. DELETED='X' tombstones excluded.concept <pattern> (batch role-model documentation +
role-to-user matrix), --format docx. Fiori catalog analysis (AGR_HIER/S_START).COULD_NOT_CHECK, never rendered
as empty/clean; a missing matrix caps the verdict at PARTIAL; the dossier narrates
only data present in the TSVs.--no-holders for privacy-lean runs; all output stays under {work_dir}.What SKILL.md sets; muted values are Claude Code's defaults
40 skills in this plugin
/sap-auth-diagnoseDiagnoses "no authorization" failures deterministically over RFC and proposes the
exact PFCG fix — no more pasting an SU53 screenshot and hand-searching SUIM. Given
the failed authorization object (+ optional field values, read off SU53 / an ST22
dump / an application-log message), it evaluates the target user against the
AUTHORITATIVE runtime user buffer (`SUSR_USER_AUTH_FOR_OBJ_GET`, remote-enabled on
S/4HANA 1909 + ECC 6) with faithful AUTHORITY-CHECK semantics — one authorization
instance must satisfy every field, '*' matches anything, VON..BIS ranges honoured —
so the verdict can never disagree with the real kernel check the way a hand-rolled
AGR_1251/UST12 join can. It then classifies each failure (`MISSING_OBJECT` /
`MISSING_VALUE` / `BUFFER_STALE`) plus user-level `USER_LOCKED` / `USER_EXPIRED` /
`ROLE_EXPIRED`, names the closest role the user already has (with what it currently
grants), and writes a diagnosis TSV + fix-proposal + ready-to-send security request.
Read-only toward roles and users — the fix is always a proposal, never a write.
Prerequisites: SAP profile via /sap-login (RFC); SAP NCo 3.1 (32-bit). su53 (GUI
auto-scrape of the failed objects) and trace (STAUTHTRACE) modes are the documented
next phase — until then the operator supplies the failed object (Claude decodes a
pasted SU53 into the check input).
/sap-auth-requirementsDerives the SAP authorization requirements a custom development actually needs — the
deliverable Z-transactions never hand the security team. derive reads a program/FM source over
RFC, extracts the EXPLICIT AUTHORITY-CHECK surface plus the IMPLICIT one (CALL TRANSACTION ->
S_TCODE, SUBMIT -> S_PROGRAM, OPEN/DELETE DATASET/TRANSFER -> S_DATASET, CALL FUNCTION
DESTINATION -> S_RFC, DDIC table writes -> S_TABU_DIS incl. dynamic MODIFY (var)), traces each
value to its nearest literal, and validates every object/field/activity against the live
catalog (TOBJ / TACTZ) — emitting a required-auth matrix with per-row CONFIRMED / INFERRED
honesty plus an SU24 proposal draft. su24-audit lists Z/Y tcodes against USOBX_C / USOBT_C and
flags the real gap: NO_PROPOSAL / CHECK_DISABLED / ONLY_S_TCODE / PROPOSAL_PRESENT with a
staleness date. Pure RFC + offline extraction (no wrapper FM, no dev-init, runs on a bare
security profile); a static value that cannot be resolved is INFERRED, never silently
CONFIRMED. Class/interface source needs an SE24 GUI download (pass --source-files) or degrades
to COULD_NOT_CHECK. Owns the AUTHREQ_* finding namespace so it never double-reports with
/sap-review-abap's security dimension. v2: su24-maintain / su21-create (confirm-gated GUI).
Prerequisites: pinned /sap-login RFC profile; NCo 3.1 (32-bit).
npx claudepluginhub sapdev-ai/sap-dev --plugin sap-projectOther plugins' skills for the same job