Post check verification

From CarlosCaPe/octorato · View interactive version

Post check verification is an AI agent skill from the GitHub repository CarlosCaPe/octorato. Post-Check Verification

How to use this skill

Skill file

Post-Check Verification

What

A dedicated phase at the end of every DDL script that independently verifies

the final state of the database. It checks that every expected change was

applied and reports a confirmed/failed count.

Why

"The script ran without errors" is not the same as "the script did what we

wanted." Post-checks verify the outcome, not just the execution. They

catch subtle issues like:

How

-- Phase 3: Post-check
DO $$
DECLARE
    v_confirmed int := 0;
    v_failed    int := 0;
BEGIN
    RAISE NOTICE 'PHASE 3: POST-CHECK';

    -- Verify column exists (new) AND doesn't exist (old)
    IF EXISTS (
        SELECT 1 FROM information_schema.columns
        WHERE table_schema = 'public'
          AND table_name = 'Applicant'
          AND column_name = 'SpecialtyRequirement'
    ) AND NOT EXISTS (
        SELECT 1 FROM information_schema.columns
        WHERE table_schema = 'public'
          AND table_name = 'Applicant'
          AND column_name = 'SpeialtyRequirement'
    ) THEN
        RAISE NOTICE '  [OK] COL 1 SpecialtyRequirement';
        v_confirmed := v_confirmed + 1;
    ELSE
        RAISE NOTICE '  [!!] COL 1 SpecialtyRequirement -- FAILED';
        v_failed := v_failed + 1;
    END IF;

    -- ... repeat for each check ...

    -- Final summary
    RAISE NOTICE '  Checks confirmed: % / %', v_confirmed, v_confirmed + v_failed;

    IF v_confirmed = 8 AND v_failed = 0 THEN
        RAISE NOTICE ' COLUMN RENAME COMPLETE';
    ELSIF v_failed > 0 THEN
        RAISE NOTICE 'PARTIAL -- % check(s) failed', v_failed;
    END IF;
END $$;

What to verify

| Change Type | Positive Check | Negative Check |

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

| Column rename | New name EXISTS | Old name NOT EXISTS |

| Procedure update | New column ref LIKE | Old column ref NOT LIKE |

| Index creation | Index EXISTS in pg_indexes | Index IS VALID |

| FK constraint | Constraint EXISTS | No orphan records |

The "N / N" pattern

Always report confirmed / total:

Checks confirmed: 8 / 8    -- all good
Checks confirmed: 6 / 8    -- something wrong

This makes log scanning trivial -- search for the number and instantly know

the result.

When to Use

Where We Used It

Gotchas

directly, not variables from the previous phase

prevent the post-check from reporting the actual state

checks -- a false positive from only checking one side can mask bugs


Category: Reliability | Origin: All tickets

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.