sqlite-best-practices

Optimize SQLite usage in Go applications with database/sql and mattn/go-sqlite3.

Updated Oct 29, 2025
One-click install
npx skills add https://github.com/billybbuffum/budget --skill sqlite-best-practices-billybbuffum
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlite-best-practices
Source: https://github.com/billybbuffum/budget/tree/main/.claude/skills/sqlite-best-practices
Command: npx skills add https://github.com/billybbuffum/budget --skill sqlite-best-practices-billybbuffum

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides Go developers in applying SQLite best practices to ensure robust data storage, correct schema design, and high-performance queries in local or embedded applications.

Core Features & Use Cases

  • Connection hygiene and PRAGMAs for better concurrency and reliability
  • Proper data types and money handling (using INTEGER for monetary values)
  • Safe transactions, indexing strategies, and common anti-patterns to avoid
  • Use Case: optimize a Go project that uses SQLite for offline storage, dashboards, or local services

Quick Start

Set up a Go project with a SQLite database, enable WAL mode and foreign keys, and implement a small repository using database/sql and mattn/go-sqlite3. Validate basic CRUD performance and correctness with simple tests.

Frequently Asked Questions about sqlite-best-practices

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

FAQPage Schema
What's the best way to configure SQLite pragmas in Go for concurrency?

Configuring SQLite pragmas in Go involves enabling WAL mode and foreign keys to improve concurrency and reliability. Proper connection hygiene ensures robust data storage when using database/sql with mattn/go-sqlite3.

How do I handle money values safely with SQLite in Go applications?

Handle money values in SQLite by storing them as INTEGER amounts rather than floating-point numbers. This prevents rounding errors and follows best practices for robust monetary data handling in Go applications.

Does the mattn/go-sqlite3 driver support safe transactions and indexing?

Yes, the mattn/go-sqlite3 driver supports safe transactions and indexing strategies through database/sql. Proper schema design and indexing optimize query performance for local or embedded Go applications.

Why does my SQLite database lock during concurrent Go database/sql queries?

SQLite database locking during concurrent Go queries often results from default journal modes. Enabling WAL mode via pragmas improves concurrency and prevents write locks from blocking database/sql reads.

How do I design an SQLite schema with foreign keys for a Go project?

Designing an SQLite schema with foreign keys in Go requires enabling foreign key enforcement through pragmas. This ensures referential integrity and robust data storage for local services and offline applications.