{"id":"4f837979-c6a9-4daa-8bf9-940410288bf4","slug":"sqlite-audit-kit","kind":"skill","name":"sqlite-audit-kit","summary":"Read-only SQLite migration audit: compare schema, row counts, NULLs, foreign keys and duplicate keys. SQLite 只读审计与迁移前后对比。","owner":"fuxing0910-hue","repoUrl":"https://github.com/fuxing0910-hue/sqlite-audit-kit","license":"MIT","licenseTier":"permissive","trust":"community","stars":1,"match":null,"fewStars":true,"format":"skill","createdAt":"2026-10-08T12:11:29.000Z","addedAt":"2026-10-21T11:43:58.971Z","logoUrl":"https://avatars.githubusercontent.com/u/267694386?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["databases","developer-tools","data-analytics"],"tags":["cli","data-quality","database","developer-tools","migrations","offline","python","sqlite"],"runtime":"python","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-25T20:38:17.535Z","sample":false,"url":"https://conduits.dev/tools/sqlite-audit-kit","language":"Python","transports":["stdio"],"install":{"pypi":"sqlite-audit-kit"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# SQLite Audit Kit\n\n[English](README.md) | [简体中文](README.zh-CN.md)\n\n**Check what changed in SQLite before you ship a migration.**\n\nCapture a snapshot before an application update and another afterward. SQLite Audit Kit compares schema, exact row counts, NULLs, storage types, foreign-key violations, and the candidate keys you specify, then produces JSON and one offline HTML report.\n\n**[Open the synthetic report →](https://fuxing0910-hue.github.io/sqlite-audit-kit/demo.html)** · [Project site](https://fuxing0910-hue.github.io/sqlite-audit-kit/) · [Releases](https://github.com/fuxing0910-hue/sqlite-audit-kit/releases) · [If useful, star on GitHub ☆](https://github.com/fuxing0910-hue/sqlite-audit-kit)\n\n[How to compare SQLite databases before and after a migration](https://fuxing0910-hue.github.io/sqlite-audit-kit/sqlite-migration-audit.html) — read-only schema, row-count, NULL, foreign-key and duplicate-key checks, with a local report.\n\n```text\nGate: regression | 2 regression findings\n  - Duplicate key counts increased in readings (sample_key)\n  - Foreign-key violation count increased in readings\n```\n\nFor app updates, migration reviews, and CI checks. The synthetic demo reproduces both findings; open the report without installing anything.\n\n- **Read existing databases.** Read-only connections and one transaction per scan produce a consistent snapshot.\n- **Measure exact counts.** Full scans cover rows, NULLs, actual storage types, foreign keys, and explicitly selected keys.\n- **Use it in automation.** JSON, standalone HTML, and an optional regression exit code; no server, API key, or third-party runtime dependencies.\n\n**Before sharing:** reports omit record payloads but include schema SQL, defaults, and SQLite diagnostics. Full scans can be expensive and hold read locks.\n\n[![SQLite Audit Kit report: comparison summary, constraint findings, and column measurements](docs/images/demo-preview.jpg)](https://fuxing0910-hue.github.io/sqlite-audit-kit/demo.html)\n\n## Try it locally\n\nRequires Python 3.10+ with the standard `sqlite3` module.\n\n```sh\ngit clone https://github.com/fuxing0910-hue/sqlite-audit-kit.git\ncd sqlite-audit-kit\npython -m sqlite_audit demo --output-dir demo\n```\n\nOpen `demo/report.html`. The databases and findings are synthetic; the report has no scripts or external assets.\n\nTo compare two existing databases, generate snapshots with the same key rules:\n\n```sh\npython -m sqlite_audit scan before.db --output before.json --key readings:sample_key\npython -m sqlite_audit scan after.db --output after.json --key readings:sample_key\npython -m sqlite_audit compare before.json after.json --html report.html --json report.json --fail-on-regression\n```\n\nInstall with `python -m pip install .` to use `sqlite-audit`. The scanner reads existing files; it does not perform application migrations or repairs.\n\n## Let a coding agent use it\n\nAsk a compatible agent:\n\n> Compare these two SQLite snapshots read-only. Check whether foreign-key violations or duplicates for my specified keys increased, and write a local report.\n\nThere are four entry points:\n\n- **CLI:** `scan` existing databases and `compare` saved JSON snapshots.\n- **Python API:** `KeySpec`, `scan_database()`, and `compare_snapshots()` for integrations.\n- **Function tools:** declaration exports for GPT, DeepSeek, Claude and Gemini API applications, with a validated local dispatcher.\n- **Installable skill:** [sqlite-migration-audit](skills/sqlite-migration-audit/SKILL.md), task instructions for choosing the read-only audit workflow from a natural-language request.\n\nInstall the skill directly from this repository:\n\n```sh\nnpx skills add fuxing0910-hue/sqlite-audit-kit --skill sqlite-migration-audit\n```\n\nThe Skills CLI discovers and installs instructions from the specified repository. Node.js is needed only for that optional installer; skill commands run on Python 3.10+. This direct-install command does not depend on a directory listing or ranking.\n\nSee [the agent integration guide](docs/agents.md) for executable routing and installation choices. Python callers can use:\n\n```python\nfrom sqlite_audit import KeySpec, scan_database, compare_snapshots\n\nkeys = [KeySpec(\"readings\", (\"sample_key\",))]\nbefore = scan_database(\"before.db\", keys)\nafter = scan_database(\"after.db\", keys)\ncomparison = compare_snapshots(before, after)\n```\n\n## Gate semantics and scope\n\nWith `--fail-on-regression`, exit `0` means no counted regression in comparable checks, `1` means a counted regression, and `2` means incomplete coverage or invalid input. A definite regression takes precedence over incomplete coverage.\n\nChecks compare constraint counts, not application semantics. Key checks are opt-in and exclude rows with NULL key components. Ordinary `main` tables are supported; virtual and shadow tables are explicitly unsupported. Unsupported or unfinished checks do not imply a healthy database.\n\n[Complete technical reference](docs/reference.md) · [Contributing](CONTRIBUTING.md) · [MIT License](LICENSE)\n\n```sh\npython -m unittest discover -s tests -v\n```\n\nOriginal implementation, developed with AI assistance. See the reference for detailed measurements, key semantics, privacy limits, and SQLite compatibility.\n"}