Implements SQLite best practices in Python for improved concurrency, safety, and performance.

Install

mkdir -p .claude/skills/sqlite-ops-aiskillstore && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/19533" && unzip -o skill.zip -d .claude/skills/sqlite-ops-aiskillstore && rm skill.zip

Installs to .claude/skills/sqlite-ops-aiskillstore

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Patterns for SQLite databases in Python projects - state management, caching, and async operations. Triggers on: sqlite, sqlite3, aiosqlite, local database, database schema, migration, wal mode.
194 charsno explicit “when” trigger
Beginner

Key capabilities

  • Configure SQLite connection with WAL mode
  • Implement context managers for database transactions
  • Execute CLI commands for schema inspection
  • Manage database concurrency settings
  • Export database content to CSV

How it works

The skill provides Python code templates for managing SQLite connections, enabling WAL mode for concurrency, and using context managers to handle transaction commits and rollbacks.

Inputs & outputs

You give it
Database path and SQL commands
You get back
Database connection object or query results

When to use sqlite-ops

  • Configure concurrent read-write access using WAL mode
  • Implement context managers for database transactions
  • Debug database locked errors
  • Check database schema or tables via CLI

About this skill

SQLite Operations

Patterns for SQLite databases in Python projects.

Quick Connection

import sqlite3

def get_connection(db_path: str) -> sqlite3.Connection:
    conn = sqlite3.connect(db_path, check_same_thread=False)
    conn.row_factory = sqlite3.Row  # Dict-like access
    conn.execute("PRAGMA journal_mode=WAL")  # Better concurrency
    conn.execute("PRAGMA foreign_keys=ON")
    return conn

Context Manager Pattern

from contextlib import contextmanager

@contextmanager
def db_transaction(conn: sqlite3.Connection):
    try:
        yield conn
        conn.commit()
    except Exception:
        conn.rollback()
        raise

WAL Mode

Enable for concurrent read/write:

conn.execute("PRAGMA journal_mode=WAL")
ModeReadsWritesBest For
DELETE (default)Blocked during writeSingleSimple scripts
WALConcurrentSingleWeb apps, MCP servers

Common Gotchas

IssueSolution
"database is locked"Use WAL mode
Slow queriesAdd indexes, check EXPLAIN QUERY PLAN
Thread safetyUse check_same_thread=False
FK not enforcedRun PRAGMA foreign_keys=ON

CLI Quick Reference

sqlite3 mydb.sqlite    # Open database
.tables                # Show tables
.schema items          # Show schema
.headers on && .mode csv && .output data.csv  # Export CSV
VACUUM;                # Reclaim space

When to Use

  • Local state/config storage
  • Caching layer
  • Event logging
  • MCP server persistence
  • Small to medium datasets

Additional Resources

For detailed patterns, load:

  • ./references/schema-patterns.md - State, cache, event, queue table designs
  • ./references/async-patterns.md - aiosqlite CRUD, batching, connection pools
  • ./references/migration-patterns.md - Version migrations, JSON handling

When not to use it

  • High-concurrency write-heavy production environments
  • Distributed database applications

Prerequisites

Python 3.8+sqlite3 standard library or aiosqlite

Limitations

  • WAL mode supports only single concurrent writer
  • Requires manual index management for performance

How it compares

Unlike manual connection handling, this skill provides pre-configured patterns for concurrency and transaction safety specifically for Python projects.

Compared to similar skills

sqlite-ops side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
sqlite-ops (this skill)022dReviewBeginner
django-pro203moNo flagsIntermediate
senior-backend147moReviewAdvanced
supabase-python03moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry