sqlite-db
БесплатноБез исполняемых скриптовНе проверенGeneral guide for using the sqlite3 CLI to build composable knowledge databases. Use this skill when creating SQLite databases, designing schemas, querying…
от bfollington★ 53 звезды на GitHubОб этом скилле
SQLite Database Skills
Composable knowledge databases via raw SQL.
SQLite databases are portable, self-contained, and require no server. The sqlite3 CLI provides direct access to the full power of relational SQL: indexes, joins, aggregations, window functions, CTEs, full-text search, JSON functions, triggers, and views. This skill teaches agents how to use SQLite as a knowledge management substrate.
Philosophy
SQL is the Interface
No wrapper, no abstraction layer. You compose SQL directly. This gives you the full power of SQLite: complex joins, window functions, CTEs, FTS5, JSON operations, triggers, and views. Verbosity costs tokens, not keystrokes — and the expressiveness pays dividends.
Schemas Are the DDL
No YAML declarations. The CREATE TABLE statements are the schema. Run .schema to see everything. Column types, constraints, foreign keys, indexes — all visible in the DDL. Self-documenting by design.
Composable .db Files
Each domain gets its own .db file. Your notes database, investment tracker, and issue tracker are separate files. Portable — copy, share, back up independently. No central server required.
Agent-Compatible
The sqlite3 CLI is deterministic and stateless per invocation. Output modes (-header -column, .mode json, -line) are parseable. Commands never rely on session state. Perfect for LLM-driven workflows.
Database Targeting
Always pass the database path as the first argument to sqlite3. This ensures stateless, deterministic behavior.
# Single-line command
sqlite3 /path/to/mydata.db "SELECT * FROM notes WHERE status = 'active';"
# Multi-line command via heredoc
sqlite3 /path/to/mydata.db <<'SQL'
SELECT id, title, created_at
FROM notes
WHERE status = 'active'
ORDER BY created_at DESC;
SQL
Output Modes
Choose the output mode based on your needs:
| Mode | Use Case | Invocation |
|---|---|---|
| Column | Human-readable tables | sqlite3 -header -column mydata.db "SELECT ..." |
| JSON | Agent parsing with jq | sqlite3 mydata.db "SELECT ..." | jq (after .mode json) |
| CSV | Export to spreadsheets | sqlite3 -csv -header mydata.db "SELECT ..." |
| Line | Single record inspection | sqlite3 -line mydata.db "SELECT * FROM notes WHERE id = 'NOTE-...';" |
JSON Mode Example
# Enable JSON output and query
sqlite3 /path/to/mydata.db <<'SQL'
.mode json
SELECT id, title, tags FROM notes LIMIT 5;
SQL
Then pipe to jq for filtering or transformation:
sqlite3 /path/to/mydata.db "SELECT ..." | jq -r '.[] | select(.status == "active") | .id'
Core Operations
Initialize a Database
Create the database directory and initialize tables with constraints and pragmas:
# Create directory
mkdir -p /path/to/.sqlite
# Initialize database with pragmas and schema
sqlite3 /path/to/.sqlite/mydata.db <<'SQL'
PRAGMA journal_mode = WAL;
PRAGMA foreign_keys = ON;
CREATE TABLE IF NOT EXISTS notes (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
body TEXT,
status TEXT NOT NULL CHECK (status IN ('draft', 'active', 'archived')) DEFAULT 'draft',
tags TEXT CHECK (json_valid(tags)),
created_at TEXT NOT NULL DEFAULT (datetime('now')),
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);
CREATE INDEX IF NOT EXISTS idx_notes_status ON notes(status);
CREATE INDEX IF NOT EXISTS idx_notes_created ON notes(created_at DESC);
SQL
Important pragmas:
PRAGMA journal_mode = WAL;— enables concurrent reads and better performancePRAGMA foreign_keys = ON;— enforces referential integrity
Generate IDs
Use inline SQL expressions to generate unique, time-ordered, human-readable IDs:
'PREFIX-' || strftime('%Y%m%d', 'now') || '-' || lower(hex(randomblob(4)))
Examples:
'NOTE-' || strftime('%Y%m%d', 'now') || '-' || lower(hex(randomblob(4)))→NOTE-20260208-a3f8c291'TASK-' || strftime('%Y%m%d', 'now') || '-' || lower(hex(randomblob(4)))→TASK-20260208-7b2e9f41
Prefix conventions:
- Notes:
NOTE- - Tasks:
TASK- - Resources:
RES- - Clippings:
CLIP- - Breadcrumbs:
CRUMB- - Reflections:
REFL-
Create Records
Insert records with inline ID generation:
sqlite3 /path/to/.sqlite/mydata.db <<'SQL'
INSERT INTO notes (id, title, body, status, tags)
VALUES (
'NOTE-' || strftime('%Y%m%d', 'now') || '-' || lower(hex(randomblob(4))),
'Understanding Composability',
'Systems that compose are systems that scale...',
'active',
json_array('systems', 'design', 'composability')
);
SQL
Note: Use json_array() for JSON array fields, not string concatenation.
Query Records
# Simple query with filtering and ordering
sqlite3 -header -column /path/to/.sqlite/mydata.db <<'SQL'
SELECT id, title, status, created_at
FROM notes
WHERE status = 'active'
ORDER BY created_at DESC
LIMIT 10;
SQL
Pagination example:
SELECT id, title
FROM notes
ORDER BY created_at DESC
LIMIT 20
Установить sqlite-db в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл sqlite-db?
General guide for using the sqlite3 CLI to build composable knowledge databases. Use this skill when creating SQLite databases, designing schemas, querying data, managing relationships, or building new sqlite-based domain skills. Provides the foundational patterns that all specialized sqlite skills build upon.
Как установить скилл sqlite-db?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sqlite-db запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic