Claude Skill

abap-code-review

Performs structured pre-release security and quality review of SAP ABAP programs across 9 dimensions (SEC, AUTH, DATA, PERF, STD, INTERFACE, CHANGE, COMP, FUNC), producing a formal sign-off-ready Markdown assessment report. Trigger when the user asks to review, audit, assess, or

LLM Mart · 0 points · 0 views 2 listing impressions 0 install-command copies
Download shrek-abaper-sap-watt-skills_abap-code-review-d5ccd30.zip · 33 KB

Install

skills CLI npx skills add https://github.com/shrek-abaper/sap-watt/tree/main/skills/abap-code-review
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install shrek-abaper-sap-watt@llmmart
Git git clone https://github.com/shrek-abaper/sap-watt.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole shrek-abaper/sap-watt collection as a plugin from our marketplace. Git is the plain clone.

README

abap-code-review

This skill needs no CLI — it works fully offline. Compatible legacy CLI range: >=1.5.0,<2.0.0. Preferred new entry: Watt (sap-watt), range >=1.6.7,<2.0.0. Existing sap-adt examples remain valid; use the installed entry consistently. Install/readiness guide: references/setup.md.

English | 中文

Important

This repository has been archived and is no longer updated. abap-code-review is now maintained exclusively in the sap-watt monorepo at skills/abap-code-review. Please go there for the latest version, issues, and improvements.

An AI agent skill for SAP ABAP pre-release code review. Performs a comprehensive security and quality assessment across 9 dimensions and produces a formal, sign-off-ready Markdown report.


Overview

abap-code-review is an AI agent skill that guides any AI agent through a structured, repeatable ABAP code review workflow. It is designed to catch security vulnerabilities, authorization gaps, performance risks, and code quality issues before a transport is promoted to production.

Why use it?

  • Consistent coverage — 9 review dimensions, no dimension is ever skipped
  • Evidence-based findings — every finding requires a real code snippet; no speculation
  • Rule-cited — security and standards findings are always tied to a named rule (e.g. SEC-SQL-1, [T-2])
  • Release-decision ready — output is a structured report with GO / CONDITIONAL GO / NO-GO recommendation and a sign-off table

Review Dimensions

# Dimension Key Checks
1 [SEC] Security Vulnerabilities SQL injection, code injection, OS command injection, file path attacks, hardcoded credentials
2 [AUTH] Authorization & Access Control Missing AUTHORITY-CHECK, unchecked SY-SUBRC, authorization bypass patterns
3 [DATA] Data Integrity & Exception Handling SY-SUBRC after FM calls, locking before writes, empty CATCH blocks
4 [PERF] Performance Risks SELECT inside LOOP, SELECT *, full table scans, wrong internal table type
5 [STD] ABAP Code Standards Deprecated statements, hardcoded business values, oversized methods, commented-out code
6 [INTERFACE] Interface & Integration Risks Dialog messages in RFC FMs, missing EXCEPTIONS, OData backend auth
7 [CHANGE] Change Impact Assessment Affected tables, modifications to SAP standard objects, shared INCLUDEs, transport dependencies
8 [COMP] Compliance & Audit Trail PII handling, dual-control for postings, audit log coverage, SoD paths
9 [FUNC] Functional Completeness (optional) Business scenario coverage, boundary conditions, logic vs. requirements

How to Use

Invoke the agent

Review program [PROGRAM_NAME] for release.
Transport: [DEVKXXXXXX], Change description: [one-line business purpose].
Save the report to the reports/ directory.

Include functional review (optional)

Append the requirements document path or describe the requirements inline if you also want the [FUNC] dimension evaluated.

Output

The agent saves a Markdown report to the reports/ directory you specify:

  • Default filename: ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md
  • CRITICAL findings present: CRITICAL_ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md

Report Structure

Each generated report contains:

  1. Report Header — program, transport, change description, reviewer, date, scope
  2. Executive Summary — 3–5 sentence overview of findings and recommendation
  3. Release Recommendation — 🔴 NO-GO / 🟡 CONDITIONAL GO / 🟢 GO with justification
  4. Risk Summary — finding counts by severity level
  5. Detailed Findings — code evidence, rule citation, risk description, remediation for each issue
  6. Dimension Coverage Summary — confirmation that all 9 dimensions were completed
  7. Scope Limitations — any objects that could not be retrieved
  8. Remediation Checklist — action items for CRITICAL and HIGH findings
  9. Sign-off Table — slots for Developer, Technical Lead, Release Manager, Security Owner

Severity Levels

Level Label Release Impact
🔴 CRITICAL Blocks release
🟠 HIGH Should block release
🟡 MEDIUM Fix in next sprint
🟢 LOW Advisory
ℹ️ INFO No action required

Special rule: Any HIGH finding in [SEC] or [AUTH] is treated as CRITICAL (automatic NO-GO).


Release Decision Logic

CRITICAL finding present               → NO-GO
HIGH finding in [SEC] or [AUTH]        → NO-GO  (special rule)
HIGH finding in other dimensions       → CONDITIONAL GO  (tech lead sign-off required)
MEDIUM / LOW / INFO findings only      → GO

File Structure

abap-code-review/
├── SKILL.md                          ← Agent instructions (SKILL definition; loaded by the agent host)
├── README.md                         ← This file (English)
├── README.zh-CN.md                   ← Chinese version
├── LICENSE                           ← MIT License
└── references/
    ├── REF_ABAP_SECURITY.md          ← Security rules for [SEC] and [AUTH] dimensions
    ├── REF_CLEAN_ABAP.md             ← Clean ABAP rules for [STD] dimension
    ├── REPORT_TEMPLATE.md            ← Report template loaded in Step 5
    ├── setup.md                      ← Generated CLI guide (informational; this skill needs no CLI)
    └── runtime-compatibility.json    ← Generated compatibility snapshot (no CLI required)

Reference Sources

Reference File Source
REF_ABAP_SECURITY.md SAP ABAP Keyword Documentation; SAP CVA categories; RedRays ABAP Scanner (164 rules); CVE-2025-0063, CVE-2025-42957; DSAG ABAP Development Recommendations
REF_CLEAN_ABAP.md SAP Clean ABAP Style Guide (github.com/SAP/styleguides, CC BY 4.0)

Supported Object Types

Type Scope Read
REPORT Main program + all INCLUDEs
Global Class Class definition + all METHOD implementations
Function Module Target FM + other FMs in the same function group
Enhancement / BAdI Enhancement Spot definition + all active implementations

License

Reference content derived from the SAP Clean ABAP Style Guide is used under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

All other content in this repository is original work.

Skill manifest

ABAP Code Review Skill

Performs pre-release security and quality assessment of SAP ABAP programs, producing a formal Markdown report ready for sign-off and circulation.

Runtime requirement: none. This skill reviews source you provide; it does not connect to SAP and does not need the sap-adt CLI. Never demand a CLI install for this skill (references/runtime-compatibility.json declares not-required; references/setup.md is informational only).

Invocation

Any message matching the description above will load this skill. A complete invocation with full context:

Review program [PROGRAM_NAME] for release.
Transport: [DEVKXXXXXX], Change description: [one-line business purpose].
Save the report to the reports/ directory.

To include functional completeness checks ([FUNC] dimension), provide the requirements document path or describe the requirements in the conversation.


Step 0 — Load References First

Before reading any ABAP source code, load the following two files in order. Do not load any other files from the references/ directory:

  1. references/REF_ABAP_SECURITY.md — Authority reference for [SEC], [AUTH], and [INTERFACE] dimensions
  2. references/REF_CLEAN_ABAP.md — Authority reference for the [STD] dimension

Every [SEC] / [AUTH] / [STD] finding must cite the corresponding rule ID (e.g. SEC-SQL-1, [E-2]). Findings without a rule ID citation are invalid and must be removed.

If reference files are not accessible (e.g., the agent cannot read from the skill directory): proceed using built-in ABAP knowledge. Record under Scope Limitations that reference files were unavailable; rule IDs must still be cited in findings.


Step 1 — Read Source Code

Retrieve the complete source code of the target program using the appropriate method for your environment:

  • Tool-equipped agents: Use the available ABAP source-reading capability (ABAP CLI tool, ADT API, MCP tool, or equivalent) to programmatically read the main program and all INCLUDEs.
  • Conversation-based agents / manual sessions: Ask the user to paste the source code directly into the conversation, specifying which INCLUDEs, class methods, or function modules are in scope.
Object Type Scope to Read
REPORT Main program + all INCLUDEs
Global Class Class definition + all METHOD implementations
Function Module Target FM + other FMs in the same function group
Enhancement / BAdI Enhancement Spot definition + all active implementations

Reading order: main program / class definition → INCLUDEs (in order of appearance) → METHODs (one by one).

Objects that cannot be retrieved: record in the report under Scope Limitations, mark as "unreviewed", and do not assume they are safe.


Step 2 — Analyze (9 Dimensions)

Complete all 9 dimensions in the order listed below. No dimension may be skipped (if no issues are found, state "No issues found").

[SEC] Security Vulnerabilities

Reference: REF_ABAP_SECURITY.md. Scan by priority:

Priority 1 (scan immediately):
  EXEC SQL                    → SEC-SQL-2
  GENERATE SUBROUTINE POOL    → SEC-CODE-1
  INSERT REPORT               → SEC-CODE-2
  CALL 'SYSTEM' / SXPG_*     → SEC-OS-1/2/3
  WHERE ( <variable> )        → SEC-SQL-1
  DESTINATION ( <variable> )  → SEC-RFC-1

Priority 2 (important checks):
  cl_sql_statement            → verify set_param parameterization is used
  OPEN DATASET                → path source + SY-SUBRC check
  CALL FUNCTION DESTINATION   → RFC destination source
  literals containing password/key/token → SEC-CRED-1

[AUTH] Authorization & Access Control

Reference: REF_ABAP_SECURITY.md → AUTH-MISS-, AUTH-BYP-

High-risk tables (AUTHORITY-CHECK required before read/write): BKPF/BSEG, MKPF/MSEG, VBAK/VBAP, EKKO/EKPO, PA*/HRP*

Check: ① AUTHORITY-CHECK present before sensitive table operations → ② SY-SUBRC checked immediately after → ③ no SY-UNAME hardcoded bypass → ④ RFC FMs have authorization checks

Special rule: Any HIGH finding in [SEC] or [AUTH] is treated as CRITICAL for the release decision (NO-GO).

[DATA] Data Integrity & Exception Handling

Reference: REF_CLEAN_ABAP.md [E-2] [E-3]

Check: SY-SUBRC after CALL FUNCTION → SY-SUBRC after READ TABLE / SELECT SINGLE → SY-SUBRC after OPEN DATASET → ENQUEUE lock before write operations → COMMIT WORK not inside a loop → ROLLBACK WORK on error paths → no empty CATCH blocks that swallow exceptions

[PERF] Performance Risks

Reference: REF_CLEAN_ABAP.md [T-1] [T-2] [T-3]

Check: SELECT inside LOOP (→ [T-2], CRITICAL for large tables) → SELECT * without projection (→ [T-3]) → full table scan (no WHERE clause) → READ TABLE WITH KEY inside LOOP (→ [T-1], switch to SORTED/HASHED) → high-volume tables (BKPF/BSEG/MKPF/MSEG) without row-count protection

[STD] ABAP Code Standards

Reference: REF_CLEAN_ABAP.md [L-] [C-] [N-] [M-]

Check deprecated statements ([L-3]), hardcoded business values such as bukrs/werks/mandt ([C-3], typically HIGH in enterprise settings), overly long methods ([M-2], flag if > 20 statements), commented-out code blocks ([CM-3]), Unicode compatibility

[INTERFACE] Interface & Integration Risks

Reference: REF_ABAP_SECURITY.md SEC-RFC-, SEC-WEB-

Check: RFC FM contains dialog messages MESSAGE TYPE A/I/W (→ SEC-RFC-3) → RFC FM parameters have type declarations → EXCEPTIONS fully declared → CALL FUNCTION DESTINATION has timeout configured → OData DPC Extension has backend authorization check (→ SEC-WEB-2)

[CHANGE] Change Impact Assessment

Assess: affected database tables (list all read/write/delete operations) → whether SAP standard objects are modified → whether the program shares INCLUDEs or FMs with other programs → Transport prerequisites and cross-system dependencies

[COMP] Compliance & Audit Trail

Check: PII data reads/exports have a compliance basis → FI/CO postings have dual-control → master data changes written to CDHDR/CDPOS → program logs executor/timestamp/parameters → no single person can both initiate and approve (SoD path)

[FUNC] Functional Completeness (Optional)

Execute only when the user provides a requirements specification; otherwise state the reason for skipping in the report.

If executed: verify program entry points cover business scenarios → boundary condition handling (null/zero/oversized datasets) → core business logic matches requirements → calculation logic is accurate → output fields are complete → integration interfaces transmit data completely


Step 3 — Severity Classification

Level Label Release Impact
🔴 CRITICAL Blocks release
🟠 HIGH Should block release
🟡 MEDIUM Fix in next sprint
🟢 LOW Advisory
ℹ️ INFO No action required

When severity is uncertain, choose the higher level.


Step 4 — Release Decision

CRITICAL finding present                        → NO-GO
HIGH finding in [SEC] or [AUTH]                 → NO-GO (special rule)
HIGH finding in other dimensions                → CONDITIONAL GO (requires tech lead sign-off)
MEDIUM / LOW / INFO findings only               → GO

Step 5 — Generate Report

Load references/REPORT_TEMPLATE.md and generate the report by strictly following the template structure.

Report language: titles and rule references in English; risk descriptions and remediation recommendations in English.

File naming: ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md When a CRITICAL finding is present, prefix: CRITICAL_ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md

Save to the reports/ directory specified by the user and confirm the file path upon completion.

If file system write access is unavailable: output the complete report as formatted Markdown in the conversation. Inform the user that no file was saved and suggest they copy the output manually.


Behavior Rules

Rule Requirement
References first Step 1 must not begin until Step 0 is complete
Evidence-first Every finding must include a real code snippet (≤ 15 lines); findings without code evidence are invalid
Rule citation [SEC] / [AUTH] / [STD] findings must cite a rule ID
No false negatives Objects not retrieved → mark as "partially reviewed"; never write "no issues found" for unread objects
No duplication Same pattern found in multiple locations → one finding listing all locations
FUNC gate No requirements document → skip and state reason; do not infer requirements independently
Files (sap-watt)
  • references
    • REF_ABAP_SECURITY.md 15.6 KB
      Loading…
    • REF_CLEAN_ABAP.md 13.2 KB
      Loading…
    • REPORT_TEMPLATE.md 4.5 KB
      Loading…
    • runtime-compatibility.json 1.2 KB
      Loading…
    • setup.md 18 KB
      Loading…
  • README.md 7 KB
    # abap-code-review
    
    <!-- BEGIN GENERATED cli-setup -->
    <!-- GENERATED from docs/installation/runtime-setup.md + compatibility.json by tools/sync_skill_runtime_docs.py — do not edit; run the tool to refresh -->
    
    This skill needs **no CLI** — it works fully offline. Compatible legacy CLI range: `>=1.5.0,<2.0.0`.
    Preferred new entry: **Watt** (`sap-watt`), range `>=1.6.7,<2.0.0`. Existing `sap-adt` examples remain valid; use the installed entry consistently.
    Install/readiness guide: [`references/setup.md`](references/setup.md).
    <!-- END GENERATED cli-setup -->
    
    [English](README.md) | [中文](README.zh-CN.md)
    
    > [!IMPORTANT]
    > **This repository has been archived and is no longer updated.** `abap-code-review` is now maintained exclusively in the [sap-watt](https://github.com/shrek-abaper/sap-watt) monorepo at [`skills/abap-code-review`](https://github.com/shrek-abaper/sap-watt/tree/main/skills/abap-code-review). Please go there for the latest version, issues, and improvements.
    
    An AI agent skill for SAP ABAP pre-release code review. Performs a comprehensive security and quality assessment across 9 dimensions and produces a formal, sign-off-ready Markdown report.
    
    ---
    
    ## Overview
    
    `abap-code-review` is an AI agent skill that guides any AI agent through a structured, repeatable ABAP code review workflow. It is designed to catch security vulnerabilities, authorization gaps, performance risks, and code quality issues before a transport is promoted to production.
    
    ### Why use it?
    
    - **Consistent coverage** — 9 review dimensions, no dimension is ever skipped
    - **Evidence-based findings** — every finding requires a real code snippet; no speculation
    - **Rule-cited** — security and standards findings are always tied to a named rule (e.g. `SEC-SQL-1`, `[T-2]`)
    - **Release-decision ready** — output is a structured report with GO / CONDITIONAL GO / NO-GO recommendation and a sign-off table
    
    ---
    
    ## Review Dimensions
    
    | # | Dimension | Key Checks |
    |---|-----------|-----------|
    | 1 | **[SEC]** Security Vulnerabilities | SQL injection, code injection, OS command injection, file path attacks, hardcoded credentials |
    | 2 | **[AUTH]** Authorization & Access Control | Missing AUTHORITY-CHECK, unchecked SY-SUBRC, authorization bypass patterns |
    | 3 | **[DATA]** Data Integrity & Exception Handling | SY-SUBRC after FM calls, locking before writes, empty CATCH blocks |
    | 4 | **[PERF]** Performance Risks | SELECT inside LOOP, SELECT *, full table scans, wrong internal table type |
    | 5 | **[STD]** ABAP Code Standards | Deprecated statements, hardcoded business values, oversized methods, commented-out code |
    | 6 | **[INTERFACE]** Interface & Integration Risks | Dialog messages in RFC FMs, missing EXCEPTIONS, OData backend auth |
    | 7 | **[CHANGE]** Change Impact Assessment | Affected tables, modifications to SAP standard objects, shared INCLUDEs, transport dependencies |
    | 8 | **[COMP]** Compliance & Audit Trail | PII handling, dual-control for postings, audit log coverage, SoD paths |
    | 9 | **[FUNC]** Functional Completeness *(optional)* | Business scenario coverage, boundary conditions, logic vs. requirements |
    
    ---
    
    ## How to Use
    
    ### Invoke the agent
    
    ```
    Review program [PROGRAM_NAME] for release.
    Transport: [DEVKXXXXXX], Change description: [one-line business purpose].
    Save the report to the reports/ directory.
    ```
    
    ### Include functional review (optional)
    
    Append the requirements document path or describe the requirements inline if you also want the [FUNC] dimension evaluated.
    
    ### Output
    
    The agent saves a Markdown report to the `reports/` directory you specify:
    
    - Default filename: `ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md`
    - CRITICAL findings present: `CRITICAL_ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md`
    
    ---
    
    ## Report Structure
    
    Each generated report contains:
    
    1. **Report Header** — program, transport, change description, reviewer, date, scope
    2. **Executive Summary** — 3–5 sentence overview of findings and recommendation
    3. **Release Recommendation** — 🔴 NO-GO / 🟡 CONDITIONAL GO / 🟢 GO with justification
    4. **Risk Summary** — finding counts by severity level
    5. **Detailed Findings** — code evidence, rule citation, risk description, remediation for each issue
    6. **Dimension Coverage Summary** — confirmation that all 9 dimensions were completed
    7. **Scope Limitations** — any objects that could not be retrieved
    8. **Remediation Checklist** — action items for CRITICAL and HIGH findings
    9. **Sign-off Table** — slots for Developer, Technical Lead, Release Manager, Security Owner
    
    ---
    
    ## Severity Levels
    
    | Level | Label | Release Impact |
    |-------|-------|---------------|
    | 🔴 | CRITICAL | Blocks release |
    | 🟠 | HIGH | Should block release |
    | 🟡 | MEDIUM | Fix in next sprint |
    | 🟢 | LOW | Advisory |
    | ℹ️ | INFO | No action required |
    
    **Special rule**: Any HIGH finding in [SEC] or [AUTH] is treated as CRITICAL (automatic NO-GO).
    
    ---
    
    ## Release Decision Logic
    
    ```
    CRITICAL finding present               → NO-GO
    HIGH finding in [SEC] or [AUTH]        → NO-GO  (special rule)
    HIGH finding in other dimensions       → CONDITIONAL GO  (tech lead sign-off required)
    MEDIUM / LOW / INFO findings only      → GO
    ```
    
    ---
    
    ## File Structure
    
    ```
    abap-code-review/
    ├── SKILL.md                          ← Agent instructions (SKILL definition; loaded by the agent host)
    ├── README.md                         ← This file (English)
    ├── README.zh-CN.md                   ← Chinese version
    ├── LICENSE                           ← MIT License
    └── references/
        ├── REF_ABAP_SECURITY.md          ← Security rules for [SEC] and [AUTH] dimensions
        ├── REF_CLEAN_ABAP.md             ← Clean ABAP rules for [STD] dimension
        ├── REPORT_TEMPLATE.md            ← Report template loaded in Step 5
        ├── setup.md                      ← Generated CLI guide (informational; this skill needs no CLI)
        └── runtime-compatibility.json    ← Generated compatibility snapshot (no CLI required)
    ```
    
    ---
    
    ## Reference Sources
    
    | Reference File | Source |
    |----------------|--------|
    | `REF_ABAP_SECURITY.md` | SAP ABAP Keyword Documentation; SAP CVA categories; RedRays ABAP Scanner (164 rules); CVE-2025-0063, CVE-2025-42957; DSAG ABAP Development Recommendations |
    | `REF_CLEAN_ABAP.md` | SAP Clean ABAP Style Guide (`github.com/SAP/styleguides`, CC BY 4.0) |
    
    ---
    
    ## Supported Object Types
    
    | Type | Scope Read |
    |------|-----------|
    | REPORT | Main program + all INCLUDEs |
    | Global Class | Class definition + all METHOD implementations |
    | Function Module | Target FM + other FMs in the same function group |
    | Enhancement / BAdI | Enhancement Spot definition + all active implementations |
    
    ---
    
    ## License
    
    Reference content derived from the [SAP Clean ABAP Style Guide](https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md) is used under the [Creative Commons Attribution 4.0 International License (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/).
    
    All other content in this repository is original work.
    
  • README.zh-CN.md 5.8 KB
    Loading…
  • SKILL.md 9.9 KB
    ---
    name: abap-code-review
    description: "Performs structured pre-release security and quality review of SAP ABAP programs across 9 dimensions (SEC, AUTH, DATA, PERF, STD, INTERFACE, CHANGE, COMP, FUNC), producing a formal sign-off-ready Markdown assessment report. Trigger when the user asks to review, audit, assess, or check ABAP code before release — phrases include: 'security review', 'risk check', 'release audit', 'code review', 'check before transport', 'safe to release', or 'can this go to production'; also when a program name (e.g. ZMMR0002) appears alongside 'review', 'check', or 'ready for transport'. Do not use for general ABAP syntax questions, runtime debugging, or performance tuning unrelated to a transport release gate."
    metadata:
      version: "1.0.0"
      type: docs
      valid_until: "evergreen"
      source_urls:
        - "https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md"
        - "https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm"
      output_schema:
        format: text
        description: "Markdown report; filename ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md saved to user-specified reports/ directory, or output inline if file write is unavailable"
      permissions:
        read_paths: ["<skill_dir>/references/"]
        write_paths: ["<user-specified reports directory>"]
        network_endpoints: []
        requires_elevation: false
        accesses_env_vars: []
    ---
    
    # ABAP Code Review Skill
    
    Performs pre-release security and quality assessment of SAP ABAP programs, producing a formal Markdown report ready for sign-off and circulation.
    
    **Runtime requirement: none.** This skill reviews source you provide; it does
    not connect to SAP and does not need the `sap-adt` CLI. Never demand a CLI
    install for this skill (`references/runtime-compatibility.json` declares
    `not-required`; `references/setup.md` is informational only).
    
    ## Invocation
    
    Any message matching the description above will load this skill. A complete invocation with full context:
    
    ```
    Review program [PROGRAM_NAME] for release.
    Transport: [DEVKXXXXXX], Change description: [one-line business purpose].
    Save the report to the reports/ directory.
    ```
    
    To include functional completeness checks ([FUNC] dimension), provide the requirements document path or describe the requirements in the conversation.
    
    ---
    
    ## Step 0 — Load References First
    
    Before reading any ABAP source code, load the following two files in order. Do not load any other files from the references/ directory:
    
    1. `references/REF_ABAP_SECURITY.md` — Authority reference for [SEC], [AUTH], and [INTERFACE] dimensions
    2. `references/REF_CLEAN_ABAP.md` — Authority reference for the [STD] dimension
    
    > Every [SEC] / [AUTH] / [STD] finding must cite the corresponding rule ID (e.g. `SEC-SQL-1`, `[E-2]`).
    > Findings without a rule ID citation are invalid and must be removed.
    
    > **If reference files are not accessible** (e.g., the agent cannot read from the skill directory): proceed using built-in ABAP knowledge. Record under Scope Limitations that reference files were unavailable; rule IDs must still be cited in findings.
    
    ---
    
    ## Step 1 — Read Source Code
    
    Retrieve the complete source code of the target program using the appropriate method for your environment:
    
    - **Tool-equipped agents**: Use the available ABAP source-reading capability (ABAP CLI tool, ADT API, MCP tool, or equivalent) to programmatically read the main program and all INCLUDEs.
    - **Conversation-based agents / manual sessions**: Ask the user to paste the source code directly into the conversation, specifying which INCLUDEs, class methods, or function modules are in scope.
    
    | Object Type | Scope to Read |
    |-------------|--------------|
    | REPORT | Main program + all INCLUDEs |
    | Global Class | Class definition + all METHOD implementations |
    | Function Module | Target FM + other FMs in the same function group |
    | Enhancement / BAdI | Enhancement Spot definition + all active implementations |
    
    Reading order: main program / class definition → INCLUDEs (in order of appearance) → METHODs (one by one).
    
    Objects that cannot be retrieved: record in the report under Scope Limitations, mark as "unreviewed", and do not assume they are safe.
    
    ---
    
    ## Step 2 — Analyze (9 Dimensions)
    
    Complete all 9 dimensions in the order listed below. No dimension may be skipped (if no issues are found, state "No issues found").
    
    ### [SEC] Security Vulnerabilities
    Reference: `REF_ABAP_SECURITY.md`. Scan by priority:
    
    ```
    Priority 1 (scan immediately):
      EXEC SQL                    → SEC-SQL-2
      GENERATE SUBROUTINE POOL    → SEC-CODE-1
      INSERT REPORT               → SEC-CODE-2
      CALL 'SYSTEM' / SXPG_*     → SEC-OS-1/2/3
      WHERE ( <variable> )        → SEC-SQL-1
      DESTINATION ( <variable> )  → SEC-RFC-1
    
    Priority 2 (important checks):
      cl_sql_statement            → verify set_param parameterization is used
      OPEN DATASET                → path source + SY-SUBRC check
      CALL FUNCTION DESTINATION   → RFC destination source
      literals containing password/key/token → SEC-CRED-1
    ```
    
    ### [AUTH] Authorization & Access Control
    Reference: `REF_ABAP_SECURITY.md` → AUTH-MISS-*, AUTH-BYP-*
    
    High-risk tables (AUTHORITY-CHECK required before read/write): BKPF/BSEG, MKPF/MSEG, VBAK/VBAP, EKKO/EKPO, PA*/HRP*
    
    Check: ① AUTHORITY-CHECK present before sensitive table operations → ② SY-SUBRC checked immediately after → ③ no SY-UNAME hardcoded bypass → ④ RFC FMs have authorization checks
    
    > **Special rule**: Any HIGH finding in [SEC] or [AUTH] is treated as CRITICAL for the release decision (NO-GO).
    
    ### [DATA] Data Integrity & Exception Handling
    Reference: `REF_CLEAN_ABAP.md` [E-2] [E-3]
    
    Check: SY-SUBRC after CALL FUNCTION → SY-SUBRC after READ TABLE / SELECT SINGLE → SY-SUBRC after OPEN DATASET → ENQUEUE lock before write operations → COMMIT WORK not inside a loop → ROLLBACK WORK on error paths → no empty CATCH blocks that swallow exceptions
    
    ### [PERF] Performance Risks
    Reference: `REF_CLEAN_ABAP.md` [T-1] [T-2] [T-3]
    
    Check: SELECT inside LOOP (→ [T-2], CRITICAL for large tables) → SELECT * without projection (→ [T-3]) → full table scan (no WHERE clause) → READ TABLE WITH KEY inside LOOP (→ [T-1], switch to SORTED/HASHED) → high-volume tables (BKPF/BSEG/MKPF/MSEG) without row-count protection
    
    ### [STD] ABAP Code Standards
    Reference: `REF_CLEAN_ABAP.md` [L-*] [C-*] [N-*] [M-*]
    
    Check deprecated statements (`[L-3]`), hardcoded business values such as bukrs/werks/mandt (`[C-3]`, typically HIGH in enterprise settings), overly long methods (`[M-2]`, flag if > 20 statements), commented-out code blocks (`[CM-3]`), Unicode compatibility
    
    ### [INTERFACE] Interface & Integration Risks
    Reference: `REF_ABAP_SECURITY.md` SEC-RFC-*, SEC-WEB-*
    
    Check: RFC FM contains dialog messages MESSAGE TYPE A/I/W (→ SEC-RFC-3) → RFC FM parameters have type declarations → EXCEPTIONS fully declared → CALL FUNCTION DESTINATION has timeout configured → OData DPC Extension has backend authorization check (→ SEC-WEB-2)
    
    ### [CHANGE] Change Impact Assessment
    Assess: affected database tables (list all read/write/delete operations) → whether SAP standard objects are modified → whether the program shares INCLUDEs or FMs with other programs → Transport prerequisites and cross-system dependencies
    
    ### [COMP] Compliance & Audit Trail
    Check: PII data reads/exports have a compliance basis → FI/CO postings have dual-control → master data changes written to CDHDR/CDPOS → program logs executor/timestamp/parameters → no single person can both initiate and approve (SoD path)
    
    ### [FUNC] Functional Completeness *(Optional)*
    **Execute only when the user provides a requirements specification**; otherwise state the reason for skipping in the report.
    
    If executed: verify program entry points cover business scenarios → boundary condition handling (null/zero/oversized datasets) → core business logic matches requirements → calculation logic is accurate → output fields are complete → integration interfaces transmit data completely
    
    ---
    
    ## Step 3 — Severity Classification
    
    | Level | Label | Release Impact |
    |-------|-------|---------------|
    | 🔴 | CRITICAL | Blocks release |
    | 🟠 | HIGH | Should block release |
    | 🟡 | MEDIUM | Fix in next sprint |
    | 🟢 | LOW | Advisory |
    | ℹ️ | INFO | No action required |
    
    When severity is uncertain, choose the **higher** level.
    
    ---
    
    ## Step 4 — Release Decision
    
    ```
    CRITICAL finding present                        → NO-GO
    HIGH finding in [SEC] or [AUTH]                 → NO-GO (special rule)
    HIGH finding in other dimensions                → CONDITIONAL GO (requires tech lead sign-off)
    MEDIUM / LOW / INFO findings only               → GO
    ```
    
    ---
    
    ## Step 5 — Generate Report
    
    Load `references/REPORT_TEMPLATE.md` and generate the report by strictly following the template structure.
    
    Report language: titles and rule references in **English**; risk descriptions and remediation recommendations in **English**.
    
    File naming: `ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md`
    When a CRITICAL finding is present, prefix: `CRITICAL_ABAP_REVIEW_[PROGRAM_NAME]_[YYYYMMDD].md`
    
    Save to the `reports/` directory specified by the user and confirm the file path upon completion.
    
    > **If file system write access is unavailable**: output the complete report as formatted Markdown in the conversation. Inform the user that no file was saved and suggest they copy the output manually.
    
    ---
    
    ## Behavior Rules
    
    | Rule | Requirement |
    |------|------------|
    | References first | Step 1 must not begin until Step 0 is complete |
    | Evidence-first | Every finding must include a real code snippet (≤ 15 lines); findings without code evidence are invalid |
    | Rule citation | [SEC] / [AUTH] / [STD] findings must cite a rule ID |
    | No false negatives | Objects not retrieved → mark as "partially reviewed"; never write "no issues found" for unread objects |
    | No duplication | Same pattern found in multiple locations → one finding listing all locations |
    | FUNC gate | No requirements document → skip and state reason; do not infer requirements independently |
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.