sqlite-expert
できること
このスキルは、性能の設定、トランザクション、全文検索を含め、組み込み型の単一ファイルデータベースとしてSQLiteを使う方法を案内します。小さなアプリ、モバイルアプリ、機器、ローカルキャッシュを作る開発者向けです。
使う場面
- ✓1つのSQLiteファイルにデータを保存する、小さなアプリや機器を作っているとき。
- ✓SQLiteでbusyエラーが出て、同時アクセスの設定を改善する必要があるとき。
- ✓SQLiteデータベース内で全文検索が必要なとき。
スキルのリンク
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/sqlite-expert/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“小さなメモアプリのためにSQLiteを設定してください。読み取りと書き込みがスムーズに同時に動くようにし、メモのタイトルと本文を検索できるようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、WAL(先行書き込みログ)モード、busyタイムアウト、短く明示的なトランザクション、適切なインデックス、全文検索のためのFTS5拡張を推奨します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
よくある質問
WALモードとは何ですか?
書き込みの処理中にも読み取りを継続できるジャーナルモードです。同時アクセスに役立ちます。
SQLiteは多くの書き込み者が同時に使うのに向いていますか?
いいえ。このスキルは、SQLiteはシンプルで信頼できる単一ファイルの保存に強く、同時の多数書き込みには向かないと述べています。
busyタイムアウトは何をしますか?
別の書き込みが進行中のとき、すぐに失敗するのではなく、ロックが解放されるまで設定された時間待ちます。
詳細
作者による元の説明
SQLite expert for WAL mode, query optimization, embedded patterns, and advanced features
repo: RightNow-AI/openfang
人気
- GitHubのスター
- 18k
- ランキング
- #10714
- ライセンス
- Apache-2.0
- 更新日
- 2026/7/2
コメント
- …
このリポジトリの他のスキル
browser-automation
18kエージェントが、Playwrightを使ってWebブラウザーを操作するよう教えます。CSSセレクターでボタン、フォーム、リンクを見つけます。
clip-hand-skill
18kエージェントが、動画のクリップを作るのを助けます。動画をダウンロードし、音声を文字起こしし、字幕ファイルを作り、ffmpegでクリップを切り出します。
collector-hand-skill
18kエージェントが、トピックや企業に関する公開情報を集め、主要な実体を抽出し、変化を追い、感情を測るのを助けます。
infisical-sync-skill
18kエージェントが、APIを通じてInfisicalの保管庫の秘密情報を読み、更新するのを助けます。ログインの手順と明確なエラー処理を含みます。
似ているスキル
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
clickhouse-io
280kエージェントがClickHouseデータベースのクエリとスキーマを最適化できるようにします。高性能な分析処理向けのベストプラクティスを適用します。分析クエリが遅すぎるときに使います。
scientific-db-pubmed-database
280kエージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。