audit-sqlite

Audit SQLite persistence code for consistent locking and idempotent schema changes.

Updated Feb 26, 2026
One-click install
npx skills add https://github.com/ElPoot/contabilidad --skill audit-sqlite
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-sqlite
Source: https://github.com/ElPoot/contabilidad/tree/main/.agents/skills/audit-sqlite
Command: npx skills add https://github.com/ElPoot/contabilidad --skill audit-sqlite

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents database corruption and runtime failures by ensuring every SQLite access follows a consistent locking and idempotent schema pattern across the backend persistence layer.

Core Features & Use Cases

  • Concurrency-safe SQLite access auditing: Checks whether code uses threading.Lock() consistently (including proper with self._lock: usage) to avoid “database is locked” and race conditions.
  • Schema idempotency verification: Reviews whether schema operations (e.g., CREATE TABLE ... IF NOT EXISTS, ALTER TABLE patterns) are repeatable and safe.
  • GUI write isolation validation: Ensures SQLite writes are not performed directly from GUI paths by comparing modules against the ClassificationDB reference pattern.

Use case: When refactoring or adding features to the contabilidad classifier workflow, audit gestor_contable/core/* SQLite modules to confirm they match the locking strategy used by ClassificationDB.

Quick Start

Ask the AI to run an audit of the SQLite modules in gestor_contable/core/ against the ClassificationDB locking and schema/idempotency pattern and produce the required “AUDITORIA: PERSISTENCIA SQLITE Y LOCKING” report with any real code findings.

Frequently Asked Questions about audit-sqlite

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent SQLite race conditions and database locked errors in Python?

Preventing SQLite race conditions requires consistent threading lock usage across all database access. By wrapping sqlite3.connect operations with a threading.Lock and enforcing `with self._lock:` for reads and writes, you eliminate concurrent database locked errors and data corruption.

How do I make SQLite schema changes idempotent and safe for repeated execution?

Making SQLite schema changes idempotent requires using repeatable operations such as `CREATE TABLE IF NOT EXISTS` and safe ALTER TABLE patterns. Verifying schema idempotency ensures database migrations can execute multiple times without failing or duplicating table structures.

How do I audit SQLite persistence code for concurrency bugs and threading lock usage?

Auditing SQLite persistence code for concurrency bugs involves scanning modules for sqlite3.connect calls and comparing reads and writes against consistent `with self._lock:` threading lock usage. The audit reports only actual locking inconsistencies evidenced by the current code.

Why should I avoid direct GUI-driven SQLite writes in my backend persistence layer?

Avoiding direct GUI-driven SQLite writes prevents concurrency bugs by isolating database access in the backend persistence layer. Comparing modules against a reference pattern ensures all writes follow consistent locking strategies rather than uncontrolled GUI paths.

What are the limitations of using threading locks for SQLite database concurrency?

A limitation of using threading locks for SQLite database concurrency is that it requires scanning every sqlite3.connect call to ensure strict `with self._lock:` enforcement. The audit reports only differences evidenced by current code, meaning gaps outside scanned modules remain vulnerable to race conditions.