Sql release review

From Crapule421/tiger-team · View interactive version

Sql release review is an AI agent skill from the GitHub repository Crapule421/tiger-team. Review a SQL release script (Oracle, PostgreSQL, SQL Server, Db2, MySQL/MariaDB) for idempotence, rollback, locks, volumetry and engine traps - annotated findings, GO/NO-GO, corrected and rollback scripts. Use before any database release.

How to use this skill

Skill file

SQL release script review

Input: $ARGUMENTS

You do not see the prior conversation: work only from the input above and the files it points to.

0. Intake

1. Confidentiality gate (mandatory, before any analysis)

Stop and ask the user for an anonymized version - without producing the review - if the input contains:

Reply only with the category detected, the location (line numbers, without quoting the value), and a request for a sanitized version (placeholders such as <PASSWORD>, fictitious data). A placeholder like <PASSWORD> or &pwd substitution variable is not a live secret.

2. Load knowledge

Read ${CLAUDE_PLUGIN_ROOT}/skills/dba-reference/SKILL.md - in particular sections 1 (engine comparison), 3 (locking traps), 5 (backup/restore point), 6 (security), 8 (release script best practices) and 9 (checklist).

3. Analysis steps

  1. Inventory: list each statement/block with line range, type (DDL, DML, DCL, code object, session setting, control), target object.
  2. Execution framework: stop-on-error, spool/log, timing, client used (SQL*Plus, psql, sqlcmd, db2 CLP, mysql), version table/migration tool, prerequisite checks, environment guard (script cannot run on the wrong database/schema).
  3. Idempotence: can the script be re-run after a partial failure? Guard each DDL (IF [NOT] EXISTS / catalog check / CREATE OR REPLACE) and reference-data DML (MERGE / NOT EXISTS / ON CONFLICT).
  4. Transaction scope: where commits happen (explicit, implicit DDL commit in Oracle/MySQL, autocommit of the client, GO batches, XACT_ABORT), what a failure in the middle leaves behind, locks held until commit.
  5. Locks and duration per statement: lock level taken (e.g. PostgreSQL ACCESS EXCLUSIVE on ALTER TABLE, MySQL metadata lock, SQL Server Sch-M, Oracle DDL lock), whether it rewrites/scans the table, online alternative, lock timeout set, expected duration given the assumed volume. Flag anything that blocks reads or writes for more than a few seconds on a busy table.
  6. Volumetry: rows touched by each DML (predicate selectivity, index on predicate), batching, undo/redo/WAL/transaction log volume, temp/sort space, replication lag impact, index build space.
  7. Rollback: rollback script present? per-step? tested? Destructive operations (DROP, TRUNCATE, column type narrowing, DELETE without before-image) -> need backup table, deferred drop (expand/contract) or restore point.
  8. Engine-specific traps: e.g. Oracle unindexed FK, invalid objects after DDL, & substitution variables in data; PostgreSQL CREATE INDEX CONCURRENTLY inside a transaction (fails) or leaving INVALID index, NOT VALID/VALIDATE not used, type change rewrite; SQL Server missing GO before CREATE PROCEDURE, lock escalation, NOLOCK, ONLINE requires Enterprise; Db2 REORG PENDING after ALTER, packages to rebind, RUNSTATS; MySQL online DDL fallback to COPY, MDL waits, implicit commit; all: NULL semantics in NOT IN, UPDATE/DELETE without WHERE, non-deterministic ROWNUM/TOP/LIMIT without ORDER BY, implicit conversions disabling indexes, character set/collation of new columns, date literals depending on NLS/locale.
  9. Security and compliance: grants least privilege (no PUBLIC, no ANY/sysadmin), no clear-text passwords, no personal data in literals or logs, audit impact, schema owner vs app account.
  10. Post-release: statistics, recompilation, post-check queries, monitoring.

Severity: Blocker (data loss/corruption risk, prod outage, non-recoverable failure), Major (long blocking lock, non-rerunnable, missing rollback for risky step), Minor (best practice, readability, small perf issue), Info. This finding scale is assessed per statement; when a finding is carried into the Risks table, map Blocker → Critical, Major → High, Minor → Medium, Info → Low.

4. Output (Markdown)

Verdict

GO / GO with conditions / NO-GO, one paragraph: why, engine/version assumed, estimated total duration and lock impact, maintenance window needed (yes/no).

Statement inventory

| # | Lines | Type | Object | Lock level / impact | Est. duration | Idempotent | Rollback |

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

Findings

| ID | Severity | Line(s) | Statement (short) | Issue | Fix |

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

| SQL-01 | Blocker | 12-14 | ALTER TABLE orders ... | ... | ... |

Corrected script

Only if at least one Major/Blocker finding. Full script for the identified engine, commented (-- [SQL-01] ...) where changed, including: header (purpose, prerequisites, duration, rollback name), stop-on-error and logging, lock timeout, environment guard, idempotent guards, batched DML, statistics, post-checks. Never invent object names that are not in the input; use the input's names and <PLACEHOLDER> where information is missing.

Rollback script

Step-by-step reverse order, idempotent, with the data-restoration strategy (backup table, before-image, restore point) and its limits (data written after the release). State clearly if rollback is impossible without restore.

Pre-checks / post-checks

Queries to run before (object state, volumes, blocking sessions, free space, backup/restore point present) and after (objects valid, row counts, constraints validated, smoke test).

Risks

| Risk | Criticality | Mitigation |

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

| ... | Critical/High/Medium/Low | ... |

Handoffs

One line per relevant expert, only when there is a real point for them, using: project-manager, enterprise-architect, devsecops-expert, security-expert, dba-expert, scheduling-expert, integration-expert, erp-expert, infra-expert, ibmi-expert. Format:

Only when there is a real point, one typed line per handoff: → <agent-name> | <claim: what you assert or need, one sentence> | <evidence: source, file:line, or "assumption"> | <needs: confirm / adjust / provide <what>>. Names: project-manager, enterprise-architect, devsecops-expert, security-expert, dba-expert, scheduling-expert, integration-expert, erp-expert, infra-expert, ibmi-expert. Example: → infra-expert | the CFT acknowledgment flow SRV-SAP-01 → SRV-BATCH-01 is missing from the flow matrix | interface contract §4 | provide the firewall rule and port. A settled point is not a handoff.

Open questions

Numbered, each with the impact on the verdict.

Assumptions

Numbered: engine/version, volumes, window, HA topology, client tool, anything inferred.

Answer in the language used in the input.

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.