skills-catalog/ln-652-transaction-correctness-auditor/SKILL.md
Checks transaction scope, missing rollback handling, long-held transactions, trigger/notify interaction. Use when auditing transaction correctness.
npx skillsauth add levnikolaevich/claude-code-skills ln-652-transaction-correctness-auditorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Type: L3 Worker
Specialized worker auditing database transaction patterns for correctness, scope, and trigger interaction.
MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
MANDATORY READ: Load shared/references/mcp_tool_preferences.md and shared/references/mcp_integration_patterns.md
Receives contextStore with: tech_stack, best_practices, db_config (database type, ORM settings, trigger/notify patterns), codebase_root, output_dir.
Domain-aware: Supports domain_mode + current_domain.
Use hex-graph first when reference chains or call paths materially improve transaction analysis. Use hex-line first for local code/config reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in Read/Grep/Glob/Bash and state the fallback in the report.
MANDATORY READ: Load shared/references/two_layer_detection.md for detection methodology.
Parse context from contextStore
Discover transaction infrastructure
pg_notify, CREATE TRIGGER, NOTIFY)expire_on_commit, autocommit, isolation level)Scan codebase for violations
Collect findings with severity, location, effort, recommendation
Calculate score using penalty algorithm
Write Report: Build full markdown report in memory per shared/templates/audit_worker_report_template.md, write to {output_dir}/ln-652--global.md in single Write call
Return Summary: Return minimal summary to coordinator (see Output Format)
What: UPDATE without commit when DB trigger/NOTIFY depends on transaction commit
Detection:
pg_notify|NOTIFY|CREATE TRIGGER|CREATE OR REPLACE FUNCTION.*trigger in alembic/versions/, migrations/repo.*update|session\.execute.*update|\.progress|\.status related to trigger tablescommit() between sequential updates:
commit(), NOTIFY events are deferred until final commitSeverity:
Exception: Single atomic operation with no intermediate observable state -> downgrade CRITICAL to MEDIUM. Transaction scope documented as intentional (ADR, architecture comment) -> downgrade one level
Recommendation:
session.commit() at progress milestones (throttled: every N%, every T seconds)Effort: S-M (add strategic commits or redesign notification path)
What: Single transaction wraps unrelated operations, including slow external calls
Detection:
async with session.begin() or explicit transaction blocksawait httpx., await aiohttp., await requests., await grpc.open(, .read(, .write(Severity:
Recommendation: Split into separate transactions; use Saga/Outbox pattern for cross-service consistency
Effort: M-L (restructure transaction boundaries)
What: Logically atomic operations split across multiple commits
Detection:
session.commit() calls for operations that should be atomicSeverity:
Recommendation: Wrap related operations in single transaction using async with session.begin() or unit-of-work pattern
Effort: M (restructure commit boundaries)
What: session.commit() without proper error handling and rollback
Detection:
session.commit() not inside try/except block or context managersession.commit() in try without session.rollback() in exceptawait session.commit() in service methodsasync with session.begin() auto-rollbacks (safe)Severity:
Recommendation: Use async with session.begin() (auto-rollback), or add explicit try/except/rollback pattern
Effort: S (wrap in context manager or add error handling)
What: Transaction open during slow/blocking operations
Detection:
begin() and commit()await calls to external services (network latency)time.sleep() or asyncio.sleep()Severity:
Recommendation: Minimize transaction scope; prepare data before opening transaction, commit immediately after DB operations
Effort: M (restructure code to minimize transaction window)
What: Publisher channel/topic name does not match subscriber channel/topic name
Detection:
pg_notify('channel_name', ...), NOTIFY channel_name\.publish\(["']|\.emit\(["']|redis.*publish\(["']|\.send_to\(["'] in src/, app/{channel_name, source_file, source_line, technology}LISTEN\s+(\w+) in application code (not just migrations)\.subscribe\(["']([^"']+) in src/, app/\.on\(["']([^"']+) in handler/listener directories{channel_name, source_file, source_line, technology}publisher.channel_name == subscriber.channel_name -> OKLayer 2 Context Analysis (MANDATORY):
CHANNEL = os.environ["EVENT_CHANNEL"]) and both publisher and subscriber use same source -> NOT a mismatchjob_events:{job_id}) and both sides use same template -> NOT orphaned**/test*/**, **/*.test.*) from both publisher and subscriber discoverySeverity:
job_events, subscriber listens on job_event)Recommendation:
Effort: S (fix typo/add constant) to M (design missing subscriber/publisher)
MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/references/audit_scoring.md.
MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/templates/audit_worker_report_template.md.
Write JSON summary per shared/references/audit_summary_contract.md. In managed mode the caller passes both runId and summaryArtifactPath; in standalone mode the worker generates its own run-scoped artifact path per shared contract.
Write report to {output_dir}/ln-652--global.md with category: "Transaction Correctness" and checks: missing_intermediate_commits, scope_too_wide, scope_too_narrow, missing_rollback, long_held_transaction, event_channel_consistency.
Return summary per shared/references/audit_summary_contract.md.
When summaryArtifactPath is absent, write the standalone runtime summary under .hex-skills/runtime-artifacts/runs/{run_id}/evaluation-worker/{worker}--{identifier}.json and optionally echo the same summary in structured output.
Report written: .hex-skills/runtime-artifacts/runs/{run_id}/audit-report/ln-652--global.md
Score: X.X/10 | Issues: N (C:N H:N M:N L:N)
MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
async with session.begin() is safe)MANDATORY READ: Load shared/references/audit_worker_core_contract.md.
{output_dir}/ln-652--global.md (atomic single Write call)shared/references/audit_output_schema.mdVersion: 1.1.0 Last Updated: 2026-03-15
testing
Drafts and publishes fact-checked GitHub Discussions announcements. Use for releases, updates, or project news; not for release creation or issue responses.
testing
Prepares and publishes a tagged GitHub release from repository evidence. Use for an explicit release request; not for ordinary commits, packages, or community news.
testing
Validates, commits, pushes, and remotely verifies approved repository changes. Use when publication is requested; not for releases, package publishing, or announcements.
development
Reviews standalone skills and their configured distribution surfaces before publication. Use for skill release readiness; not for product code or implementation-plan review.