self-correcting-loop
Skill9 starsChanged 7 months agoMITView on GitHub
Use when generated or modified ABAP code has syntax errors, ATC findings, test failures, or activation issues. Runs an iterative fix-check-fix loop until the code is clean, tested, and activated. Equivalent to a persistent development TDD cycle.
In this repository61 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- brainstormingSkill
- change-managementSkill
- deep-interviewSkill
- estimationSkill
- fit-gap-analysisSkill
- process-designSkill
- project-kickoffSkill
- consultingSkill
- solution-architectureSkill
- value-advisorySkill
- cutover-planningSkill
- data-migrationSkill
- go-live-readinessSkill
- hypercareSkill
- deliverySkill
- testing-strategySkill
- transport-releaseSkill
- autopilotSkill
- code-generationSkill
- code-reviewSkill
- development-workflowSkill
- performance-tuningSkill
- program-to-specSkill
- developmentSkill
- troubleshootingSkill
- delivery-factorySkill
- sap-doctorSkill
- metaSkill
- solution-acceleratorSkill
- team-executionSkill
- using-sap-superpowersSkill
- verification-before-completionSkill
- writing-sap-skillsSkill
- abap-cloudSkill
- analyticsSkill
- aribaSkill
- btpSkill
- concurSkill
- coSkill
- ewmSkill
- fieldglassSkill
- fiSkill
- integration-suiteSkill
- jouleSkill
- mmSkill
- pmSkill
- ppSkill
- qmSkill
- sdSkill
- security-grcSkill
- sfSkill
- modulesSkill
- system-adminSkill
- tmSkill
- activate-methodologySkill
- clean-core-strategySkill
- joule-strategySkill
- rise-licensingSkill
- s4hana-migrationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
ALWAYS TRACK FIX HISTORY: Every fix attempt is logged with: what was wrong, what was changed, and whether the check passed.
- Distinctive: line 18
STOP AFTER 10 ITERATIONS: If 10 fix cycles cannot resolve the issue, the problem is architectural, not syntactical.
- Distinctive: line 20
NEVER WEAKEN THE CHECK TO PASS THE GATE: If ATC flags a finding, fix the code — do not suppress the finding.
- Distinctive: line 40
Before entering the loop:
- Very specific: line 44
If entering from autopilot, these are inherited from the pipeline context.
- Distinctive: line 76
Run ABAP syntax check on all modified objects
- Distinctive: line 81
Run ATC with project check variant (Cloud or Standard)
- Distinctive: line 88
All tests must pass. Failed tests trigger code fix (not test deletion).
- Distinctive: line 93
Verify no remaining inactive objects in the transport
- Very specific: line 132
After completing this skill, return to the invoking skill (typically autopilot or code-generation) and continue the pipeline.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Self-Correcting Loop
This skill runs an iterative fix → verify → fix cycle on ABAP code until all quality gates pass. It does not stop after one fix attempt — it loops until the code is syntax-clean, ATC-clean, test-passing, and successfully activated.
Iron Laws
- NEVER DECLARE SUCCESS AFTER ONE FIX. A fix that resolves one error often introduces another. Always re-run the full verification after every fix. The loop is: fix → full check → assess → repeat.
- NEVER FIX MORE THAN ONE ISSUE AT A TIME. Batch fixes create cascading failures that are impossible to debug. Fix the first error, verify, then fix the next. Surgical precision, not shotgun patches.
- ALWAYS TRACK FIX HISTORY. Every fix attempt is logged with: what was wrong, what was changed, and whether the check passed. This prevents circular fixes (fixing A breaks B, fixing B breaks A).
- STOP AFTER 10 ITERATIONS. If 10 fix cycles cannot resolve the issue, the problem is architectural, not syntactical. Escalate to the user with the fix history — do not loop forever.
- NEVER WEAKEN THE CHECK TO PASS THE GATE. If ATC flags a finding, fix the code — do not suppress the finding. If a test fails, fix the logic — do not delete the test. Weakening gates is not fixing.
Rationalization Table
| Agent Will Try To... | Why It Seems Reasonable | Why It Fails | Counter |
| Fix multiple errors at once | "I can see three errors, let me fix them all" | Multi-fix creates merge conflicts in your own reasoning. One change triggers side effects in others. | Iron Law 2. One fix per iteration. |
| Suppress ATC findings instead of fixing | "This is a false positive, I'll add a pragma" | If it were a false positive, explain why. Most "false positives" are real findings the developer doesn't want to fix. | Iron Law 5. Fix the code. |
| Skip re-running tests after a fix | "I only changed a comment, tests don't need to re-run" | You think you only changed a comment. Verify. | Iron Law 1. Full check after every fix. |
| Continue past 10 iterations | "I'm so close, one more try" | 10 failed attempts means the approach is wrong. More iterations won't help. | Iron Law 4. Escalate to user. |
| Delete a failing test | "The test is wrong, not the code" | Maybe. Document why the test is wrong. Write a better test. Don't delete evidence. | Iron Law 5. Fix tests, don't delete them. |
Red Flags
- "This should fix everything..." → Iron Law 2. Fix one thing. Check. Then next.
- "Let me just suppress this warning..." → Iron Law 5. Fix the code.
- "Almost there, one more round..." → Check iteration count. If > 10, stop.
- "The test is too strict..." → The test is the specification. Fix the code.
<HARD-GATE>
Before entering the loop:
1. The code must be in a compilable state (or the first error identified)
2. The check suite must be defined (which checks to run: syntax, ATC, unit tests, activation)
3. The fix history log must be initialized
If entering from `autopilot`, these are inherited from the pipeline context.
</HARD-GATE>Loop Protocol
INITIALIZE
→ Define check suite: [syntax_check, atc_check, unit_tests, activation]
→ Initialize fix history: []
→ Set iteration = 0, max_iterations = 10
LOOP
→ iteration += 1
→ IF iteration > max_iterations: ESCALATE to user with fix history
→ RUN check suite
→ IF all checks pass: EXIT loop → SUCCESS
→ IDENTIFY first failing check
→ ANALYZE root cause of failure
→ APPLY single targeted fix
→ LOG fix to history: { iteration, error, fix_applied, files_changed }
→ GOTO LOOP
EXIT
→ Produce loop summary (iterations, fixes applied, final status)Check Suite Details
Syntax Check:
- Run ABAP syntax check on all modified objects
- Parse error messages for line number and error type
- Common fixes: missing declarations, type mismatches, obsolete statements
ATC Check:
- Run ATC with project check variant (Cloud or Standard)
- Categorize findings: P1 (must fix), P2 (should fix), P3 (consider)
- P1 and P2 must be resolved. P3 are documented but not blocking.
Unit Tests:
- Execute all test classes for modified objects
- Parse test results for: pass, fail, error, skip
- All tests must pass. Failed tests trigger code fix (not test deletion).
Activation:
- Activate all objects in dependency order (interfaces → classes → views)
- Handle dependent object activation failures
- Verify no remaining inactive objects in the transport
Fix History Template
SELF-CORRECTING LOOP — FIX HISTORY
====================================
Object: [Object name]
Started: [Timestamp]
Check Suite: [syntax, atc, unit_tests, activation]
Iteration 1:
Error: [Error description]
Root Cause: [Analysis]
Fix: [What was changed]
Files: [Modified files]
Result: [Pass/Fail — which check]
Iteration 2:
...
FINAL STATUS: ✅ ALL CHECKS PASS (iteration [N]) / ❌ ESCALATED (iteration 10)
Total fixes applied: [N]Verification
This skill is complete ONLY when ALL of the following are true:
- All checks in the check suite pass
- Fix history is complete with every iteration logged
- No ATC findings were suppressed (all were fixed)
- No tests were deleted or weakened
- Loop completed within 10 iterations OR escalated to user
Evidence required: Fix history log, final check suite results (all green).
Next Skill
After completing this skill, return to the invoking skill (typically autopilot or code-generation) and continue the pipeline.
Cross-References
autopilot— Primary invoker of this skillcode-generation— May invoke when generated code has issuescode-review— May invoke when review findings need fixestroubleshooting— Invoke if the error is a runtime issue, not a compile-time issue
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

