SQLite Database Expert

Implements secure SQLite database operations with parameterized queries, migrations, and FTS5 search.

Updated Sep 1, 2021
One-click install
npx skills add https://github.com/WP-Coaching/pellegrims.coach --skill sqlite-database-expert-wp-coaching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: SQLite Database Expert
Source: https://github.com/WP-Coaching/pellegrims.coach/tree/main/.agents/skills/SQLite%20Database%20Expert
Command: npx skills add https://github.com/WP-Coaching/pellegrims.coach --skill sqlite-database-expert-wp-coaching

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building local data persistence for desktop applications often leads to SQL injection vulnerabilities, data loss from unmanaged schema changes, and slow queries. This Skill provides expert guidance for implementing SQLite databases that are secure, transactional, and performant. ## Core Features & Use Cases - SQL Injection Prevention: Enforces parameterized queries, LIKE pattern escaping, and whitelisting for dynamic column names in Rust (rusqlite) and Python. - Migration Management: Implements versioned schema migrations with rollback capability and a tracking table. - Full-Text Search (FTS5): Sets up FTS5 virtual tables with sync triggers, boolean queries, and highlighted snippets. - Performance Optimization: Configures WAL mode, connection pooling with r2d2, batch inserts, and index strategies. - Use Case: When building a Tauri desktop app that stores user documents locally, use this Skill to create the database layer with encrypted backups, audit logging, and injection-safe search. ## Quick Start Ask the AI to implement a secure SQLite repository with migrations and FTS5 search for your desktop application.

Frequently Asked Questions about SQLite Database Expert

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

FAQPage Schema
How do I prevent SQL injection in SQLite queries?

Use parameterized queries with positional (?1) or named (:name) parameters instead of string formatting. For dynamic column or table names, validate against a whitelist of allowed values before interpolating them into the query string.

How to implement database migrations in SQLite with Rust?

Create a schema_migrations tracking table and define migrations with version numbers, up and down SQL statements. Run pending migrations inside transactions and record each applied version, enabling rollback by executing down statements in reverse order.

Does SQLite support full-text search?

Yes, SQLite includes FTS5 for full-text search via virtual tables. Create an FTS5 table with content sync triggers, then query with MATCH operators supporting boolean logic, prefix matching, phrase search, and BM25 relevance ranking.

Should I use rusqlite or sea-query for SQLite in Rust?

rusqlite provides direct database access with bundled SQLite, while sea-query adds a type-safe query builder on top. Use rusqlite for straightforward queries and sea-query when building dynamic queries programmatically with compile-time checks.

Why is my SQLite database slow with concurrent access?

The default DELETE journal mode blocks readers during writes. Enable WAL mode with PRAGMA journal_mode = WAL, set synchronous to NORMAL, and use connection pooling so concurrent reads proceed while a write transaction is active.

When should I not use SQLite for data storage?

SQLite is designed for embedded, single-machine storage and does not suit high-concurrency server workloads with many simultaneous writers. For multi-client network access or distributed systems, use a client-server database instead.