sqlite

Designs and operates embedded SQLite databases, transactions, WAL, backups, and migrations.

22|Updated Sep 10, 2026
One-click install
npx skills add https://github.com/Lynricsy/HyperSkills --skill sqlite-lynricsy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlite
Source: https://github.com/Lynricsy/HyperSkills/tree/main/skills/sqlite
Command: npx skills add https://github.com/Lynricsy/HyperSkills --skill sqlite-lynricsy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Embedded SQLite failures are subtle: stale WAL snapshots cause SQLITE_BUSY_SNAPSHOT, file copies miss committed data, and in-transaction PRAGMA changes silently do nothing. This Skill gives an AI agent the operational rules and workflows to diagnose locking, configure durability, back up live databases, and run atomic schema migrations without corrupting data. ## Core Features & Use Cases - Concurrency and transaction recovery: Diagnose BUSY/LOCKED errors by extended error code and transaction phase, apply stale-snapshot retry protocols, and choose between atomic single-statement updates and BEGIN IMMEDIATE. - WAL, backup, and restore: Configure journal modes and synchronous durability, read checkpoint progress correctly, and create consistent live backups through the Online Backup API instead of file copies. - Types, constraints, and migrations: Handle affinity vs STRICT tables, NULL policy in CHECK/UNIQUE/FK constraints, native ALTER by runtime version, and atomic table rebuilds that preserve AUTOINCREMENT history, triggers, and views. - Query tuning: Interpret EXPLAIN QUERY PLAN, shape composite/partial/expression indexes, and refresh planner statistics with measured before/after evidence. - Use Case: A service intermittently returns "database is locked" after a competing write commits. The Skill guides the agent to identify the stale WAL snapshot, restart the whole transaction, re-read state, and reject the request correctly while preserving the competing commit exactly once. ## Quick Start Ask the agent to diagnose why your SQLite application throws database-is-locked errors under concurrent writers and fix the transaction retry logic.

Frequently Asked Questions about sqlite

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

FAQPage Schema
How do I fix SQLITE_BUSY database is locked errors in SQLite?

Classify the extended error code and transaction phase first. A stale WAL snapshot (SQLITE_BUSY_SNAPSHOT) requires rolling back the whole transaction and re-reading from a fresh snapshot; a larger busy timeout cannot make an obsolete snapshot writable.

How do I back up a live SQLite database safely?

Use the SQLite Online Backup API or the CLI .backup command, which capture committed WAL content consistently while writers stay active. Sequentially copying the main file, WAL, and SHM files is not a coherent snapshot and can lose committed data.

Does SQLite enforce foreign keys by default?

No. Foreign-key enforcement is off by default and must be enabled per connection with PRAGMA foreign_keys=ON outside any transaction, then read back. Toggling it inside a transaction silently does nothing, and integrity_check does not detect FK violations.

What is the difference between SQLite STRICT tables and type affinity?

Ordinary tables use affinity as a conversion preference, so INTEGER columns can still store text. STRICT tables (3.37.0+) restrict columns to INT, INTEGER, REAL, TEXT, BLOB, or ANY and reject non-lossless conversions, but still do not replace NOT NULL or CHECK constraints.

How do I migrate a SQLite table schema without losing data?

Use native ALTER when the runtime supports the change; otherwise rebuild atomically in one transaction: create the new table, copy rows, drop and rename, recreate indexes/triggers/views, preserve sqlite_sequence AUTOINCREMENT state, and run FK and integrity checks before committing.

When should I not use this SQLite skill?

Do not use it for Cloudflare D1 bindings and Wrangler migrations, Turso's hosted replication features, ORM-level transaction decorators, or PostgreSQL administration. Those belong to their respective platform or framework skills.