Install
$ agentstack add skill-matt1as-claude-abap-skills-refactor ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
clean-abap:refactor
Refactor existing ABAP code to conform to the Clean ABAP rule set in ../CLAUDE.md (relative to this skill's directory).
What this command does
You are refactoring ABAP source code to bring it into compliance with the Clean ABAP rule set. Style and structure only — business logic stays identical. If a change would alter what the code does, you do not make it; you flag it instead.
Inputs
Accept any of the following. If nothing is provided, ask which target the user wants.
- A code block pasted into the conversation (the most reliable path today)
- An ABAP object name — only works if a community MCP exposes source reads. The official
SAPSE.adt-vscode1.0 MCP does not. - A package name — only works with a community MCP that exposes repository search and source reads. Refactor object by object, never as a single bulk change.
If only the official MCP is connected, ask the user to paste the source from ADT in VS Code; then paste the refactored version back manually.
Procedure
- Load the rule set. Read every
## RULE:block in../CLAUDE.md. Those are the only refactoring targets. - Get the source. If pasted inline, use it. If only an object name was given, attempt source-read via whichever MCP is connected; if no MCP exposes source reads, ask the user to paste it from ADT. The official
SAPSE.adt-vscode1.0 MCP does not have a source-read tool. - Run the review first. Internally, perform the same analysis as
/clean-abap:review. Use the prioritised list as your refactor plan. - Refactor in passes, in this order. Do not skip ahead:
- Naming pass — apply
use-problem-domain-names,no-magic-numbers-or-literals - Declaration pass — apply
prefer-inline-declarations,no-default-key-on-internal-tables - Expression pass — apply
use-string-templates-not-concatenate,prefer-is-not-initial-over-negation,prefer-case-over-long-if-elseif,use-table-expressions-not-read-table-plus-sy-subrc - Method shape pass — apply
methods-do-one-thing-and-stay-small,at-most-three-importing-parameters,prefer-returning-over-exporting - Error pass — apply
class-based-exceptions-not-sy-subrc,catch-specific-exceptions-not-cx-root - Class shape pass — apply
final-classes-and-private-members-by-default,prefer-new-over-create-object - Preserve behaviour. After every pass, mentally diff the program logic. If you cannot prove a change is behaviour-preserving (e.g. a refactor would change exception types caught upstream, would change SELECT result order, would alter authority checks), stop and ask instead of guessing.
- Show the diff before writing back. Produce a per-method or per-section before/after diff. Annotate every change with the rule name that motivated it.
- Ask for confirmation before writing back via MCP. Explicit confirmation per object — not a blanket yes for a package. After write-back, confirm the object activated cleanly.
Behaviour preservation — non-negotiable
These changes are out of scope for this command — they alter behaviour:
- Changing exception classes raised by a public method (callers catch them)
- Changing the order or set of database rows returned by a SELECT
- Removing authority checks, even if they look redundant
- Inlining or extracting code that crosses a
COMMIT WORK/ROLLBACK WORK - Changing the public signature of a method except
EXPORTING → RETURNINGfor a single output where no caller relies onIS SUPPLIED
If a Clean ABAP rule appears to require one of the above, flag it in the report and skip the change. Behaviour change belongs in a separate task, not in a style refactor.
Output format
# Clean ABAP Refactor —
## Plan
1. — occurrences
2. — occurrences
...
## Changes
###
**Rule:**
**Before:**
` ` `abap
` ` `
**After:**
` ` `abap
` ` `
**Rationale:**
(repeat per change)
## Behaviour-preserving check
- [ ] No public method signature changed (except EXPORTING→RETURNING for single output)
- [ ] No exception classes added or removed from public methods
- [ ] No SELECTs reordered or filtered differently
- [ ] No authority checks removed
- [ ] No statements moved across COMMIT/ROLLBACK boundaries
## Skipped
at —
## Confirmation
Write these changes back to via MCP? (yes / no / per-method)
Hard rules for this command
- Style and structure only. Never change what the code does.
- One object at a time. No silent batching across a package.
- Confirm before write-back. Always. Even if the user said yes for a previous object.
- Activate after writing. If activation fails, report the error and revert the write. Do not patch through activation errors.
- No rule-by-rule chatter. Group changes by method or section; one diff per change.
- If a Clean ABAP rule conflicts with the ABAP Cloud / RAP overlay, the overlay wins. Apply the overlay version of the rule. Note the conflict in the report.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: matt1as
- Source: matt1as/claude-abap-skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.