xiaohongshu
xiaohongshu
clean-abap
Check ABAP code for compliance with Clean ABAP principles. Use this skill when users ask to check, validate, review, or analyze ABAP code for clean code compliance, code quality, best practices, or adherence to Clean ABAP guidelines. Triggers include requests like "check this ABAP code", "is this...
Full skill instructions
This skill provides comprehensive checking of ABAP code against Clean ABAP principles, based on the Clean ABAP style guide which adapts Robert C. Martin's Clean Code for ABAP.
When checking ABAP code for Clean ABAP compliance:
Key Principles:
Check for:
data1, temp, x)Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Key Principles:
Check for:
Structure your analysis as follows:
# Clean ABAP Check Results
## Summary
- Total Issues: [count]
- Critical: [count]
- Major: [count]
- Minor: [count]
## Critical Issues
### [Category] - [Issue Title]
**Location:** Line [X] / Method [name]
**Problem:** [Description of what violates Clean ABAP]
**Recommendation:** [How to fix it]
**Anti-pattern:**
```abap
[problematic code]
Clean code:
[improved code]
[Same format as Critical]
[Same format as Critical]
[Brief summary of code quality and main areas for improvement]
## Priority Levels
**Critical:** Issues that significantly impact maintainability, testability, or could cause bugs
- Magic numbers without constants
- Deep nesting (>3 levels)
- Methods with >5 parameters
- Empty IF branches
- Static classes without interfaces
- Return codes instead of exceptions
**Major:** Issues that reduce code clarity and violate Clean ABAP principles
- Non-descriptive names
- Hungarian notation/prefixes
- Long methods (>20 lines)
- DEFAULT KEY usage
- Commented-out code
- Multiple output parameters
**Minor:** Issues that are stylistic improvements
- Missing inline declarations
- String quotes instead of backticks
- Unnecessary ME-> references
- Formatting inconsistencies
## References
When you need detailed explanations or examples for specific Clean ABAP rules, consult these reference files:
1. **Complete Guidelines**: Read `@skills/clean-abap/references/CleanABAP.md` - the full Clean ABAP style guide with in-depth explanations, rationale, and code examples for all principles
2. **Quick Patterns**: Read `@skills/clean-abap/references/quick-reference.md` - condensed good/bad code examples for common patterns
3. **Review Checklist**: Read `@skills/clean-abap/references/checklist.md` - a checklist format for systematic code reviews
**When to consult references:**
- To provide accurate citations when explaining violations
- To show users the official reasoning behind recommendations
- To find specific code examples to illustrate points
- To answer follow-up questions about Clean ABAP principles
- When encountering edge cases not covered in the summary above
## Examples
### Example 1: Checking a Simple Method
**Input:**
```abap
METHOD calculate.
DATA: lv_result TYPE i,
lv_temp TYPE i.
lv_temp = iv_value1 + iv_value2.
IF lv_temp > 100.
lv_result = lv_temp * 2.
ELSE.
lv_result = lv_temp.
ENDIF.
ev_result = lv_result.
ENDMETHOD.
Output:
# Clean ABAP Check Results
## Summary
- Total Issues: 4
- Critical: 0
- Major: 2
- Minor: 2
## Major Issues
### Names - Hungarian Notation Used
**Location:** Method calculate
**Problem:** Variables use Hungarian notation prefixes (lv_, iv_, ev_) which adds no value and violates Clean ABAP naming guidelines.
**Recommendation:** Remove prefixes and use descriptive names.
**Anti-pattern:**
```abap
DATA: lv_result TYPE i,
lv_temp TYPE i.
Clean code:
DATA(result) = value1 + value2.
IF result > 100.
result = result * 2.
ENDIF.
Location: Method signature Problem: Method uses EXPORTING parameter instead of RETURNING, preventing functional call style. Recommendation: Use RETURNING parameter for single output value.
Anti-pattern:
METHOD calculate
IMPORTING iv_value1 TYPE i
iv_value2 TYPE i
EXPORTING ev_result TYPE i.
Clean code:
METHOD calculate
IMPORTING value1 TYPE i
value2 TYPE i
RETURNING VALUE(result) TYPE i.
Location: Lines 2-3 Problem: Variables declared up-front instead of inline, increasing distance between declaration and usage. Recommendation: Use inline declarations with DATA( ).
Location: Lines 5-9 Problem: Could use COND for conditional assignment instead of IF-ELSE. Recommendation: Use functional constructs.
Clean code:
METHOD calculate
IMPORTING value1 TYPE i
value2 TYPE i
RETURNING VALUE(result) TYPE i.
DATA(sum) = value1 + value2.
result = COND #( WHEN sum > 100 THEN sum * 2 ELSE sum ).
ENDMETHOD.
The code is functional but uses outdated ABAP patterns. Main improvements needed: remove Hungarian notation, use RETURNING instead of EXPORTING, prefer inline declarations, and use functional language constructs. After these changes, the code will be significantly cleaner and more maintainable.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience