Post write chain

From 5throck/ai-workspace-standards · View interactive version

Post write chain is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Use after ANY WriteSource, EditSource, or Activate operation on SAP ABAP objects. Enforces the mandatory quality gate: SyntaxCheck → RunUnitTests → GetCodeCoverage → RunATCCheck. Trigger automatically after every ABAP write operation.

How to use this skill

Skill file

⚠️ Desktop App: PostToolUse hooks do not fire automatically. Run /post-write <object-name> manually after every WriteSource or EditSource in Desktop App sessions.

Post-Write Mandatory Chain

Applies to all tools: Claude Code CLI, Antigravity, Gemini CLI

After ANY WriteSource / EditSource / Activate, the executing agent MUST run these four steps in order:

| Step | Tool | Pass Condition |

|------|------|----------------|

| 1 | SyntaxCheck | 0 errors |

| 2 | RunUnitTests | 0 failures |

| 3 | GetCodeCoverage | ≥ 70% statement coverage on the changed object (new objects); no regression vs. prior run (existing objects) |

| 4 | RunATCCheck | 0 Priority-1 findings |

ATC Priority Levels

Code Coverage Gate (Step 3)

Output Format

Report each step result clearly:

✅ SyntaxCheck — PASSED
✅ RunUnitTests — PASSED (N tests, 0 failures)
✅ GetCodeCoverage — PASSED (82% statement coverage, threshold 70%)
✅ RunATCCheck — PASSED (0 Priority-1, 0 Priority-2, N Priority-3)

If any step fails:

❌ SyntaxCheck — FAILED
  Error: <error message>
  Line: <line number>
Action required: Fix the syntax error before proceeding.
❌ GetCodeCoverage — FAILED (54% statement coverage, threshold 70%)
Action required: Add ABAP Unit test cases covering the uncovered branches,
                  or record a waiver with justification in the QA report.

Rules

  1. Never skip SyntaxCheck — even for "trivial" one-line changes.
  2. If SyntaxCheck fails, fix the code and re-run before proceeding to RunUnitTests.
  3. If RunUnitTests fails, do not run GetCodeCoverage or RunATCCheck until the test logic is fixed.
  4. If GetCodeCoverage falls below threshold (or regresses on an existing object) without a recorded waiver, do not proceed to RunATCCheck.
  5. Priority-1 ATC findings block all further steps including transport release.
  6. In Gemini / Antigravity sessions: route all four steps through sap_execute with "action": "SyntaxCheck", "action": "RunUnitTests", "action": "GetCodeCoverage", "action": "RunATCCheck".

Claude Code Desktop App Note

PostToolUse hooks do not fire automatically in the Desktop App. Run all three steps of this chain manually after each write in Desktop sessions using /post-write <object-name>.

Context

This skill enforces a mandatory four-step quality gate that runs after every ABAP write operation (WriteSource, EditSource, or Activate). The chain ensures that no modified object reaches a transport request or production without passing syntax validation, unit tests, code coverage thresholds, and ATC checks. It is the primary safeguard against regressions in the ABAP development workflow.

When to Use

Execution Steps

  1. SyntaxCheck — Run syntax validation on the modified object. Must return 0 errors to proceed.
  2. RunUnitTests — Execute all ABAP Unit tests for the object. Must return 0 failures to proceed.
  3. GetCodeCoverage — Measure statement coverage. New objects require 70% minimum; existing objects must not regress below prior baseline.
  4. RunATCCheck — Execute ABAP Test Cockpit checks. Priority-1 findings block deployment.
  5. If any step fails, fix the issue and re-run from the failed step. Do not skip forward.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.