SC4SAP Analyze CBO Objects
Walks a CBO (Customer Business Object) package, inventories every project-built ABAP element (table, structure, data element, class, interface, function module, program, view, table type), detects which elements are frequently reused inside the package, infers each element's business purpose from its name/fields/descriptions, and persists the result to .sc4sap/cbo/<MODULE>/<PACKAGE>/ for downstream skills (program, program-to-spec, create-object, autopilot) to consult before creating anything new.
Invoke /sc4sap:trust-session with parent_skill=sc4sap:analyze-cbo-obj to pre-grant all MCP tool + file-op permissions for this session (eliminates per-tool "Allow this tool?" prompts during the 8-step walk).
- If
.sc4sap/session-trust.log already has a line within the last 24h, skip silently.
- Otherwise run it and surface the one-line confirmation.
Full spec: see ../trust-session/SKILL.md.
- Step 1 / 1.5 / 2 (main thread) — Socratic intake: package name → flagship programs (optional
<KEY_PROGRAMS>) → module. Frontmatter pins the main thread to Sonnet 4.6.
- Step 3–7 (delegated · Sonnet 4.6) — One
Agent(...) dispatch to sap-stocker. The stocker runs its own Investigation_Protocol: walk → GetWhereUsed graph → pin/frequency tiering → business-purpose inference → cross-module gap analysis (per ../../common/active-modules.md) → sensitive-name flagging → persist index.md + inventory.json → return a Logic-heavy: <bool> flag. Authoritative spec: ../../agents/sap-stocker.md § Investigation_Protocol + § Output_Format.
- Step 8 (branching):
- Branch A (
Logic-heavy: false, DDIC-dominant) — canned summary printed by main thread. No agent dispatch.
- Branch B (
Logic-heavy: true, FM/CLAS/INTF/large-PROG in inventory) — main thread renders a reader-facing briefing from inventory.json: pinned highlights · business-logic assets · cross-module gaps · sensitive objects · next-step hint. No extra agent dispatch.
Main thread NEVER calls GetPackageContents / GetWhereUsed itself for the inventory pass — that context stays inside the stocker so the orchestrator window remains small even for large packages (200+ objects).
Task: {{ARGUMENTS}}
1---2name: sc4sap-analyze-cbo-obj3description: Analyze a CBO (Customer Business Object) package — discover frequently-used Z tables / function modules / data elements / classes / structures / table types — and save a per-module / per-package reference file so later `program` / `program-to-spec` runs prefer existing CBO elements over new ones.4---56# SC4SAP Analyze CBO Objects78Walks a CBO (Customer Business Object) package, inventories every project-built ABAP element (table, structure, data element, class, interface, function module, program, view, table type), detects which elements are **frequently reused inside the package**, infers each element's business purpose from its name/fields/descriptions, and persists the result to `.sc4sap/cbo/<MODULE>/<PACKAGE>/` for downstream skills (`program`, `program-to-spec`, `create-object`, `autopilot`) to consult before creating anything new.91011<Purpose>12Projects accumulate Z tables, Z data elements, Z function modules, and ZCL_ classes that encode domain logic. New development too often recreates near-duplicates because nobody has a compact inventory of what already exists. `analyze-cbo-obj` produces that inventory — once per package — and writes it to a file that later `sc4sap:` skills read automatically, so the next spec / program / object creation defaults to reusing proven CBO assets.13</Purpose>1415<Response_Prefix>16Every response triggered by this skill MUST begin with `[Model: <main-model> · Dispatched: <sub-summary>]` per [`../../common/model-routing-rule.md`](../../common/model-routing-rule.md) § Response Prefix Convention.17</Response_Prefix>1819<Phase_Banner>20Multi-phase skill. Before each `Agent(...)` dispatch, emit `▶ phase=<id> (<label>) · agent=<name> · model=<Opus 4.7|Sonnet 4.6|Haiku 4.5>` per [`../../common/model-routing-rule.md`](../../common/model-routing-rule.md) § Phase Banner Convention.21</Phase_Banner>2223<Use_When>24- Starting development on a module that already has a sizeable Z-package25- Onboarding onto an AMS / support engagement (need a map of custom assets)26- Before `/sc4sap:create-program` or `/sc4sap:create-object` on a new spec — so reuse is evaluated27- User says "analyze CBO", "analyze custom objects", "map Z package", "list frequently used customs", "CBO inventory"28</Use_When>2930<Do_Not_Use_When>31- User wants a code quality review of one object → `/sc4sap:analyze-code`32- User wants to reverse-engineer ONE program into a spec → `/sc4sap:program-to-spec`33- User wants to create an object → `/sc4sap:create-object`34- Package does not yet contain custom objects (CBO discovery is not meaningful)35</Do_Not_Use_When>3637<Session_Trust_Bootstrap>38**MANDATORY — runs as Step 0 before any MCP call or user interaction.**3940Invoke `/sc4sap:trust-session` with `parent_skill=sc4sap:analyze-cbo-obj` to pre-grant all MCP tool + file-op permissions for this session (eliminates per-tool "Allow this tool?" prompts during the 8-step walk).4142- If `.sc4sap/session-trust.log` already has a line within the last 24h, skip silently.43- Otherwise run it and surface the one-line confirmation.4445Full spec: see [`../trust-session/SKILL.md`](../trust-session/SKILL.md).46</Session_Trust_Bootstrap>4748<Workflow_Steps>49Orchestration is **3 main-thread Socratic steps + one delegated dispatch to `sap-stocker` (Sonnet) + a branching hand-off**. Detailed spec lives in [`workflow-steps.md`](./workflow-steps.md).5051- **Step 1 / 1.5 / 2 (main thread)** — Socratic intake: package name → flagship programs (optional `<KEY_PROGRAMS>`) → module. Frontmatter pins the main thread to Sonnet 4.6.52- **Step 3–7 (delegated · Sonnet 4.6)** — One `Agent(...)` dispatch to `sap-stocker`. The stocker runs its own Investigation_Protocol: walk → `GetWhereUsed` graph → pin/frequency tiering → business-purpose inference → cross-module gap analysis (per [`../../common/active-modules.md`](../../common/active-modules.md)) → sensitive-name flagging → persist `index.md` + `inventory.json` → return a `Logic-heavy: <bool>` flag. Authoritative spec: [`../../agents/sap-stocker.md`](../../agents/sap-stocker.md) § Investigation_Protocol + § Output_Format.53- **Step 8 (branching)**:54 - **Branch A** (`Logic-heavy: false`, DDIC-dominant) — canned summary printed by main thread. No agent dispatch.55 - **Branch B** (`Logic-heavy: true`, FM/CLAS/INTF/large-PROG in inventory) — main thread renders a reader-facing briefing from `inventory.json`: pinned highlights · business-logic assets · cross-module gaps · sensitive objects · next-step hint. No extra agent dispatch.5657Main thread NEVER calls `GetPackageContents` / `GetWhereUsed` itself for the inventory pass — that context stays inside the stocker so the orchestrator window remains small even for large packages (200+ objects).58</Workflow_Steps>5960<Output_Files>61```62.sc4sap/cbo/63└── <MODULE>/ # SD, MM, PP, PM, QM, WM, TM, TR, FI, CO, HCM, BW, PS, Ariba64 └── <PACKAGE>/ # e.g., ZSD_MAIN65 ├── index.md # human-readable summary, grouped by object type66 ├── index.html # optional single-file HTML view of index.md (offered at Step 8)67 ├── inventory.json # machine-readable, consumed by sibling skills68 └── raw-walk.md # optional full walk (only if asked or small package)69```70</Output_Files>7172<MCP_Tools_Used>73- Discovery: `GetPackage`, `GetPackageContents`, `GetPackageTree`, `SearchObject`, `GetObjectsByType`74- Object detail: `GetTable`, `GetStructure`, `GetDataElement`, `GetDomain`, `GetView`, `GetClass`, `GetInterface`, `GetFunctionGroup`, `GetFunctionModule`, `GetProgram`, `GetObjectInfo`75- Usage graph: `GetWhereUsed`76- NEVER used by this skill: `GetTableContents`, `GetSqlQuery` (no row data — DDIC metadata only)77</MCP_Tools_Used>7879<Related_Skills>80- `/sc4sap:create-program` — reads `.sc4sap/cbo/<MODULE>/<PACKAGE>/inventory.json` during spec drafting to prefer existing CBO elements81- `/sc4sap:program-to-spec` — same, for reverse-engineering82- `/sc4sap:create-object` — same, to suggest reuse before creation83- `/sc4sap:analyze-code` — quality review of ONE object (complementary, not overlapping)84</Related_Skills>8586<Data_Extraction_Safety>87This skill only reads DDIC metadata and where-used relations. It MUST NOT call `GetTableContents` or `GetSqlQuery`. Row-level access stays behind the standard blocklist + `acknowledge_risk` gate. See `common/data-extraction-policy.md`.88</Data_Extraction_Safety>8990Task: {{ARGUMENTS}}