Pular para o conteúdo
Skillpedia
Bancos de dados18 mil · #10714

sqlite-expert

O que ela faz

Esta skill orienta o uso do SQLite como um banco de dados embutido em um único arquivo, incluindo configurações de desempenho, transações e busca de texto completo. É para desenvolvedores que criam apps pequenos, apps móveis, dispositivos ou caches locais.

Quando usar

  • ✓Quando você está criando um app ou dispositivo pequeno que guarda dados em um único arquivo SQLite.
  • ✓Quando o SQLite gera erros de ocupado e precisa de configurações melhores de acesso concorrente.
  • ✓Quando você precisa de busca de texto completo dentro de um banco SQLite.

Link da skill

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/sqlite-expert/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/sqlite-expert/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Configure o SQLite no meu app pequeno de anotações para que leituras e gravações funcionem bem juntas, e adicione busca nos títulos e no corpo das notas.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

A skill recomenda o modo write-ahead logging, um tempo limite de ocupado, transações explícitas e curtas, índices sensatos e a extensão FTS5 para busca de texto completo.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

SQLite Expert

A database specialist with deep expertise in SQLite internals, performance tuning, and embedded database patterns. This skill provides guidance for using SQLite effectively in applications ranging from mobile apps and IoT devices to server-side caching layers and analytical workloads, leveraging its advanced features well beyond simple key-value storage.

Key Principles

  • Enable WAL mode (PRAGMA journal_mode=WAL) for concurrent read/write access; it allows readers to proceed without blocking writers and vice versa
  • Use PRAGMA busy_timeout to set a reasonable wait duration (e.g., 5000ms) instead of receiving SQLITE_BUSY errors immediately on contention
  • Design schemas with appropriate indexes from the start; SQLite's query planner relies heavily on index availability for efficient execution plans
  • Keep transactions short and explicit; wrap related writes in BEGIN/COMMIT to ensure atomicity and reduce fsync overhead
  • Understand that SQLite is serverless and single-file; its strength is simplicity and reliability, not high-concurrency multi-writer workloads

Techniques

  • Set performance PRAGMAs at connection open: journal_mode=WAL, synchronous=NORMAL, cache_size=-64000 (64MB), mmap_size=268435456, temp_store=MEMORY
  • Use FTS5 for full-text search: CREATE VIRTUAL TABLE docs USING fts5(title, body) with MATCH queries and bm25() ranking
  • Query JSON data with the JSON1 extension: json_extract(), json_each(), json_group_array() for document-style data stored in TEXT columns
  • Write recursive CTEs (WITH RECURSIVE) for tree traversal, graph walking, and generating series of values
  • Use window functions (ROW_NUMBER, LAG, LEAD, SUM OVER) for running totals, rankings, and time-series analysis without self-joins
  • Create covering indexes that include all columns needed by a query to enable index-only scans (verified with EXPLAIN QUERY PLAN showing COVERING INDEX)
  • Implement UPSERT with INSERT ... ON CONFLICT (column) DO UPDATE SET for atomic insert-or-update operations

Common Patterns

  • Multi-database Access: Use ATTACH DATABASE to query across multiple SQLite files in a single connection, joining tables from different databases
  • Application-defined Functions: Register custom scalar or aggregate functions in your host language for domain-specific computations inside SQL queries
  • Incremental Vacuum: Use PRAGMA auto_vacuum=INCREMENTAL with periodic PRAGMA incremental_vacuum to reclaim space without a full VACUUM lock
  • Schema Migration: Use PRAGMA user_version to track schema version and apply migration scripts sequentially on application startup

Pitfalls to Avoid

  • Do not open multiple connections with different PRAGMA settings; WAL mode and other PRAGMAs should be set consistently on every connection
  • Do not use SQLite for high-concurrency write workloads with dozens of simultaneous writers; consider PostgreSQL or another client-server database instead
  • Do not store large BLOBs (over 1MB) inline; SQLite performs better when large objects are stored as external files with paths referenced in the database
  • Do not skip EXPLAIN QUERY PLAN during development; without it, slow full-table scans go unnoticed until production load reveals them
Perguntas frequentes

O que é o modo WAL?

É um modo de journal que permite que leitores continuem enquanto um escritor trabalha, o que ajuda no acesso concorrente.

O SQLite é bom para muitos escritores ao mesmo tempo?

A skill diz que o SQLite é mais forte para armazenamento simples e confiável em um único arquivo, e não para cargas com muitos escritores simultâneos.

O que faz um tempo limite de ocupado?

Faz o SQLite esperar um tempo definido por um bloqueio, em vez de falhar imediatamente quando outra gravação está em andamento.

Detalhes

Descrição original do autor

SQLite expert for WAL mode, query optimization, embedded patterns, and advanced features

repo: RightNow-AI/openfang

Popularidade

Estrelas no GitHub
18 mil
Posição no ranking
#10714
Licença
Apache-2.0
Atualizada em
02/07/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas